C40 hard fault when attempting to erase application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C40 hard fault when attempting to erase application

Jump to solution
143 Views
vmhb
Contributor III

I want to be able to reprogram my board using XCP. As a result I have a boot image that uses the first 1MB of PFLASH and and application that starts 1MB up, so address 0x00500000 or FLASH sector 128.

I can switch back and forth between the images and send the flash data when running the boot image. However if I try to erase block 128 I get a hard fault.

I have been following this thread

Solved: S32K344 C40 IP Hardware Fault Problem - NXP Community

Which talks about running the erase and write C40 routines in RAM. I do not understand why I would need to do this as the boot image and associated C40 routines all live well within the first 128 flash blocks.

However I have attempted to modify C40_Ip.h as suggested in the thread as in the example below

#if ( 1 == C40_RAM_CODE_ENABLE )
/* ram code start */
#define FLS_STOP_SEC_CODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_RAMCODE
#include "Fls_MemMap.h"
#endif

C40_Ip_StatusType C40_Ip_MainInterfaceSectorEraseStatus(void);

#if ( 1 == C40_RAM_CODE_ENABLE )
/* ram code end */
#define FLS_STOP_SEC_RAMCODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_CODE
#include "Fls_MemMap.h"
#endif

However this does not compile 

C:/NXP/S32DS.3.5/S32DS/software/PlatformSDK_S32K3/RTD/BaseNXP_TS_T40D34M30I0R0/include/Fls_MemMap.h:6865:10: error: #error "MemMap.h, no valid matching start-stop section defined."
6865 | #error "MemMap.h, no valid matching start-stop section defined."
| ^~~~~

I would like to understand why I would need to do this and if I do what I need to do to make the compilation work?

 

 

 

 

  

0 Kudos
Reply
1 Solution
110 Views
vmhb
Contributor III

As the data flash takes up the first 16 blocks the start block for an application running at 0x00500000 should be 144 and not 128 as had calculated. I can erase block 144 onwards.

View solution in original post

0 Kudos
Reply
1 Reply
111 Views
vmhb
Contributor III

As the data flash takes up the first 16 blocks the start block for an application running at 0x00500000 should be 144 and not 128 as had calculated. I can erase block 144 onwards.

0 Kudos
Reply