This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS0914: F021 flashAPI causes prefetch entry

Part Number: TMS570LS0914

Hello,

i want to use the flashAPI F021 and i am using safeRTOS operation system.

I already added the flashAPI in the linker script and configure two data sections:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
flashAPI : RUN_START( FLASHAPI_Start ) RUN_END( FLASHAPI_End )
{
*/library/extern/FlashAPI/Fapi_UserDefinedFunctions.c.obj (.text)
*/library/source/Hardware/flashIf/flashTMS.c.obj (.text)
--library = */library/extern/FlashAPI/F021_API_CortexR4_BE.lib (.text)
}load = FAPIFLASH, run = FAPIRAM, palign(0x1000), table(BINIT)
MEM_DATA_SEC_0 : START( MEM_DATA_SEC_0_Start ) END( MEM_DATA_SEC_0_End )
{
--library = */library/extern/FlashAPI/F021_API_CortexR4_BE.lib <
FlashStateMachine.ScaleFclk.obj
FlashStateMachine.SetActiveBank.obj > (.data)
} > RAM palign( 0x2000 )
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The task in which I want to use the flashAPI runs in user mode.

Both memsections were configured as mpu sections according to Cortex-R4F techincal reference manual on page 125 and 126 (ARM DDI 0363G, ID041111; p.125-126/436).

MEM_DATA_SEC_0: AP bit value b011, XN bit value 1, TEX[2:0] value 0b000, C bit value 0 and B bit value 0

flashAPI : AP bit value b011, XN bit value 0, TEX[2:0] value 0b000, C bit value 0 and B bit value 0

 

If i try to debug the sw, the first instruction executed in the ram section caused a prefetch entry. The value of the fault status register is 0x0D. This value is an permission fault.

Function that causes the permission fault:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Fapi_StatusType Fapi_BlockErase(uint32_t Bank, uint32_t Erase_Start_Address, uint32_t Size_In_Bytes)
{
Fapi_StatusType error = Fapi_Status_Success;
uint8_t ucStartBank = 0;
uint8_t ucStartSector = 0;
uint8_t ucEndBank = 0;
uint32_t* eraseStartAddr0 = (uint32_t*)Erase_Start_Address;
uint32_t* eraseStartAddr = (uint32_t*)Erase_Start_Address;
uint32_t Erase_End_Address = Erase_Start_Address + Size_In_Bytes;
//Bestimme Startadresse des Sektors, welcher geloescht werden soll.
for(uint8_t i = 0; i < SECTOR_TABLE_SIZE; i++) // for (i = 0; i < NUMBEROFSECTORS - 1; i++) 23.02.2018 mkh
{
if(Erase_Start_Address == (uint32_t)(SectorTable[i].dwStartAddr))
{
ucStartBank = SectorTable[i].bankNumber;
ucStartSector = SectorTable[i].sectorNumber;
eraseStartAddr0 = SectorTable[i].dwStartAddr;
eraseStartAddr = SectorTable[i].dwStartAddr;
break;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Disassembly from the instruction that causes the permission fault:

As you can see the instruction that caused the permission fault pushes registers onto the stack. 

Register content:

The stack pointer is within the permissible range.

Task stack memory range from the map file:
address     length
08003000 00001000 safetyTask.c.obj (.bss:safetybuffer_1)

Any ideas on how to solve this problem please?

Kind regards

Aron