Other Parts Discussed in Thread: CONTROLSUITE
I've been able to use a bootloader to load code successfully to flash. However, for my application, I need the bootloader to automatically restart if either communication is lost or if power is lost to the device.
Just to provide some background, here is what I have:
1. GPIO37 and 34 are both set to one (in order to enter Get mode). These values are fixed and the user cannot be modified by the user.
2. My main function is then entered. See the image below. "enter_bootloader" establishes SCI and performs autobaud. If this is all successful, SciBoot() is then entered. SciBoot is a function defined in an assembly file. This then branches to the SCI Boot Rom.
3. From there, the C2000 Serial Firmware Upgrader is then used. It starts by loading "f28069_flash_kernel" to RAM. This both the C2000 Serial Firmware Upgrader and flash kernel are originally from TI controlSUITE.
4. Once this is successful, the flash kernel then loads the application code to flash.
5. When this is complete, the board restarts. Since no autobaud character is sent, the board times out of the "enter_Bootloader()" function and continutes with the rest of the application code. Everything up to this point works if the power is never turned off during bootloading process or if the communication is never interrupted.
In order to make this work even if the bootloader was unsuccessful, I decided to put all the functions associated with the bootloader in sector E. This sector will never be erased by the flash kernel. All the other application code is in sectors F, G, and H. In order to do this, I modified the linker command file to list specific address in sector E for the bootloader. I then used the CODE_SECTION pragma in Main.c. See the images below:
After I added this, I powered off the device when it was loading to flash. When I turned it back on, it seems like it didn't attempt to go to the "enter_bootloader" function since C2000 Serial Firmware Upgrader wasn't able to start loading the flash kernel. Does anyone know what the issue might be? Is it because main is referencing a function, "DynalinkXLoop()", that's in a sector that's part of a sector that gets erased and then written to during the bootloader process?
Sorry about the long post.