Part Number:TMS570LC4357
使用TMS570LC4357做在线升级功能。通过Bootloader将APP程序写入APP存储区,然后引导程序运行到APP,APP正常运行,但通过软件、硬件或是断电上电后,APP程序不运行。
程序代码:
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写入库
3、程序写入后,进入APP
4、Bootloader上电后运行到APP
5、Bootloader还会在flash的 (0x003E0000U) 后面写入和保存一些APP的参数。
通过测试发现:
1、下载Bootloader,只擦除Bootloader使用的区域,引导APP程序,APP能正常运行。
2、Bootloader将APP程序写入内存后,直接引导APP程序,APP能正常运行。
3、Bootloader将APP程序写入内存后,不运行APP,软件复位CPU,引导APP程序,APP不能正常运行。
4、Bootloader将APP程序写入内存后,不运行APP,硬件复位CPU,引导APP程序,APP能正常运行。
5、Bootloader将APP程序写入内存后,不运行APP,重新上电,引导APP程序,APP不能正常运行。
不知道是什么原因?
Cherry Zhou:
您好,您的问题我们需要升级到英文论坛寻求帮助,如有答复将尽快回复您。
,
Cherry Zhou:
您好,
如果复位后应用程序无法工作,请参考以下帖子的解答:
https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1244024/tms570lc4357-freertos-bootloader-application-getting-problem-in-i2c/4705344?tisearch=e2e-sitesearch&keymatch=%252522jagadish%252522%252520AND%252520%252522no_reset%252522#4705344