ramcode section not used when optimization level < O2

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ramcode section not used when optimization level < O2

跳至解决方案
1,667 次查看
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 项奖励
回复
1 解答
1,647 次查看
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 项奖励
回复
1 回复
1,648 次查看
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 项奖励
回复