大家好、
使用 TMS570LC4357实现在线升级功能。 应用程序运行的方式是通过引导加载程序将应用程序写入应用程序存储、然后引导程序运行到应用程序。 但是、应用程序在上电后不会通过软件、硬件或断电运行。
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) 2) 闪存写入 library:

3) 程序写入后、输入 app:



4) 4) 引导加载程序上电并运行到应用程序:

5) 5) 引导加载程序还会在闪存之后写入和保存一些应用参数(0x003E0000U)。
测试结果如下所示:
a.下载引导加载程序、仅擦除引导加载程序和引导应用程序使用的区域、该应用程序运行正常。
b.在引导加载程序将应用程序写入存储器后、直接引导应用程序、应用程序将正常工作。
c.在引导加载程序将应用程序写入存储器后、它不会运行应用、软件会复位 CPU。 启动应用程序、应用程序无法正常运行。
D.在引导加载程序将应用程序写入存储器后、它不会运行应用、并且 CPU 由硬件复位。 引导应用程序、应用程序即可正常工作。
e.在引导加载程序将应用程序写入存储器后、请勿运行应用程序、再次为其通电、然后引导应用程序、应用程序无法正常工作。
您能帮助检查这个问题吗? 谢谢。
此致、
切里