Description Resource Path Location Type Ld error: section .stack VMA [20002c00,20002fff] overlaps section .heap VMA Meter_AS_MCU C/C++ Problem
"c:/nxp/s32ds_arm_v2.2/s32ds/build_tools/gcc_v6.3/gcc-6.3-arm32-eabi/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/real-ld.exe: section .stack VMA [20002d00,20002fff] overlaps section .heap VMA [20002a58,20002d57]"
這問題描述主要說的是./stack跟heap去重疊到
導致編譯錯誤
解法如下 :
開啟S32 Design Studio 開啟專案的Project Settings->Linker files
點選S32K1xx_32_ram.ld
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000400;
並在以下資料夾入前綴 : __attribute__ ((section(".data"))) 如下 :
__attribute__ ((section(".data")))m_interrupts (RX) : ORIGIN = 0x1FFFC000, LENGTH = 0x00000400
__attribute__ ((section(".data")))m_text (RX) : ORIGIN = 0x1FFFC400, LENGTH = 0x00003C00
/* SRAM_U */
__attribute__ ((section(".data")))m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x00003000
接著在S32K1xx_32_flash.ld
動態調整heap size跟stack size 如下 :
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000300;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000300;
即可解決
另一種暴力的方式如下 :
#define VAR_PUT_IN_DATA_SECTION __attribute__((section(".data")))
沒有留言:
張貼留言