Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAMx7x CDC-MSC example does not link with LOG=2 #1520

Closed
tmplt opened this issue Jun 17, 2022 · 5 comments · Fixed by #1539
Closed

SAMx7x CDC-MSC example does not link with LOG=2 #1520

tmplt opened this issue Jun 17, 2022 · 5 comments · Fixed by #1539
Labels

Comments

@tmplt
Copy link

tmplt commented Jun 17, 2022

Operating System

Linux

Board

SAM V71 Xplained Pro

Firmware

examples/device/cdc_msc @ e0d7c16

What happened ?

Upon building with

$ cd examples/device/cdc_msc
$ make BOARD=same70_xplained LOG=2 all

linking fails with

LINK _build/same70_xplained/cdc_msc.elf
/nix/store/l3rvj8w9ci8wj34kmsvga1ijikmngz0y-gcc-arm-embedded-10.3.1/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /nix/store/l3rvj8w9ci8wj34kmsvga1ijikmngz0y-gcc-arm-embedded-10.3.1/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libnosys.a(sbrk.o): in function `_sbrk':
sbrk.c:(.text._sbrk+0x18): undefined reference to `end'
collect2: error: ld returned 1 exit status
make: *** [../../rules.mk:100: _build/same70_xplained/cdc_msc.elf] Error 1

Building without LOG=2 links as expected, and the example works on the V71 even though the example is written for the E70.

How to reproduce ?

$ git clone https://github.com/hathach/tinyusb.git && cd tinyusb
$ git submodule update --init
$ cd examples/device/cdc_msc
$ make BOARD=same70_xplained LOG=2 all
[-Wcast-qual warnings...]
LINK _build/same70_xplained/cdc_msc.elf
/nix/store/l3rvj8w9ci8wj34kmsvga1ijikmngz0y-gcc-arm-embedded-10.3.1/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /nix/store/l3rvj8w9ci8wj34kmsvga1ijikmngz0y-gcc-arm-embedded-10.3.1/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libnosys.a(sbrk.o): in function `_sbrk':
sbrk.c:(.text._sbrk+0x18): undefined reference to `end'
collect2: error: ld returned 1 exit status
make: *** [../../rules.mk:100: _build/same70_xplained/cdc_msc.elf] Error 1

Debug Log as txt file

No response

Screenshots

No response

@tmplt tmplt added the Bug 🐞 label Jun 17, 2022
@tmplt
Copy link
Author

tmplt commented Jun 17, 2022

Possibly a toolchain issue, but I do not have a non-NixOS system at hand to verify.

@tmplt
Copy link
Author

tmplt commented Jun 17, 2022

CC @perlindgren

@perlindgren
Copy link

I tested under arch (manjaro).

After a bit of tool-chain fiddling I was able to reproduce the error:

LINK _build/same70_xplained/cdc_msc.elf
/usr/lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/12.1.0/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libnosys.a(sbrk.o): in function `_sbrk':
sbrk.c:(.text._sbrk+0x18): undefined reference to `end'
collect2: error: ld returned 1 exit status
make: *** [../../rules.mk:100: _build/same70_xplained/cdc_msc.elf] Error 1

@hathach
Copy link
Owner

hathach commented Jun 24, 2022

this is usually missing symbol end/_end in the linker script. The end symbol is used by nanolib for printf(). I will check this out the next time I work with same 7x

@hathach hathach mentioned this issue Jun 29, 2022
@hathach
Copy link
Owner

hathach commented Jun 29, 2022

this is fixed by adding end symbol to linker of sam 7x in microchip driver submodule
hathach/microchip_driver@9e8b37e

and is resolved by #1539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants