Linker fail LPC55

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

Linker fail LPC55

1,907 次查看
javiervallori
Contributor III

Hi,

I'm having throubles with the linker that seem to be a rare bug. I'm developing a product based on LPC55, so I'm starting with a very simple demo project from the sdk on wich I change the clock_config.c to a custom one. When I compile with this code:

 

 

 

void BOARD_InitBootClocks(void)
{
    //BOARD_BootClockXTAL16();
	//SystemCoreClock = 12000000;

}

 

 

 

 

I've get a low RAM comsuption result:

14,58%

Building target: LPC55S06_8k_test.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="LPC55S06_8k_test.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -Xlinker --cref -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -T LPC55S06_8k_test_Debug.ld -o "LPC55S06_8k_test.axf" ./utilities/fsl_debug_console.o ./utilities/fsl_str.o ./startup/startup_lpc55s06.o ./source/LPC55S06_Project.o ./source/semihost_hardfault.o ./drivers/fsl_clock.o ./drivers/fsl_common.o ./drivers/fsl_common_arm.o ./drivers/fsl_flexcomm.o ./drivers/fsl_gpio.o ./drivers/fsl_i2c.o ./drivers/fsl_mcan.o ./drivers/fsl_power.o ./drivers/fsl_reset.o ./drivers/fsl_usart.o ./device/system_LPC55S06.o ./component/uart/fsl_adapter_usart.o ./component/serial_manager/fsl_component_serial_manager.o ./component/serial_manager/fsl_component_serial_port_uart.o ./component/lists/fsl_component_generic_list.o ./board/board.o ./board/clock_config.o ./board/peripherals.o ./board/pin_mux.o
Memory region Used Size Region Size %age Used
PROGRAM_FLASH: 13912 B 224 KB 6.07%
SRAM0_1_2: 9552 B 64 KB 14.58%
SRAMX: 0 GB 16 KB 0.00%
SRAM3: 0 GB 16 KB 0.00%
Finished building target: LPC55S06_8k_test.axf

 But if I compile with that code:

 

 

 

void BOARD_InitBootClocks(void)
{
    //BOARD_BootClockXTAL16();
	SystemCoreClock = 12000000;

}

 

 

 

 

Suddendly jump to 114.58% RAM comsuption, and does not fit:

Building target: LPC55S06_8k_test.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="LPC55S06_8k_test.map" -Xlinker --gc-sections -Xlinker -print-memory-usage -Xlinker --sort-section=alignment -Xlinker --cref -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -T LPC55S06_8k_test_Debug.ld -o "LPC55S06_8k_test.axf" ./utilities/fsl_debug_console.o ./utilities/fsl_str.o ./startup/startup_lpc55s06.o ./source/LPC55S06_Project.o ./source/semihost_hardfault.o ./drivers/fsl_clock.o ./drivers/fsl_common.o ./drivers/fsl_common_arm.o ./drivers/fsl_flexcomm.o ./drivers/fsl_gpio.o ./drivers/fsl_i2c.o ./drivers/fsl_mcan.o ./drivers/fsl_power.o ./drivers/fsl_reset.o ./drivers/fsl_usart.o ./device/system_LPC55S06.o ./component/uart/fsl_adapter_usart.o ./component/serial_manager/fsl_component_serial_manager.o ./component/serial_manager/fsl_component_serial_port_uart.o ./component/lists/fsl_component_generic_list.o ./board/board.o ./board/clock_config.o ./board/peripherals.o ./board/pin_mux.o
c:/nxp/mcuxpressoide_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: LPC55S06_8k_test.axf section `.bss' will not fit in region `SRAM0_1_2'
c:/nxp/mcuxpressoide_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: region `SRAM0_1_2' overflowed by 9552 bytes
Memory region Used Size Region Size %age Used
PROGRAM_FLASH: 13928 B 224 KB 6.07%
SRAM0_1_2: 75088 B 64 KB 114.58%
SRAMX: 0 GB 16 KB 0.00%
SRAM3: 0 GB 16 KB 0.00%
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:40: LPC55S06_8k_test.axf] Error 1
"make -r -j4 all" terminated with exit code 2. Build might be incomplete.

 

It seem to consume excaltly 100% more than the previous.

Looking the linker file I see strange results in the the map when the compilation fails:

 

 

 

.bss            0x20010000      0x550
                0x20010000                _bss = .
                [!provide]                PROVIDE (__start_bss_RAM = .)
                [!provide]                PROVIDE (__start_bss_SRAM0_1_2 = .)

 

 

 

 

the .bss on the bss_SRAM0_1_2 starts on 0x20010000, when the definition of SRAM0_1_2 in the ld file is:

 

 

 

  SRAM0_1_2 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000 /* 64K bytes (alias RAM) */

 

 

 

 

Any suggestion? I already finish all my ideas, and unfortunetly I have no deep knowleges about linker sricpt.

I attach the project to reproduce. The project has been done with MCUxpresso 11.4.1

 

Thank you!

 

标签 (1)
标记 (3)
0 项奖励
回复
2 回复数

1,877 次查看
javiervallori
Contributor III
0 项奖励
回复

1,855 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Thanks for your sharing.

 

0 项奖励
回复