MCAL Data Mapping fails

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

MCAL Data Mapping fails

Jump to solution
2,224 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,894 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,895 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,948 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,925 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,897 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
2,082 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