tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

BOARD=ek_tm4c123gxl doesn't link: .ARM.exidx section overlap issue

Open karlp opened this issue 2 years ago • 4 comments

Operating System

Linux

Board

ek_tm4c123gxl

Firmware

Attempting to build the examples:

What happened ?

Linking fails due to an overlapping linker section. arm-none-eabi/bin/ld: section .ARM.exidx LMA [000053f8,000053ff] overlaps section .data LMA [000053f8,0000746f]

I can't see anything obviously wrong with ./hw/mcu/ti/tm4c123xx/CMSIS/5.7.0/Device/ARM/ARMCM4/Source/GCC/gcc_arm.ld but I also can't see that it's being used...

How to reproduce ?

cd examples/device/cdc_msc
make BOARD=ek_tm4c123gxl get-deps
make BOARD=ek_tm4c123gxl all V=1

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

karlp@leram:~/src/tinyusb.git/examples/device/cdc_msc (master)$ make BOARD=ek_tm4c123gxl all V=1
CFLAGS  -DTM4C123GH6PM -flto -DCFG_TUSB_MCU=OPT_MCU_TM4C123 -uvectors -DTM4C123GH6PM -Wno-error=strict-prototypes -Wno-error=cast-qual -DBOARD_EK_TM4C123GXL -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16  -MD -ggdb -fdata-sections -ffunction-sections -fsingle-precision-constant -fno-strict-aliasing -Wall -Wextra -Werror -Wfatal-errors -Wdouble-promotion -Wstrict-prototypes -Wstrict-overflow -Werror-implicit-function-declaration -Wfloat-equal -Wundef -Wshadow -Wwrite-strings -Wsign-compare -Wmissing-format-attribute -Wunreachable-code -Wcast-align -Wcast-function-type -Wcast-qual -Wnull-dereference -Wuninitialized -Wunused -Wreturn-type -Wredundant-decls  -Os -I/home/karlp/src/tinyusb.git/hw/mcu/ti/tm4c123xx//CMSIS/5.7.0/CMSIS/Include -I/home/karlp/src/tinyusb.git/hw/mcu/ti/tm4c123xx//Include/TM4C123 -I/home/karlp/src/tinyusb.git/hw/bsp/tm4c123/boards/ek_tm4c123gxl -I/home/karlp/src/tinyusb.git/hw/bsp/tm4c123 -I/home/karlp/src/tinyusb.git/src -Isrc -I/home/karlp/src/tinyusb.git/hw 

LDFLAGS -Wl,-Map=.map -Wl,-cref -Wl,-gc-sections  -Wl,--print-memory-usage

ASFLAGS 

CC dcd_musb.o
CC hcd_musb.o
CC system_TM4C123.o
CC tm4c123_startup.o
/home/karlp/src/tinyusb.git/hw/mcu/ti/tm4c123xx//Source/GCC/tm4c123_startup.c: In function 'Reset_Handler':
/home/karlp/src/tinyusb.git/hw/mcu/ti/tm4c123xx//Source/GCC/tm4c123_startup.c:327:21: warning: cast discards 'volatile' qualifier from pointer target type [-Wcast-qual]
  327 |    uint8_t *pDest = (uint8_t*)&__start_data ;
      |                     ^
/home/karlp/src/tinyusb.git/hw/mcu/ti/tm4c123xx//Source/GCC/tm4c123_startup.c:328:19: warning: cast discards 'volatile' qualifier from pointer target type [-Wcast-qual]
  328 |    uint8_t *psrc =(uint8_t*)&__la_data ;
      |                   ^
CC family.o
CC tusb.o
CC tusb_fifo.o
CC usbd.o
CC usbd_control.o
CC usbc.o
CC audio_device.o
CC cdc_device.o
CC dfu_device.o
CC dfu_rt_device.o
CC hid_device.o
CC midi_device.o
CC msc_device.o
CC ecm_rndis_device.o
CC ncm_device.o
CC usbtmc_device.o
CC video_device.o
CC vendor_device.o
CC usbh.o
CC hub.o
CC cdc_host.o
CC hid_host.o
CC msc_host.o
CC vendor_host.o
CC board.o
CC main.o
CC msc_disk.o
CC usb_descriptors.o
LINK _build/ek_tm4c123gxl/cdc_msc.elf
/home/karlp/tools/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: /home/karlp/tools/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc_nano.a(libc_a-closer.o): in function `_close_r':
closer.c:(.text._close_r+0xc): warning: _close is not implemented and will always fail
/home/karlp/tools/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: /home/karlp/tools/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc_nano.a(libc_a-lseekr.o): in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): warning: _lseek is not implemented and will always fail
/home/karlp/tools/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: section .ARM.exidx LMA [00002d14,00002d1b] overlaps section .data LMA [00002d14,00004d2f]
Memory region         Used Size  Region Size  %age Used
           FLASH:       11548 B       256 KB      4.41%
            SRAM:       13744 B        32 KB     41.94%
collect2: error: ld returned 1 exit status
make: *** [/home/karlp/src/tinyusb.git/tools/make/toolchain/arm_gcc_rules.mk:79: _build/ek_tm4c123gxl/cdc_msc.elf] Error 1
karlp@leram:~/src/tinyusb.git/examples/device/cdc_msc (master)$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arm GNU Toolchain 12.3.Rel1 (Build arm-12.35)) 12.3.1 20230626
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have checked existing issues, dicussion and documentation.

karlp avatar Nov 22 '23 16:11 karlp

following patch "fixes" it, but unsure if that's where you want things done:

$ git diff
diff --git a/hw/bsp/tm4c123/boards/ek_tm4c123gxl/tm4c123.ld b/hw/bsp/tm4c123/boards/ek_tm4c123gxl/tm4c123.ld
index 351857bd6..f70f253bd 100644
--- a/hw/bsp/tm4c123/boards/ek_tm4c123gxl/tm4c123.ld
+++ b/hw/bsp/tm4c123/boards/ek_tm4c123gxl/tm4c123.ld
@@ -24,6 +24,7 @@ SECTIONS
         *(.fini)
         *(.rodata)
         *(.rodata.*)
+       *(.ARM.exidx*)
         . = ALIGN(4) ;
         __end_text = . ;
     } >FLASH

karlp avatar Nov 22 '23 16:11 karlp

which gcc version you are using ?

hathach avatar Dec 22 '23 04:12 hathach

arm-none-eabi-gcc (Arm GNU Toolchain 12.3.Rel1 (Build arm-12.35)) 12.3.1 20230626

karlp avatar Dec 22 '23 21:12 karlp

ah thanks, my pc (and ci) is currently running with gcc 11. I will try to update and test this soon enough.

hathach avatar Dec 25 '23 06:12 hathach