MCAL Data Mapping fails

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

MCAL Data Mapping fails

跳至解决方案
2,126 次查看
liyongfeng
Contributor III

#define MCU_START_SEC_VAR_INIT_UNSPECIFIED

#include "Mcu_MemMap.h"

Mcu_StatusType Mcu_eStatus = MCU_UNINIT;

#define MCU_STOP_SEC_VAR_INIT_UNSPECIFIED

#include "Mcu_MemMap.h"

After bulid, the data fails to map to the .macl_data section:

.mcal_data.Mcu_eStatus
0x204201dd 0x1 load address 0x0040eb0d

Mapping to the .macl_data section is only achievable when __attribute__((section(".mcal_data"))) is used.

The content of the ld file is as follows:

.sram_data : AT(__sram_data_rom)

{

. = ALIGN(4);

__sram_data_begin__ = .;

. = ALIGN(4);

*(.ramcode)

. = ALIGN(4);

*(.data)

*(.data*)

. = ALIGN(4);

*(.mcal_data)

. = ALIGN(4);

__sram_data_end__ = .;

} > int_sram_c0

I can map correctly using *(.mcal_data*); is this method suitable?

 

0 项奖励
回复
1 解答
1,796 次查看
liyongfeng
Contributor III

Understood. The (-fdata-sections) option is enabled by default when a new project is created in D32DS. Alternatively, this may be attributed to my lack of knowledge regarding compiler commands.

在原帖中查看解决方案

0 项奖励
回复
5 回复数
1,797 次查看
liyongfeng
Contributor III

Understood. The (-fdata-sections) option is enabled by default when a new project is created in D32DS. Alternatively, this may be attributed to my lack of knowledge regarding compiler commands.

0 项奖励
回复
1,850 次查看
liyongfeng
Contributor III

liyongfeng_0-1767580146080.pngCould you help me figure out where the problem is?

RTD : SW32K3_S32M27x_RTD_R21-11_6.0.0_QLP04

0 项奖励
回复
1,827 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Could you try following?

Add this to main.c or any other c file:

 

#define MCU_START_SEC_VAR_INIT_UNSPECIFIED

 

#include "Mcu_MemMap.h"

 

Mcu_StatusType Mcu_eStatus = MCU_UNINIT;

 

#define MCU_STOP_SEC_VAR_INIT_UNSPECIFIED

 

#include "Mcu_MemMap.h"

 

Then do a right click in this *.c file and select "Preprocess Selected File(s)".

 

You should get something like this for the definition above:

 

 

#define MCU_START_SEC_VAR_INIT_UNSPECIFIED

 

# 1 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h" 1

# 57 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#define MCU_MEMMAP_VENDOR_ID 43

#define MCU_MEMMAP_AR_RELEASE_MAJOR_VERSION 4

#define MCU_MEMMAP_AR_RELEASE_MINOR_VERSION 7

#define MCU_MEMMAP_AR_RELEASE_REVISION_VERSION 0

#define MCU_MEMMAP_SW_MAJOR_VERSION 6

#define MCU_MEMMAP_SW_MINOR_VERSION 0

#define MCU_MEMMAP_SW_PATCH_VERSION 0

# 81 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#define MEMMAP_ERROR

# 7329 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#undef MCU_START_SEC_VAR_INIT_UNSPECIFIED

#define ENTERED_MCU_START_SEC_VAR_INIT_UNSPECIFIED

 

#define MEMMAP_MATCH_ERROR

# 7341 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#undef MEMMAP_ERROR

#pragma GCC section data ".mcal_data"

#pragma GCC section bss ".mcal_bss"

# 42 "..\\src\\main.c" 2

 

Mcu_StatusType Mcu_eStatus = MCU_UNINIT;

 

#define MCU_STOP_SEC_VAR_INIT_UNSPECIFIED

 

# 1 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h" 1

# 57 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#define MCU_MEMMAP_VENDOR_ID 43

#define MCU_MEMMAP_AR_RELEASE_MAJOR_VERSION 4

#define MCU_MEMMAP_AR_RELEASE_MINOR_VERSION 7

#define MCU_MEMMAP_AR_RELEASE_REVISION_VERSION 0

#define MCU_MEMMAP_SW_MAJOR_VERSION 6

#define MCU_MEMMAP_SW_MINOR_VERSION 0

#define MCU_MEMMAP_SW_PATCH_VERSION 0

# 81 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#define MEMMAP_ERROR

# 7351 "c:\\nxp\\s32ds.3.6.2\\s32ds\\software\\platformsdk_s32k3\\rtd\\basenxp_ts_t40d34m60i0r0\\include\\mcu_memmap.h"

#undef ENTERED_MCU_START_SEC_VAR_INIT_UNSPECIFIED

 

 

 

 

#undef MEMMAP_MATCH_ERROR

 

#undef MCU_STOP_SEC_VAR_INIT_UNSPECIFIED

 

 

Please send me this output.

 

 

0 项奖励
回复
1,799 次查看
liyongfeng
Contributor III

Hi @lukaszadrapa ,

This is the information generated by using the variable Test_Mcu_eStatus in my main.c file.

0 项奖励
回复
1,984 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @liyongfeng 

Which RTD is used? I can't see such issue on my side, MCU_START_SEC_VAR_INIT_UNSPECIFIED is working for me. Did you get any warnings when building the project?

Regards,

Lukas

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2267626%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMCAL%20%E6%95%B0%E6%8D%AE%E6%98%A0%E5%B0%84%E5%A4%B1%E8%B4%A5%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2267626%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%23define%20MCU_START_SEC_VAR_INIT_UNSPECIFIED%3C%2FP%3E%3CP%3E%23include%22Mcu_MemMap.h%22%3C%2FP%3E%3CP%3EMcu_StatusType%20Mcu_eStatus%20%3D%20MCU_UNINIT%EF%BC%9B%3C%2FP%3E%3CP%3E%23define%20MCU_STOP_SEC_VAR_INIT_UNSPECIFIED%3C%2FP%3E%3CP%3E%23include%22Mcu_MemMap.h%22%3C%2FP%3E%3CP%3E%3CSPAN%3E%E5%9C%A8%20bulid%20%E4%B9%8B%E5%90%8E%EF%BC%8C%E6%95%B0%E6%8D%AE%E6%97%A0%E6%B3%95%E6%98%A0%E5%B0%84%E5%88%B0%20%3C%2FSPAN%3E.macl_data%3CSPAN%3E%20%E9%83%A8%E5%88%86%EF%BC%9A%3C%2FSPAN%3E%E5%9C%A8%20bulid%20%E4%B9%8B%E5%90%8E%EF%BC%8C%E6%95%B0%E6%8D%AE%E6%97%A0%E6%B3%95%E6%98%A0%E5%B0%84%E5%88%B0%20.macl_data%20%E9%83%A8%E5%88%86%3C%2FP%3E%3CP%3E.mcal_data.Mcu_eStatus%3CBR%20%2F%3E0x204201dd%200x1%20%E5%8A%A0%E8%BD%BD%E5%9C%B0%E5%9D%80%200x0040eb0d%3C%2FP%3E%3CP%3E%3CSPAN%3E%20%E5%8F%AA%E6%9C%89%E5%9C%A8%20%3C%2FSPAN%3E%3CSPAN%3E%20%E4%BD%BF%E7%94%A8%3C%2FSPAN%3E__attribute__((section(%22.mcal_data%22)))%20%E6%97%B6%EF%BC%8C%3CSPAN%3E%20%E6%89%8D%E8%83%BD%20%3C%2FSPAN%3E%E6%98%A0%E5%B0%84%E5%88%B0%20.macl_data%20%E9%83%A8%E5%88%86%20%E3%80%82%3C%2FP%3E%3CP%3E%3CSTRONG%3Eld%E6%96%87%E4%BB%B6%E7%9A%84%E5%86%85%E5%AE%B9%E5%A6%82%E4%B8%8B%EF%BC%9A%3C%2FSTRONG%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E.sram_data%20%EF%BC%9A%3CSPAN%3EAT%3C%2FSPAN%3E(__sram_data_rom)%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E.%20%3D%3CSPAN%3EALIGN%3C%2FSPAN%3E%EF%BC%884%EF%BC%89%EF%BC%9B%3C%2FP%3E%3CP%3E__sram_data_begin__%20%3D%20%EF%BC%9B%3C%2FP%3E%3CP%3E.%20%3D%3CSPAN%3EALIGN%3C%2FSPAN%3E%EF%BC%884%EF%BC%89%EF%BC%9B%3C%2FP%3E%3CP%3E*(.ramcode)%3C%2FP%3E%3CP%3E.%20%3D%3CSPAN%3EALIGN%3C%2FSPAN%3E%EF%BC%884%EF%BC%89%EF%BC%9B%3C%2FP%3E%3CP%3E*(.data)%3C%2FP%3E%3CP%3E*(.data*)%3C%2FP%3E%3CP%3E.%20%3D%3CSPAN%3EALIGN%3C%2FSPAN%3E%EF%BC%884%EF%BC%89%EF%BC%9B%3C%2FP%3E%3CP%3E*(.mcal_data)%3C%2FP%3E%3CP%3E.%20%3D%3CSPAN%3EALIGN%3C%2FSPAN%3E%EF%BC%884%EF%BC%89%EF%BC%9B%3C%2FP%3E%3CP%3E__sram_data_end__%20%3D%20%EF%BC%9B%3C%2FP%3E%3CP%3E%7D%26gt%3B%20int_sram_c0%3C%2FP%3E%3CP%3E%3CSPAN%3E%E6%88%91%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%20%3C%2FSPAN%3E*(.mcal_data*)%3CSPAN%3E%E6%AD%A3%E7%A1%AE%E6%98%A0%E5%B0%84%20%3C%2FSPAN%3E%EF%BC%9B%E8%BF%99%E7%A7%8D%E6%96%B9%E6%B3%95%E5%90%88%E9%80%82%E5%90%97%EF%BC%9F%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2270547%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCAL%20Data%20Mapping%20fails%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2270547%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184101%22%20target%3D%22_blank%22%3E%40%E6%A2%81%E5%8B%87%E5%B3%B0%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%E4%BD%BF%E7%94%A8%E7%9A%84%E6%98%AF%E5%93%AA%E7%A7%8D%E7%83%AD%E7%94%B5%E9%98%BB%EF%BC%9F%E5%9C%A8%E6%88%91%E8%BF%99%E9%87%8C%E7%9C%8B%E4%B8%8D%E5%88%B0%E8%BF%99%E6%A0%B7%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%8CMCU_START_SEC_VAR_INIT_UNSPECIFIED%20%E5%AF%B9%E6%88%91%E6%9C%89%E6%95%88%E3%80%82%E5%9C%A8%E5%88%9B%E5%BB%BA%E9%A1%B9%E7%9B%AE%E6%97%B6%EF%BC%8C%E6%82%A8%E6%94%B6%E5%88%B0%E8%BF%87%E4%BB%BB%E4%BD%95%E8%AD%A6%E5%91%8A%E5%90%97%EF%BC%9F%3C%2FP%3E%0A%3CP%3E%E6%AD%A4%E8%87%B4%EF%BC%8C%3C%2FP%3E%0A%3CP%3ELukas%3C%2FP%3E%3C%2FLINGO-BODY%3E