MCAL Data Mapping fails

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

MCAL Data Mapping fails

Jump to solution
2,015 Views
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 Kudos
Reply
1 Solution
1,685 Views
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.

View solution in original post

0 Kudos
Reply
5 Replies
1,686 Views
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 Kudos
Reply
1,739 Views
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 Kudos
Reply
1,716 Views
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 Kudos
Reply
1,688 Views
liyongfeng
Contributor III

Hi @lukaszadrapa ,

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

0 Kudos
Reply
1,873 Views
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 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2267626%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMCAL%20Data%20Mapping%20fails%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%20%22Mcu_MemMap.h%22%3C%2FP%3E%3CP%3EMcu_StatusType%20Mcu_eStatus%20%3D%20MCU_UNINIT%3B%3C%2FP%3E%3CP%3E%23define%20MCU_STOP_SEC_VAR_INIT_UNSPECIFIED%3C%2FP%3E%3CP%3E%23include%20%22Mcu_MemMap.h%22%3C%2FP%3E%3CP%3E%3CSPAN%3EAfter%20bulid%2C%20the%20data%20fails%20to%20map%20to%20the%26nbsp%3B%3C%2FSPAN%3E.macl_data%3CSPAN%3E%26nbsp%3Bsection%EF%BC%9A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E.mcal_data.Mcu_eStatus%3CBR%20%2F%3E0x204201dd%200x1%20load%20address%200x0040eb0d%3C%2FP%3E%3CP%3E%3CSPAN%3EMapping%20to%20the%26nbsp%3B%3C%2FSPAN%3E.macl_data%3CSPAN%3E%26nbsp%3Bsection%20is%20only%20achievable%20when%20%3C%2FSPAN%3E__attribute__((section(%22.mcal_data%22)))%3CSPAN%3E%26nbsp%3Bis%20used.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EThe%20content%20of%20the%20ld%20file%20is%20as%20follows%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E.sram_data%20%3A%20%3CSPAN%3EAT%3C%2FSPAN%3E(__sram_data_rom)%3C%2FP%3E%3CP%3E%7B%3C%2FP%3E%3CP%3E.%20%3D%20%3CSPAN%3EALIGN%3C%2FSPAN%3E(4)%3B%3C%2FP%3E%3CP%3E__sram_data_begin__%20%3D%20.%3B%3C%2FP%3E%3CP%3E.%20%3D%20%3CSPAN%3EALIGN%3C%2FSPAN%3E(4)%3B%3C%2FP%3E%3CP%3E*(.ramcode)%3C%2FP%3E%3CP%3E.%20%3D%20%3CSPAN%3EALIGN%3C%2FSPAN%3E(4)%3B%3C%2FP%3E%3CP%3E*(.data)%3C%2FP%3E%3CP%3E*(.data*)%3C%2FP%3E%3CP%3E.%20%3D%20%3CSPAN%3EALIGN%3C%2FSPAN%3E(4)%3B%3C%2FP%3E%3CP%3E*(.mcal_data)%3C%2FP%3E%3CP%3E.%20%3D%20%3CSPAN%3EALIGN%3C%2FSPAN%3E(4)%3B%3C%2FP%3E%3CP%3E__sram_data_end__%20%3D%20.%3B%3C%2FP%3E%3CP%3E%7D%20%26gt%3B%20int_sram_c0%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20can%20map%20correctly%20using%26nbsp%3B%3C%2FSPAN%3E*(.mcal_data*)%3CSPAN%3E%3B%20is%20this%20method%20suitable%3F%3C%2FSPAN%3E%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%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F184101%22%20target%3D%22_blank%22%3E%40liyongfeng%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhich%20RTD%20is%20used%3F%20I%20can't%20see%20such%20issue%20on%20my%20side%2C%26nbsp%3BMCU_START_SEC_VAR_INIT_UNSPECIFIED%20is%20working%20for%20me.%20Did%20you%20get%20any%20warnings%20when%20building%20the%20project%3F%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3ELukas%3C%2FP%3E%3C%2FLINGO-BODY%3E