Hello,
We are developing the bootloader using TMS570LS3137 and found that in the bootloader:
Fapi_issueAsyncCommandWithAddress (Fapi_EraseSector, flash_sector [sectornum]. Start);
this function can erase bank1 sector, However, it is not possible to erase a sector in bank0, for example, when erasing sector10 in bank0, the system will make an error in erasing the sector.
1. The erasing function is as follows:
const SECTORS flash_sector[NUMBEROFSECTORS]=
{
(void *)0x00000000, 0x08000, 0, 0, 0xfff87000,
(void *)0x00008000, 0x08000, 0, 1, 0xfff87000,
(void *)0x00010000, 0x08000, 0, 2, 0xfff87000,
(void *)0x00018000, 0x08000, 0, 3, 0xfff87000,
(void *)0x00020000, 0x20000, 0, 4, 0xfff87000,
(void *)0x00040000, 0x20000, 0, 5, 0xfff87000,
(void *)0x00060000, 0x20000, 0, 6, 0xfff87000,
(void *)0x00080000, 0x20000, 0, 7, 0xfff87000,
(void *)0x000A0000, 0x20000, 0, 8, 0xfff87000,
(void *)0x000C0000, 0x20000, 0, 9, 0xfff87000,
(void *)0x000E0000, 0x20000, 0, 10, 0xfff87000,
(void *)0x00100000, 0x20000, 0, 11, 0xfff87000,
(void *)0x00120000, 0x20000, 0, 12, 0xfff87000,
(void *)0x00140000, 0x20000, 0, 13, 0xfff87000,
(void *)0x00160000, 0x20000, 0, 14, 0xfff87000,
(void *)0x00180000, 0x20000, 1, 0, 0xfff87000,
(void *)0x001A0000, 0x20000, 1, 1, 0xfff87000,
(void *)0x001C0000, 0x20000, 1, 2, 0xfff87000,
(void *)0x001E0000, 0x20000, 1, 3, 0xfff87000,
(void *)0x00200000, 0x20000, 1, 4, 0xfff87000,
(void *)0x00220000, 0x20000, 1, 5, 0xfff87000,
(void *)0x00240000, 0x20000, 1, 6, 0xfff87000,
(void *)0x00260000, 0x20000, 1, 7, 0xfff87000,
(void *)0x00280000, 0x20000, 1, 8, 0xfff87000,
(void *)0x002A0000, 0x20000, 1, 9, 0xfff87000,
(void *)0x002C0000, 0x20000, 1, 10, 0xfff87000,
(void *)0x002E0000, 0x20000, 1, 11, 0xfff87000
};
uint8_t drvFapi_BlockEraseSector(uint8_t sectornum)
{
uint8_t RetValue=0;
Fapi_initializeFlashBanks((uint32_t)SYS_CLK_FREQ); /* used for API Rev2.01 */
Fapi_setActiveFlashBank((Fapi_FlashBankType)(flash_sector[sectornum].bankNumber));
Fapi_enableMainBankSectors(0xFFFF); /* used for API 2.01*/
while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );
Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, flash_sector[sectornum].start);
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
if(Flash_Erase_Check((uint32_t)flash_sector[sectornum].start, flash_sector[sectornum].length))
{
RetValue |= 0x82;/*flash中的值不为0xFFFFFFFF,擦除失败*/
}
else
{
;
}
return RetValue;
}
2. Link configuration is as follows:
MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000100
FLASH_API (RX) : origin=0x00010000 length=0x00010000
FLASH0 (RX) : origin=0x00020000 length=0x00040000
STACKS (RW) : origin=0x08000000 length=0x00009000
RAM_F201API (RW) : origin=0x08009000 length=0x00003000
RAM (RW) : origin=0x0800C000 length=0x00033F00
USERDEFINE (RW) : origin=0x0803FF00 length=0x00000100 //GET_COREREG_ADDR用户自定义使用的内存段
}
SECTIONS
{
.intvecs : {} > VECTORS
flashAPI :
{
Fapi_UserDefinedFunctions.obj (.text)
bl_flash.obj (.text)
--library= ..\lib\F021_API_CortexR4_BE.lib (.text)
} load = FLASH_API, run = RAM_F201API, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)
.text : {} > FLASH0
.const : {} > FLASH0
.cinit : {} > FLASH0
.pinit : {} > FLASH0
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM
}
3. The function _copyAPI2RAM_() is also called in void _c_int00(void)。
4. When erasing bank0 sector, the following error message is displayed