Hi all,
I use raspberry pi as a host to communicate with TM4C123gxl via UART. I want to demo a flash bootloader feature.
After weeks of work and the help form TI community ,I can use every command packets of tivaware bootloader except "Run command ". I have checked that after recieving run command,the program is in the "case COMMAND_RUN:"and the program run till "Reset and disable the peripherals used by the boot loader ".
I guess that
((void (*)(void))g_ui32TransferAddress)();
doesn't work. After searching the Forum, I found some articles about CallApplication.
So I use a function to instead ((void (*)(void))g_ui32TransferAddress)(). The Function is :
void
CallApplication(uint32_t ui32StartAddr)
{
//
// Set the vector table to the beginning of the app in flash.
//
HWREG(NVIC_VTABLE) = ui32StartAddr;
//
// Load the stack pointer from the application's vector table.
//
__asm(" ldr r1, [r0]\n"
" mov sp, r1\n");
//
// 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");
}
After adding this to the project and building it with CCS, I can send a run command to bootloader and the application will run.
My question is as below :
does "((void (*)(void))g_ui32TransferAddress)();" really not work or I missed something?
how can I write a CallApplication in Keil? I studied many forum about " Keil : Inline assembly in C ",but still didn't figure out.
Appreciate for any help.