Hi Team,
Using TMS570LC4357 for online upgrade function. The app runs by writing the app program to the app store through the bootloader and then the boot program runs to the app. However, the app program does not run after power-up through software, hardware, or power-down.
1) bl_link.cmd
/*----------------------------------------------------------------------------*/
/* Linker Settings */
--retain="*(.intvecs)"
/*----------------------------------------------------------------------------*/
/* Memory Map */
MEMORY
{
/* USER CODE BEGIN (2) */
/* USER CODE END */
VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xffffffff
FLASH0 (RX) : origin=0x00000020 length=0x001FFFE0 vfill = 0xffffffff
FLASH1 (RX) : origin=0x00200000 length=0x00200000 vfill = 0xffffffff
SRAM (RWX) : origin=0x08002000 length=0x0002D000
STACK (RW) : origin=0x08000000 length=0x00002000
#if 1
/* Add memory regions corresponding to the ECC area of the flash bank */
ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))
length=(size(VECTORS) >> 3)
ECC={algorithm=algoL2R5F021, input_range=VECTORS}
ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0) >> 3))
length=(size(FLASH0) >> 3)
ECC={algorithm=algoL2R5F021, input_range=FLASH0 }
ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1) >> 3))
length=(size(FLASH1) >> 3)
ECC={algorithm=algoL2R5F021, input_range=FLASH1 }
#endif
}
/*----------------------------------------------------------------------------*/
/* ECC */
/* Add an ECC {} directive describing the algorithm that matches the device */
ECC
{
algoL2R5F021 : address_mask = 0xfffffff8 /*Address Bits 31:3 */
hamming_mask = R4 /*Use R4/R5 build in Mask */
parity_mask = 0x0c /*Set which ECC bits are Even & Odd parity */
mirroring = F021 /*RM57Lx and TMS570LCx are build in F021*/
}
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.intvecs : {} > VECTORS
/* The root directory is \Debug */
flashAPI:
{
.\F021_Flash_API\02.01.01\source\Fapi_UserDefinedFunctions.obj (.text)
.\source\bl_flash.obj (.text)
--library= "..\F021_Flash_API\02.01.01\F021_API_CortexR4_BE_L2FMC.lib" (.text)
} palign=8 load = FLASH0 |FLASH1, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize)
.text : {} palign=8 > FLASH0 |FLASH1 /*Initialized executable code and constants*/
.const : {} palign=8 load=FLASH0 |FLASH1, run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize) /*Initialized constant data (e.g. const flash_sectors[..] = )*/
.cinit : {} palign=8 > FLASH0 |FLASH1 /*Initialized global and static variables*/
.pinit : {} palign=8 > FLASH0 |FLASH1
.data : {} > SRAM
.bss : {} > SRAM
.sysmem : {} > SRAM
}
2) Flash writes to the liabrary:
3) Once the program is written, entering app:
4) The bootloader powers up and runs to app:
5) The bootloader also writes and saves some app parameters after flash (0x003E0000U).
And the test results are as follows:
a. Download bootloader, erase only the area used by bootloader and boot app program, the app is working properly.
b. After the bootloader writes the app program to memory, boot the app program directly, and the app works.
c. After the bootloader writes the app program to memory, it does not run the app, the software resets the CPU. Boot the app program, app does not function properly.
d. After the bootloader writes the app program to memory, it does not run the app, and the CPU is reset by hardware. Boot the app program and the app works.
e. After the bootloader writes the app program to memory, do not run the app, power it up again, boot the app program, app does not function properly.
Could you help check this case? Thanks.
Best Regards,
Cherry