STM32f207ZG NUCLEO 板,ld.exe:.RxDescriptSection VMA [2000e000,2000e09f] 部分与 .bss VMA [20000118,200143

Posted

技术标签:

【中文标题】STM32f207ZG NUCLEO 板,ld.exe:.RxDescriptSection VMA [2000e000,2000e09f] 部分与 .bss VMA [20000118,2001431b] 部分重叠【英文标题】:STM32f207ZG NUCLEO board, ld.exe: section .RxDescripSection VMA [2000e000,2000e09f] overlaps section .bss VMA [20000118,2001431b] 【发布时间】:2018-03-07 20:42:43 【问题描述】:

我正在开发一个基于 NUCLEO-F207ZG 板和 stm32f207ZGT 的继承项目,作为 IDE,我使用 SW4STM32(Eclipse, AC6)。

这个项目在其他电脑上编译正常,但由于距离原因我不能用它来比较配置。

导入没有错误后,我尝试编译它得到控制台输出:

编译目标:STM32F207ZG_NUCLEO_144.elf

调用:MCU GCC 链接器

arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -specs=nosys.specs -specs=nano.specs -T"../STM32F207ZGTx_FLASH.ld" -Wl,- map=output.map -Wl,--gc-sections -o "STM32F207ZG_NUCLEO_144.elf" @"objects.list" -lm

c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3 .1/../../../../arm-none-eabi/bin/ld.exe:.RxDescriptSection VMA [2000e000,2000e09f] 部分与 .bss VMA [20000118,2001431b] 部分重叠

collect2.exe:错误:ld 返回 1 个退出状态

make: *** [STM32F207ZG_NUCLEO_144.elf] 错误1

makefile:45:目标“STM32F207ZG_NUCLEO_144.elf”的配方失败

15:59:47 构建完成(耗时 23s.436ms)

在互联网上搜索后,这似乎是由链接器引起的:

/*
*****************************************************************************
**

**  File        : LinkerScript.ld
**
**  Abstract    : Linker script for STM32F207ZGTx Device with
**                1024KByte FLASH, 128KByte RAM
**
**                Set heap size, stack size and stack location according
**                to application requirements.
**
**                Set memory bank area and size if external memory is used.
**
**  Target      : STMicroelectronics STM32
**
**
**  Distribution: The file is distributed as is, without any warranty
**                of any kind.
**
**  (c)Copyright Ac6.
**  You may use this file as-is or modify it according to the needs of your
**  project. Distribution of this file (unmodified or modified) is not
**  permitted. Ac6 permit registered System Workbench for MCU users the
**  rights to distribute the assembled, compiled & linked contents of this
**  file as part of an application binary file, provided that it is built
**  using the System Workbench for MCU toolchain.
**
*****************************************************************************
*/

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x20020000;    /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x200;      /* required amount of heap  */
_Min_Stack_Size = 0x400; /* required amount of stack */

/* Specify the memory areas */
MEMORY

FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 1024K
RAM (xrw)        : ORIGIN = 0x20000000, LENGTH = 128K


/* Define output sections */
SECTIONS

  /* The startup code goes first into FLASH */
  .isr_vector :
  
    . = ALIGN(4);
    KEEP(*(.isr_vector)) /* Startup code */
    . = ALIGN(4);
   >FLASH

  /* The program code and other data goes into FLASH */
  .text :
  
    . = ALIGN(4);
    *(.text)           /* .text sections (code) */
    *(.text*)          /* .text* sections (code) */
    *(.glue_7)         /* glue arm to thumb code */
    *(.glue_7t)        /* glue thumb to arm code */
    *(.eh_frame)

    KEEP (*(.init))
    KEEP (*(.fini))

    . = ALIGN(4);
    _etext = .;        /* define a global symbols at end of code */
   >FLASH

  /* Constant data goes into FLASH */
  .rodata :
  
    . = ALIGN(4);
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
    . = ALIGN(4);
   >FLASH

  .ARM.extab   :  *(.ARM.extab* .gnu.linkonce.armextab.*)  >FLASH
  .ARM : 
    __exidx_start = .;
    *(.ARM.exidx*)
    __exidx_end = .;
   >FLASH

  .preinit_array     :
  
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array*))
    PROVIDE_HIDDEN (__preinit_array_end = .);
   >FLASH
  .init_array :
  
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT(.init_array.*)))
    KEEP (*(.init_array*))
    PROVIDE_HIDDEN (__init_array_end = .);
   >FLASH
  .fini_array :
  
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT(.fini_array.*)))
    KEEP (*(.fini_array*))
    PROVIDE_HIDDEN (__fini_array_end = .);
   >FLASH

  
  
  /* used by the startup to initialize data */
  _sidata = LOADADDR(.data);

  /* Initialized data sections goes into RAM, load LMA copy after code */
  .data : 
  
    . = ALIGN(4);
    _sdata = .;        /* create a global symbol at data start */
    *(.data)           /* .data sections */
    *(.data*)          /* .data* sections */

    . = ALIGN(4);
    _edata = .;        /* define a global symbol at data end */
   >RAM AT> FLASH

  
  /* Uninitialized data section */
  . = ALIGN(4);
  .bss :
  
    /* This is used by the startup in order to initialize the .bss secion */
    _sbss = .;         /* define a global symbol at bss start */
    __bss_start__ = _sbss;
    *(.bss)
    *(.bss*)
    *(COMMON)

    . = ALIGN(4);
    _ebss = .;         /* define a global symbol at bss end */
    __bss_end__ = _ebss;
   >RAM

  /* User_heap_stack section, used to check that there is enough RAM left */
  ._user_heap_stack :
  
    . = ALIGN(8);
    PROVIDE ( end = . );
    PROVIDE ( _end = . );
    . = . + _Min_Heap_Size;
    . = . + _Min_Stack_Size;
    . = ALIGN(8);
   >RAM

  

  /* Remove information from the standard libraries */
  /DISCARD/ :
  
    libc.a ( * )
    libm.a ( * )
    libgcc.a ( * )
  

  .ARM.attributes 0 :  *(.ARM.attributes) 
  .RxDescripSection     0x2000E000 (NOLOAD) :  *(.RxDescripSection)      >RAM
  .TxDescripSection     0x2000E100 (NOLOAD) :  *(.TxDescripSection)      >RAM
  .RxBUF                0x2000E200 (NOLOAD) :  *(.RxBUF)                 >RAM
  .TxBUF                0x2000FFC4 (NOLOAD) :  *(.TxBUF)                 >RAM

生成文件:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include Middlewares/LwIP/system/OS/subdir.mk
-include Middlewares/LwIP/Netif/subdir.mk
-include Middlewares/LwIP/Core/IPv4/subdir.mk
-include Middlewares/LwIP/Core/subdir.mk
-include Middlewares/LwIP/Api/subdir.mk
-include Middlewares/FreeRTOS/portable/ARM_CM3/subdir.mk
-include Middlewares/FreeRTOS/portable/subdir.mk
-include Middlewares/FreeRTOS/subdir.mk
-include Drivers/STM32F2xx_HAL_Driver/subdir.mk
-include Drivers/BSP/STM32F2xx_Nucleo_144/subdir.mk
-include Application/User/Src/MQTTPacket/subdir.mk
-include Application/User/Src/MQTTClient/subdir.mk
-include Application/User/Src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: STM32F207ZG_NUCLEO_144.elf

# Tool invocations
STM32F207ZG_NUCLEO_144.elf: $(OBJS) $(USER_OBJS) ../STM32F207ZGTx_FLASH.ld
    @echo 'Building target: $@'
    @echo 'Invoking: MCU GCC Linker'
    arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -specs=nosys.specs -specs=nano.specs -T"../STM32F207ZGTx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -o "STM32F207ZG_NUCLEO_144.elf" @"objects.list" $(USER_OBJS) $(LIBS) -lm
    @echo 'Finished building target: $@'
    @echo ' '
    $(MAKE) --no-print-directory post-build

# Other Targets
clean:
    -$(RM) *
    -@echo ' '

post-build:
    -@echo 'Generating binary and Printing size information:'
    arm-none-eabi-objcopy -O binary "STM32F207ZG_NUCLEO_144.elf" "STM32F207ZG_NUCLEO_144.bin"
    arm-none-eabi-size "STM32F207ZG_NUCLEO_144.elf"
    -@echo ' '

.PHONY: all clean dependents
.SECONDARY: post-build

-include ../makefile.targets

我没有想法,我尝试过手动修改链接器和生成文件,但效果最差。

感谢您的帮助!!

编辑:

如果我删除(注释)链接器的最后几行,那么它可以工作,但我不应该这样做,因为它是一个自动生成的文件。

链接器中的修改:

 /* 
  .RxDescripSection     0x2000E000 (NOLOAD) :  *(.RxDescripSection)      >RAM
  .TxDescripSection     0x2000E100 (NOLOAD) :  *(.TxDescripSection)      >RAM
  .RxBUF                0x2000E200 (NOLOAD) :  *(.RxBUF)                 >RAM
  .TxBUF                0x2000FFC4 (NOLOAD) :  *(.TxBUF)                 >RAM 
  */

编辑 2:

我在第一次 EDIT 中评论的这行代码来自 ethernetif.c,而且我肯定需要主题。

#if defined ( __ICCARM__ ) /*!< IAR Compiler */

#pragma location=0x2000E000
__no_init ETH_DMADescTypeDef  DMARxDscrTab[ETH_RXBUFNB];/* Ethernet Rx MA Descriptor */
#pragma location=0x2000E100
__no_init ETH_DMADescTypeDef  DMATxDscrTab[ETH_TXBUFNB];/* Ethernet Tx DMA Descriptor */
#elif defined ( __CC_ARM   )
ETH_DMADescTypeDef  DMARxDscrTab[ETH_RXBUFNB] __attribute__((at(0x2000E000)));/* Ethernet Rx MA Descriptor */
ETH_DMADescTypeDef  DMATxDscrTab[ETH_TXBUFNB] __attribute__((at(0x2000E100)));/* Ethernet Tx DMA Descriptor */
#elif defined ( __GNUC__   )
ETH_DMADescTypeDef  DMARxDscrTab[ETH_RXBUFNB] __attribute__((section(".RxDescripSection")));/* Ethernet Rx MA Descriptor */
ETH_DMADescTypeDef  DMATxDscrTab[ETH_TXBUFNB] __attribute__((section(".TxDescripSection")));/* Ethernet Tx DMA Descriptor */
#endif
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
#pragma location=0x2000E200
__no_init uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE]; /* Ethernet Receive Buffer */
#pragma location=0x2000FFC4
__no_init uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE]; /* Ethernet Transmit Buffer */
#elif defined ( __CC_ARM   )
uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __attribute__((at(0x2000E200)));  /* Ethernet Receive Buffer */
uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE]  __attribute__((at(0x2000FFC4))); /* Ethernet Transmit Buffer */
#elif defined ( __GNUC__   )
uint8_t Rx_Buff[ETH_RXBUFNB][ETH_RX_BUF_SIZE] __attribute__((section(".RxBUF")));/* Ethernet Receive Buffer */
uint8_t Tx_Buff[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __attribute__((section(".TxBUF")));/* Ethernet Transmit Buffer */
#endif

【问题讨论】:

只是错误的墨迹脚本/这些附加部分有什么特殊原因吗?我没有看到。 我正在使用以太网、LWIP、IBM Bluemix 和 MQTT 开发一个项目,但这是我的第一次接触,所以我怀疑其中一些 IP 正在将这些行添加到链接器脚本中 虽然我自己从未为 Cortex 编写过链接器文件,但上面的文件似乎自相矛盾。 RAM的最后一个范围是_user_heap_stack,似乎这个文件假设_Min_Stack_Size之后的所有东西也被用作堆栈——直到_estack,这似乎是堆栈指针的初始值。额外的缓冲区和描述符根本不关心分配方案,它们将自己放置在 RAM 的中间。也许将 _estack 放在 _user_heap_stack 之后并使用 _estack = .; 并将有问题的部分移至 0x2001E000 会有所帮助。 或者输入_estack = 0x2001E00;,以防您的最低堆栈要求错误。 我将 _estack 更改为 0x2001E000 并且我不断收到相同的错误:描述资源路径位置类型部分 .RxDescriptSection VMA [2000e000,2000e09f] 重叠部分 .bss VMA [20000118,2001431b] HIPRA_ETHERNET C/C++ 问题 【参考方案1】:

我不知道为什么,但是现在我有了要测试的硬件,该项目在没有我在 EDIT

中评论的行的情况下工作

编辑: 问题出在 cubemx 为 LWIP 生成的代码中。

【讨论】:

以上是关于STM32f207ZG NUCLEO 板,ld.exe:.RxDescriptSection VMA [2000e000,2000e09f] 部分与 .bss VMA [20000118,200143的主要内容,如果未能解决你的问题,请参考以下文章

STM32F767 Nucleo 板 printf 到控制台

STM32F767ZI nucleo板没有连接USB

NUCLEO-L496ZG+Gokit3S+Rtthead+AT组件组网

闪存扇区擦除 - STM32F207

NUCLEO STM32F334R8 上的 STMCubeIDE,新项目:FreeRTOS 硬故障

STM32F412应用开发笔记之四:与远红外炭氢传感器通讯