Other Parts Discussed in Thread: SYSBIOS, CONTROLSUITE
Hello Dear community.
In our project, we need to have a bootloader to update the M3 firmware stored on a SD card(spi). We'll also need to update the C28, but let's focus only on M3 for now.
I first wanted to try to jump from the bootloader to the application as a first test, after 'manually' flashing both firmwares via CCS and the JTAG debug probe..
I first tried a "naive" approach :
I have 2 CCS projects, one for the bootloader and one for the application.
The booloader linker file looks like :
... FLASH_BOOT (RWX) : origin = 0x00200030, length = 0x00000004 // Not exactly sure what is put in this section, but I guess this one is key.. ? FLASH (RWX) : origin = 0x00200034, length = 0x0001FFCC // Bootloader code (I know, it's a big section for bootloader..) RSVD_FIRMWARE : origin = 0x00220000, length = 0x0005FF00 // Reserved for application and main function address ... .text : > FLASH .binit : > FLASH .cinit : > FLASH .pinit : > FLASH .const : > FLASH ...
And the application linker file:
...
RSVD_BOOTLOADER : origin = 0x00200030, length = 0x0001FFD0 FLASH_BOOT (RWX) : origin = 0x00220000, length = 0x00000004 // Not exactly sure what is put in this section FLASH (RWX) : origin = 0x00220004, length = 0x0005FEF8 // Application code MAIN_ADDR (RWX) : origin = 0x0027FEFC, length = 0x00000004 // Stores the main function address of application ... .text : > FLASH .binit : > FLASH .cinit : > FLASH .pinit : > FLASH .const : > FLASH ...
So in the application code, I store the main function pointer address at a specific flash address(0x0027FEFC in this case).
In the bootloader code, I simply retreive the application main function address and try to call the function from there. I know that the main function address is retrieved correctly, but when I call the application main function, nothing happens. It just hangs and I don't catch any exception message in the debugger.
I understand this is quite a naive solution, but it looks like it worked for some guy on another plateform as described in the OP here e2e.ti.com/.../113899
Could anyone point me in the right direction to solve my problem ? Any advice or example would be greatly appriciated.
I've searched a lot but didn't find any example for the Concerto chips. I know that CodeSkins propose commercial solutions for my plateform, but we would really like to do it on our own for now.
Thanks everyone!
Ril
UPDATE:
After reading this post:https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/321081
I also tried:
// Set the vector table to the beginning of the app in flash.
HWREG(NVIC_VTABLE) = 0x22000000; // also tried with 0x220001, 0x220004 and 0x220005
// Load the stack pointer from the application's vector table.
//
__asm(" ldr r1, [r0]\n"
" mov sp, r1");
// Load the initial PC from the application's vector table and branch to
// the application's entry point.
//
__asm(" ldr r0, [r0, #4]\n"
" bx r0\n");
but it didn't work.