linking arm libc instead of thumb

Asked by Jérôme Hamm on 2019-03-28

Hi,

Sorry, I must be doing something wrong, but I can't seem to find what.
I am using Ubuntu 18.04 arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620 and it looks like the selected libc is the ARM one, not the THUMB one. I first detected this through a BUS FAULT which upon investigation and disassembly (the .lss file) looks like arm code. Moreover I tried the following commands:

> arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 --print-file-name=libc.a
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a
^^^ I have seen in another post that when some guy types the same command line (although for a Cortex-M4), he gets 'thumb' somewhere in the returned path.

> arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 --print-multi-directory
thumb/v7-m

Other libs (for example function __eabi__uidiv) look like thumb code.

Thank you for your time,
Best regards,
Jérôme.

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Andre Vieira
Solved:
2019-05-24
Last query:
2019-05-24
Last reply:
2019-05-24
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Have you tried this with a newer version?

I am seeing the following with our latest release:
$ arm-none-eabi-gcc -mcpu=cortex-m3 --print-file-name=libc.a
<toolchain_path>/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc.a

Same if you add -mthumb (which you don't have to, -mcpu=cortex-m* implies -mthumb nowadays).

Jérôme Hamm (jerome.hamm) said : #3

Hi Andre,

Thank you for your answer. In fact, what I had in mind is that the stock Ubuntu package should work, and it should not be necessary to add a PPA and download another version for the compiler to work.

Do you agree with this way of thinking?

Best regards,
Jérôme.

Hi Jerome,

What package are you referring to exactly?

Best Regards,
Andre

Jérôme Hamm (jerome.hamm) said : #5

Hi Andre,

I have used
> sudo apt install gcc-arm-none-eabi

More information:
> sudo dpkg -l | grep gcc-arm-none-eabi
ii gcc-arm-none-eabi 15:6.3.1+svn253039-1build1 amd64 GCC cross compiler for ARM Cortex-A/R/M processors

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

Do you need anything else?

Best regards,
Jérôme.

From that version number it looks like that package is also based on gcc 6.3.1 so unless a multilib fix was backported it will probably have the same issue. I suggest you try a newer version than that, you can find one on https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

Hope that helps.

Cheers,
Andre

Jérôme Hamm (jerome.hamm) said : #7

Hi Andre,

Thank you for your time. I'm sorry, I thought you were the maintainer of the Ubuntu package.
I think it is very bad to have a default package in a system, moreover if it is LTS, that is plain buggy!
I mean I lost quite a lot of time because of it and had to buy an stlink (not very dearly, but anyway), to be able to compile a valid firmware...

I'm not new to Linux, but very new to the fact of reporting problems. Where should I go to signal this bug and try to get it fixed? I mean I found a solution, but I am thinking of others...

Cheers,
Jérôme.

Hi Jerome,

You can try Ubuntu's launchpad bug report page:
https://launchpad.net/ubuntu/+source/gcc-arm-none-eabi/+bugs

Cheers,
Andre

Jérôme Hamm (jerome.hamm) said : #9

Thanks Andre Vieira, that solved my question.