View previous topic :: View next topic |
Author |
Message |
rapsure Apprentice
Joined: 29 Apr 2004 Posts: 172 Location: Logan, UT USA
|
Posted: Thu Aug 30, 2018 5:01 am Post subject: How to build a toolchain for arm cortex-m and cortex-r |
|
|
So crossdev almost can build a functioning toolchain for embedded arm development. I do embedded arm development for my job so this is critical to have a fully functioning toolchain. Here is how to do it.
Step 1:
Code: | crossdev --lenv 'USE="nano -nls -threads -unicode"' -s3 -t arm-unknown-eabi |
Step 2:
Code: | crossdev --lenv 'USE="nano -nls -threads -unicode"' --genv 'USE="cxx -nls -nptl -pch -pie -ssp" EXTRA_ECONF="--with-multilib-list=rmprofile --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-shared --disable-threads --disable-tls"' -s4 -t arm-unknown-eabi |
Step 3:
Code: | emerge cross-arm-unknown-eabi/newlib |
Step 4: to get gdb
Code: | crossdev --lenv 'USE="nano -nls -threads -unicode"' --genv 'USE="cxx -nls -nptl -pch -pie -ssp" EXTRA_ECONF="--with-multilib-list=rmprofile --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-shared --disable-threads --disable-tls"' -s4 --ex-gdb -t arm-unknown-eabi |
Now you'll have a functioning multilib / multiarch for embedded arm development with small code output size. Maybe someday these changes can be incorporated into crossdev.
Maybe make this a sticky. I took a lot of time to figure out all of the switches and the process.
With changes to toolchain.eclass as of August 2018 you will need to edit the file to disable --enable-float=soft
Change on line 1116:
Code: | yes) confgcc+=( --with-float=soft ) ;; |
to
_________________ Hindi ko naintindihan, pakiulit. Sometimes my code works. |
|
Back to top |
|
|
eugene-bright n00b
Joined: 23 Sep 2018 Posts: 2
|
|
Back to top |
|
|
KAMIKAZE_ Guru
Joined: 09 Oct 2003 Posts: 309 Location: Riga, Latvia
|
Posted: Wed Oct 03, 2018 1:38 am Post subject: |
|
|
After upgrading I've got my micropython firmware build failing with:
Quote: |
CC build-PYBV11/pins_PYBV11.c
LINK build-PYBV11/firmware.elf
arm-none-eabi-ld: error: build-PYBV11/firmware.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/8.2.0/libgcc.a(_udivmoddi4.o) does not
arm-none-eabi-ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/8.2.0/libgcc.a(_udivmoddi4.o)
make: *** [Makefile:528: build-PYBV11/firmware.elf] Error 1
|
_________________ -=[powered by Gentoo]=- |
|
Back to top |
|
|
rapsure Apprentice
Joined: 29 Apr 2004 Posts: 172 Location: Logan, UT USA
|
Posted: Sat Oct 13, 2018 9:17 pm Post subject: |
|
|
Quote: | After upgrading I've got my micropython firmware build failing with: |
That is because your comping with hardware fpu support and linking against a soft fpu gcc. The instuctions I gave above gives a multilib build of libc-nano and the smallest code size for a Cortex-M or Cortex-R. _________________ Hindi ko naintindihan, pakiulit. Sometimes my code works. |
|
Back to top |
|
|
triffid_hunter n00b
Joined: 31 Aug 2013 Posts: 8
|
Posted: Thu Sep 03, 2020 9:55 am Post subject: |
|
|
I've found that lots of modern toolchains want arm-none-eabi to have hardfp support, however by default, cross-arm-none-eabi/newlib won't make hardfp libraries but it can be convinced to build them with a configure flag - that means we can make a arm-none-eabi toolchain with -mfloat-abi=soft,softfp,and hard support with this command:
Code: | crossdev --lenv 'USE="nano -nls -threads -unicode" EXTRA_ECONF="--enable-newlib-hw-fp"' --genv 'USE="cxx -nls -nptl -pch -pie -ssp" EXTRA_ECONF="--with-multilib-list=rmprofile --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-shared --disable-threads --disable-tls"' -s4 --ex-gdb -t arm-none-eabi |
Note the added EXTRA_ECONF="--enable-newlib-hw-fp" under --lenv. |
|
Back to top |
|
|
rapsure Apprentice
Joined: 29 Apr 2004 Posts: 172 Location: Logan, UT USA
|
Posted: Mon Jan 24, 2022 5:26 pm Post subject: The instructions are functional |
|
|
So I've use the above process to create binaries for the nrf51, and nrf52 and any Cortex-M... architecture. Never had a problem. I could even find compiler bugs by comparing between several different versions. _________________ Hindi ko naintindihan, pakiulit. Sometimes my code works. |
|
Back to top |
|
|
|