I am trying to develop a boot loader for the TMS570LS1115.
I can erase and program successfully all sectors of Flash memory (sectors 1-13) with the exception of Erasing Sector 10 @ 0x00080000.
I am running all of the Flash Functions from RAM.
Sector 10 is blank, ie contains no code or tables.
I have disabled the Memory Protection Unit (MPU).
I am calling the functions from Privilege mode.
I have disabled Interrupts.
I am filling unused FLASH areas with the fill directive for ECC fill=0xFFFFFFFF
see .cmd file below
/*----------------------------------------------------------------------------*/
/* Linker Settings */
--retain="*(.intvecs)"
/*----------------------------------------------------------------------------*/
MEMORY
{
VECTORS (RX) : origin=0x00000000 length=0x00000020 fill=0xFFFFFFFF // sect0 32 bytes length
FLASH_UNUSED0 (RX) : origin=0x00000020 length=0x00003FE0 fill=0xFFFFFFFF // sect0
FLASH_BOOT0 (RX) : origin=0x00004000 length=0x0000C000 fill=0xFFFFFFFF // sect1,2,3 16k,16k,16k length = 0xC000
FLASH_BOOT1 (RX) : origin=0x00010000 length=0x0000C000 fill=0xFFFFFFFF // sect4,5,6 16K,16K,32K
FLASH_UNUSED1 (RX) : origin=0x0001C000 length=0x00004000 fill=0xFFFFFFFF
FLASH0 (RX) : origin=0x00040000 length=0x00060000 fill=0xFFFFFFFF
FLASH1 (RX) : origin=0x000A0000 length=0x00060000 fill=0xFFFFFFFF
STACK (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0001CB00
RAM2 (RW) : origin=0x0801e000 length=0x00002000
}
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.intvecs : {} > VECTORS
flashAPI :
{
Flash.obj (.text)
Fapi_UserDefinedFunctions.obj (.text)
--library= F021_API_CortexR4_BE_V3D16.lib < FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.SetActiveBank.obj
FlashStateMachine.InitializeFlashBanks.obj
FlashStateMachine.EnableMainSectors.obj
FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.ScaleFclk.obj
Init.obj
Utilities.CalculateEcc.obj
Utilities.WaitDelay.obj
Utilities.CalculateFletcher.obj
Read.MarginByByte.obj
Read.Common.obj
Read.FlushPipeline.obj
Read.WdService.obj
Async.WithAddress.obj
Program.obj > (.text)
} load = FLASH_BOOT0, run = RAM2, 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
FEE_TEXT_SECTION : {} > FLASH_BOOT0
FEE_CONST_SECTION : {} > FLASH_BOOT0
FEE_DATA_SECTION : {} > RAM
}
The Erase Function is getting stuck on the following code,
status = Fapi_enableMainBankSectors(0xFFFE); /* used for API 2.01*/
My erase function is below,
void Erase_Sector( uint32_t eraseStartAddr)
{
uint32_t Freq_In_MHz;
uint32_t status;
uint8_t bk = 0;
Freq_In_MHz = SYS_CLK_FREQ;
status = Fapi_initializeFlashBanks(Freq_In_MHz); /* used for API Rev2.01 */
status = Fapi_setActiveFlashBank((Fapi_FlashBankType)bk);
status = Fapi_enableMainBankSectors(0xFFFE); /* used for API 2.01*/
while( FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady );
status = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, eraseStartAddr);
while( FAPI_CHECK_FSM_READY_BUSY == Fapi_Status_FsmBusy );
while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);
}
What am I doing wrong? This function works for every other sector with the exception of sector 10.
Any help much appreciated, been stuck on this for way to long.
Regards
Robert