Other Parts Discussed in Thread: UNIFLASH, EK-TM4C1294XL
In my device, the FW upgrade has to be done via ethernet by another device. So I have created code in my application (start address 0x20000) to received data via TCP/IP and flashing into another memory (0x40000). and setting FW upgrade flag as 1 in configuration memory.
I have checked the stored data in 0x40000 is same as the binary loaded from PC tool (project tool).
App:
1. TCP/IP
2. FW upgrade command receives, store data in 0x40000
3. check for CRCs and set FW upgrade flag
4. move to boot address (0x00)
code used to move to boot address
HWREG(NVIC_VTABLE) = 0x00;
// 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");
In Boot code:
1. Checking for FW upgrade flag status.
2. If fw upgrade is set, then erasing flash 0f application (0x20000 length about 128kb) and flash write data from 0x40000 to 0x20000 and reset the FW upgrade flag.
3. jump to application address 0x20000. (both FW upgrade flag set or not set). This is working when bootloader is flashed 1st and flashing application via CCS IDE / LM flash.
HWREG(NVIC_VTABLE) = 0x20000;
// 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");
After upgrading via PC tool (project tool), flashing from 0x40000 to 0x20000 and jump to application is not working. Is anyother is missing in jumping to location. both boot and application using same SRAM - 0x20000000 memory. Do I need to change anything in SRAM.
App Cmd file
--retain=g_pfnVectors
/* The following command line options are set as part of the CCS project. */
/* If you are building using the command line, or for some reason want to */
/* define them here, you can uncomment and modify these lines as needed. */
/* If you are using CCS for building, it is probably better to make any such */
/* modifications in your CCS project and leave this file alone. */
/* */
/* --heap_size=0 */
/* --stack_size=256 */
/* --library=rtsv7M3_T_le_eabi.lib */
/* The starting address of the application. Normally the interrupt vectors */
/* must be located at the beginning of the application. */
#define APP_BASE 0x00020000
#define RAM_BASE 0x20000000
/* System memory map */
MEMORY
{
/* Application stored in and executes from internal flash */
FLASH (RX) : origin = APP_BASE, length = 0x00010000
/* Application uses internal RAM for data */
SRAM (RWX) : origin = RAM_BASE, length = 0x00040000
}
/* Section allocation in memory */
SECTIONS
{
.intvecs: > APP_BASE
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.vtable : > RAM_BASE
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
.TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
#endif
#endif
}
Boot cmd
--retain=g_pfnVectors
/* The following command line options are set as part of the CCS project. */
/* If you are building using the command line, or for some reason want to */
/* define them here, you can uncomment and modify these lines as needed. */
/* If you are using CCS for building, it is probably better to make any such */
/* modifications in your CCS project and leave this file alone. */
/* */
/* --heap_size=0 */
/* --stack_size=256 */
/* --library=rtsv7M3_T_le_eabi.lib */
/* The starting address of the application. Normally the interrupt vectors */
/* must be located at the beginning of the application. */
#define BOOT_BASE 0x00000000
#define RAM_BASE 0x20000000
/* System memory map */
MEMORY
{
/* Application stored in and executes from internal flash */
FLASH (RWX) : origin = BOOT_BASE, length = 0x00002000
/* Application uses internal RAM for data */
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}
/* Section allocation in memory */
SECTIONS
{
.intvecs: > BOOT_BASE
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.vtable : > RAM_BASE
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
.TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
#endif
#endif
}
__STACK_TOP = __stack + 4096;
Both are having startup file. But Boot doesn't need startup. how to remove that vector in boot cmd.