Hello Daniel,
Thank you for your response,
yes, I already move vector table to ram,
A) [Daniel] If the vector table as well as the routines are in RAM, there should be no problem
1) This is the code in linker file:
/*********************************************************************************/
/* ROM Area */
/*********************************************************************************/
.ROM.intc_vector ROM(.intc_vector) ALIGN(0x10) : > INT_VECTOR_TABLE_SWL
/*********************************************************************************/
/* RAM Area */
/*********************************************************************************/
.intc_vector ABS ALIGN(4) : > int_sram
/* generate symbols used in start-up code to init .intc_vector section */
RC_INTC_VECTOR_SRC = ADDR(.ROM.intc_vector);
RC_INTC_VECTOR_DEST = ADDR(.intc_vector);
RC_INTC_VECTOR_SIZE = (SIZEOF(.ROM.intc_vector)+3) /4; // Copy 4 bytes at a time
2) This is the code in startup file:
.set VTOR_REG, 0xE000ED08
/* relocate vector table to RAM */
ldr r0, =VTOR_REG
ldr r1, =VTABLE
/* ;ldr r2, =(1 << 29)
;orr r1, r2 *//* r1 = r1 | r2 */
str r1,[r0]
/****************/
/* .intc_vector */
/****************/
ldr r3, = RC_INTC_VECTOR_SIZE
ldr r2, = RC_INTC_VECTOR_SRC
ldr r4, = RC_INTC_VECTOR_DEST
CopyRamVector:
ldr r5, [r2]
str r5, [r4]
add r2, r2, #4
add r4, r4, #4
sub r3, r3, #1
cmp r3, #0
bgt CopyRamVector
B) [Daniel] don't know what drivers you are using so it is difficult to say
I am using the \Freescale\Standard Software Driver v1.0.4\C90TFS lib
Below is my code how to use the lib:
#ifdef VUC_SWL
__attribute__((section(".ramcode")))
#endif
Bool ROM_EraseBlock(UInt8 First_BlockNo, UInt8 Last_BlockNo)
{
uint32_t ret = FTFx_ERR_RANGE;
uint32_t First_addr;
uint32_t Last_addr;
uint32_t dest;
uint32_t size;
uint16_t number;
uint32_t i;
DisableAllInterrupts();
/* In S32K144, we erase Sectors */
First_addr = flashSSDConfig.PFlashBlockBase + (UInt32)First_BlockNo * FTFx_PSECTOR_SIZE;
Last_addr = flashSSDConfig.PFlashBlockBase + (UInt32)(Last_BlockNo + 1) * FTFx_PSECTOR_SIZE;
if ((First_addr < (flashSSDConfig.PFlashBlockBase + flashSSDConfig.PFlashBlockSize)) && (Last_addr < (flashSSDConfig.PFlashBlockBase + flashSSDConfig.PFlashBlockSize)))
{
dest = First_addr;
while ((dest + BYTE2WORD(FTFx_PSECTOR_SIZE)) <= Last_addr)
{
size = FTFx_PSECTOR_SIZE;
ret = FlashEraseSector(&flashSSDConfig, dest, size, g_FlashLaunchCommand);
if (FTFx_OK != ret)
{
ErrorTrap(ret);
}
/* Verify section for several sector of PFLASH */
number = FTFx_PSECTOR_SIZE / PRD1SEC_ALIGN_SIZE;
for(i = 0x0U; i < 0x2U; i++)
{
ret = FlashVerifySection(&flashSSDConfig, dest, number, i, g_FlashLaunchCommand);
if (FTFx_OK != ret)
{
ErrorTrap(ret);
}
}
dest += BYTE2WORD(size);
}
}
EnableAllInterrupts();
return (FTFx_OK == ret);
}
Actually, i do not know that whether i should move C90TFS lib to RAM or not? please advice me
C) [Daniel] But it triggers an exception so you can find out what exception it is and debug the code.
Fault handling on S32K144
In my baseline, i am using the sample to catch up all exceptions,So now i do not see any exceptions to analyze. only see system reset.