-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External flash (again) #98
Conversation
Okay, CMake shouldn't break anything compared to before. (Check the last two commits for details). Also travis is happy: https://travis-ci.com/Daft-Freak/32blit-beta/builds/146981631 |
I've attempted to wrangle CMake into letting us store firmware projects outside of |
Pushed a slightly modified version that avoids duplicating the include dir list or relying on the directory structure. (Though, this is roughly the same as switching the |
Notes ===== Sorry, I tried to get the flash-loader going as an example via CMake and failed miserably. So currently it is being built by the makefile in 32blit-stm32 Overview ======== Consists of three parts: 1. Ability to switch execution between internal and external flash 2. Generalised command handling via CDC streaming. There is a single CDCCommandStream hanging off of the CDC receive via a FIFO. There can be many CDCCommandHandlers registered with the CDCCommandStream with a FourCC key. A CDCCommandHandler can register more that 1 FourCC key. The CDCCommandStream parses the incoming data and dispatches a CDCDataStream to the registered CDCCommandHandler User code needs placing in a subclass of CDCCommandHandler and implements StreamData() and StreamInit() In StreamInit() return true if more data is expected, otherwise false for non streaming commands. In StreamData() return a StreamResult, currently implemented: srError : Somethings gone wrong srContinue : Everything fine but need more data srFinish : Everything fine and finished with stream. For examples of simple non streaming commands see CDCInfoHandler and CDCResetHandler. For an example of streaming commands see the flash-loader. 3. flash-loader example Simple example flash loader Display list of bin files on SDCard (just one page), program external flash and run. Switch between running loader and app from "System Menu" Save bin files to SDCard over CDC Program external flash over CDC. Changes ======= Changed 32blit.toolchain Added variables needed for switching execution and CDC Fifo Buffering Added 32blitEXT.toolchain Use this toolchain to build for external flash Changed Engine.hpp and Engine.cpp Added code to switch execution Changed 32blit-stm32/CMakeLists.txt Added ccsbcs.c for unicode/ascii Added CDC source files Added defines for toolchain variables Added more Elf info displayed when building Changed 32blit-stm32/Makefile flash-Loader is being built here, sorry I tried looking at getting this going via Make but after a couple of hours gave up someone that knows about make will need to work this out. Changed 32blit-stm32/STM32H750VBTx_FLASH.ld Increase heap slightly Added 32blit-stm32/STM32H750VBTxEXT_FLASH.ld ld for linking against EXT flash Changed 32blit.h and 32blit.c added blit_switch_executable added code to disable ADC, used when transferring data via CDC there is an issue in the ADC polling code where it can fail on the second channel read causing a long delay/hang. Someone needs to look at this. changed ffconf.h enable findfile and LFN Changed quadspi.h and quadspi.c set QSPI_FLASH_SIZE correctly make QSPI_WriteEnable() and qspi_chip_erase() public. Set clockPrescaler to 5 Return status in some functions Disable optimisations for qspi_init() as this was causing issues! Added CDCCommandHandler.cpp CDCCommandHandler.h CDCCommandStream.cpp CDCCommandStream.h CDCDataStream.cpp CDCDataStream.h CDC streaming infrastructure. CDCInfoHandler.cpp CDCInfoHandler.h Used to probe 32Blit to see if CDC working and where code is running CDCResetHandler.cpp CDCResetHandler.h Used to reset the 32Blit Added flash-loader.h and flash-loader.cpp The simple flash loader Handles CDC SAVE and CDC PROG simple screen of bin files on SDCard to program Changed main.c Added g_commandStream global for CDC streaming Use INITIALISE_QSPI define to init qspi Add command handlers for _RST and INFO Call Stream() in main loop to handle buffered usb data. Changed system_stm32h7xx.c use APPLICATION_VTOR define to set VTOR Changed usbd_cdc_if.c Use g_commandStream and Fifo fo receiving CDC USB data.
A little difficult since it needs some of the dirs/flags for the HAL
For consistency
Not needed and broken by combined build
Had no effect on Debug/RelWithDebInfo builds, and would make Release/MinSizeRel builds RelWithDebInfo builds
Previously -Os was specified in the toolchain. Now the flags for the build types are: Debug: -Og -g Release: -Os for internal flash, -O3 for external MinSizeRel: -Os everywhere (SDL builds still use the CMake defaults)
Prevents a build failure when no build type is specified due to no optimisations. (We used to be setting -Os unconditionally)
I've attemped to wrangle CMake somewhat here to get closer to a firmware build setup that anyone can use. Perhaps we need a function blit_executable_firmware which includes the extra include dirs and definitions instead of using blit_executable_int_flash whichh wont always need these. On the other hand- these defines/include dirs shouldn't actually do any harm to int_flash executables that don't use them.
This is #95 with a little extra rebasing and some hopefully reasonable CMake support.