ramcode section not used when optimization level < O2

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

ramcode section not used when optimization level < O2

Jump to solution
1,498 Views
Novalis
Contributor III

Hello,
I am using S32DS 3.5 update 10 + RTD 3 for S32K312 and trying to put some code to .ramcode section so that it runs from RAM.

ie. for some functions in C40_ip.h I have changed

C40_Ip_StatusType C40_Ip_MainInterfaceSectorEraseStatus(void);

to

C40_Ip_StatusType C40_Ip_MainInterfaceSectorEraseStatus(void) __attribute__((section (".ramcode")));

But when I select Optimize level O0 or O1, the code is not put into .ramcode section

With O2 and more, it is put into .ramcode but I cannot debug where it is causing HardFault

Can anybody help with this? Or give me another solution to make the code run from RAM (to be able to erase sectors and write to flash)?

Thanks,
Martin

 

0 Kudos
Reply
1 Solution
1,478 Views
Novalis
Contributor III

I have found that I have to change

#define MEM_43_INFLS_START_SEC_CODE
#include "Mem_43_InFls_MemMap.h"

to

#define MEM_43_INFLS_START_SEC_RAMCODE
#include "Mem_43_InFls_MemMap.h"

 

and also

#define MEM_43_INFLS_STOP_SEC_CODE
#include "Mem_43_InFls_MemMap.h"

to

#define MEM_43_INFLS_STOP_SEC_RAMCODE
#include "Mem_43_InFls_MemMap.h"

in the end of the file c40_ip.h

do not forget to also add C40_Ip_MainInterfaceHVJobStatus to the header file like in the linked post below.

and then functions get into .ramcode even if no optimization is selected

like in this post  https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/td-p/1697432

View solution in original post

0 Kudos
Reply
1 Reply
1,479 Views
Novalis
Contributor III

I have found that I have to change

#define MEM_43_INFLS_START_SEC_CODE
#include "Mem_43_InFls_MemMap.h"

to

#define MEM_43_INFLS_START_SEC_RAMCODE
#include "Mem_43_InFls_MemMap.h"

 

and also

#define MEM_43_INFLS_STOP_SEC_CODE
#include "Mem_43_InFls_MemMap.h"

to

#define MEM_43_INFLS_STOP_SEC_RAMCODE
#include "Mem_43_InFls_MemMap.h"

in the end of the file c40_ip.h

do not forget to also add C40_Ip_MainInterfaceHVJobStatus to the header file like in the linked post below.

and then functions get into .ramcode even if no optimization is selected

like in this post  https://community.nxp.com/t5/S32K/S32K344-C40-IP-Hardware-Fault-Problem/td-p/1697432

0 Kudos
Reply