S32K344 C40 IP Hardware Fault Problem

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

S32K344 C40 IP Hardware Fault Problem

跳至解决方案
5,333 次查看
mesutkilicmak
Contributor II

Hi All,

I am trying to create custom bootloader app. I reserved 256KB space both bootloader app and parameters from the beginnig of the flash. I need to store boot parameters on the same block with the bootloader code. I tried to use C40 ip but, I am always getting HardFault error. As I learned from "AN13388-S32K3 Memories Guide" I can not write or erase same block while reading(code executing).

I tried some technics like ramcode and ITCM but, I could not be successful.

I do not want to use Data flash. Because HSE firmware uses all of it. 

What is the proper way to do that? Is there any example?

标记 (2)
0 项奖励
1 解答
5,316 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @mesutkilicmak,

The below API functions have to be placed into SRAM (".ramcode" section), as show below.

  • C40_Ip_MainInterfaceSectorErase
  • C40_Ip_MainInterfaceSectorEraseStatus
  • C40_Ip_MainInterfaceWrite
  • C40_Ip_MainInterfaceWriteStatus

Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block.


C40_Ip.h.

Before the declaration:

#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

After the declaration.

#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

if #define C40_RAM_CODE_ENABLE 1, the above four flash API functions are placed in the ".ramcode" section.

 

Regards,

Daniel

 

在原帖中查看解决方案

5 回复数
5,306 次查看
mesutkilicmak
Contributor II

Hi @danielmartynek 

Thank you for your answer. Your solution is worked for me.

In addition to your solution I also need to edit this function prototype too.

  • C40_Ip_MainInterfaceHVJobStatus

This function static in C40_Ip.c

I tried on C40 example. It worked fine but, does not worked my app. 

I removed the tick from "Fls Timeout Supervision Enabled" in C40_Ip. Because of the "OsIf_GetElapsed" function used.

I also need to move my functions that uses write and and erase to ramcode.

Regards,

Mesut

5,317 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @mesutkilicmak,

The below API functions have to be placed into SRAM (".ramcode" section), as show below.

  • C40_Ip_MainInterfaceSectorErase
  • C40_Ip_MainInterfaceSectorEraseStatus
  • C40_Ip_MainInterfaceWrite
  • C40_Ip_MainInterfaceWriteStatus

Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block.


C40_Ip.h.

Before the declaration:

#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

After the declaration.

#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

if #define C40_RAM_CODE_ENABLE 1, the above four flash API functions are placed in the ".ramcode" section.

 

Regards,

Daniel

 

93 次查看
Emguy
Contributor I

Please show sampel code how to place in c40 ip.h

 

0 项奖励
5,182 次查看
WangLeiDevelopment
Contributor I

I find Bootloader project(unified_bootloader_demo_V2.1.exe) use C40_IP driver alsways run to hardware Falut . Then you uart for debug ,find program stoke at erase and write status (specific is inside  C40_Ip_Compare function is C40_Ip_SynchronizeCache)

0 项奖励
5,157 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @WangLeiDevelopment,

Can you create a new thread for this issue?

 

Thanks,

BR, Daniel

0 项奖励