diff options
author | Steve Arnold <nerdboy@gentoo.org> | 2017-10-09 23:03:21 -0700 |
---|---|---|
committer | Steve Arnold <nerdboy@gentoo.org> | 2017-10-09 23:03:21 -0700 |
commit | fdfedc80436c20c6fe94bdf610591a5453e01889 (patch) | |
tree | 8b4f079e94092093c4f77de7c655cccb6339560c /configs/armv7m-crossdev.txt | |
parent | add eclass/mozconfig-v6.52 and mozconfig-v6.53 for firefox fun... (diff) | |
download | arm-fdfedc80436c20c6fe94bdf610591a5453e01889.tar.gz arm-fdfedc80436c20c6fe94bdf610591a5453e01889.tar.bz2 arm-fdfedc80436c20c6fe94bdf610591a5453e01889.zip |
update example configs and add some crossdev examples
Signed-off-by: Steve Arnold <nerdboy@gentoo.org>
Diffstat (limited to 'configs/armv7m-crossdev.txt')
-rw-r--r-- | configs/armv7m-crossdev.txt | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/configs/armv7m-crossdev.txt b/configs/armv7m-crossdev.txt new file mode 100644 index 0000000..9367f47 --- /dev/null +++ b/configs/armv7m-crossdev.txt @@ -0,0 +1,72 @@ +Use crossdev to build a bare-metal (no kernel headers or full eglibc) for +an ARM Cortex-M4 dev board. The cortex-m4 is the armv7e-m arch for gcc. +The Cortex-M4 has a silicon FPU option (VFPv4-SP) of single-precision (SP), +which is known as a Cortex-M4F. The Cortex-M4 also includes SIMD DSP +instructions. + +This commands builds binutils/gcc/newlib/gdb; first emerge crossdev-999999, +then disable any layman/other overlays and enable the output overlay in the +crossdev command (unless you want the cross-foo overlay to be created in +the first existing overlay found by crossdev). + +Note for newer portage using repos.conf you should use PORTDIR_OVERLAY for +the output overlay instead of the crossdev argument for ov-output. Also if +portage complains about no LIBC defined, you can add ELIBC="newlib" to +the command line. + +USE="hardened multitarget lzma -multilib -openmp -fortran -jit" EXTRA_ECONF="--disable-multilib --disable-libsanitizer --with-arch=armv7e-m --with-tune=cortex-m4 --with-float-abi=hard --with-fpu=fpv4-sp-d16 --with-mode=thumb" crossdev armv7m-hardfloat-eabi --ex-gdb --show-fail-log --ov-output /usr/local/cortex-m4 + +To use the nano-io and nano-malloc config options, use this one: + +USE="hardened multitarget lzma -multilib -openmp -fortran -jit" EXTRA_ECONF="--enable-newlib-nano-formatted-io --enable-newlib-nano-malloc --with-newlib --disable-multilib --disable-libsanitizer --with-arch=armv7e-m --with-tune=cortex-m4 --with-float-abi=hard --with-fpu=fpv4-sp-d16 --with-mode=thumb" crossdev armv7m-hardfloat-eabi --abis "aapcs,atpcs" --ex-gdb --show-fail-log --ov-output /usr/local/cortex-m4 + +Final command using portage newlib for default stage-1 gcc: + +PORTDIR_OVERLAY="/usr/local/cortex-m4 /var/lib/layman/ada" USE="hardened multitarget lzma -multilib -openmp -fortran -jit -vtv" EXTRA_ECONF="--enable-newlib-nano-formatted-io --enable-newlib-nano-malloc --with-newlib --disable-multilib --disable-libsanitizer --with-arch=armv7e-m --with-tune=cortex-m4 --with-float-abi=hard --with-fpu=fpv4-sp-d16 --with-mode=thumb --with-abi=aapcs-linux --enable-libstdcxx-time=no" crossdev --g 5.4.0-r4 -t armv7m-hardfloat-eabi --ex-gdb --show-fail-log -v + +Using newlib-nano ebuild in local overlay, note newlib-nano enables the above +two options plus several others: + +PORTDIR_OVERLAY="/usr/local/cortex-m4 /var/lib/layman/ada /usr/local/portage" USE="hardened multitarget lzma -multilib -nls -openmp -fortran -jit -vtv" EXTRA_ECONF="--with-newlib --disable-multilib --disable-libsanitizer --with-arch=armv7e-m --with-tune=cortex-m4 --with-float-abi=hard --with-fpu=fpv4-sp-d16 --with-mode=thumb --with-abi=aapcs-linux" crossdev --g 5.4.0-r4 -t armv7m-hardfloat-eabi --lenv 'USE="newlib-nano"' --ex-gdb --show-fail-log -v + +2-stage gcc command with crossdev arg for stage 4 with c,c++ and newlib: + +PORTDIR_OVERLAY="/usr/local/cortex-m4 /var/lib/layman/ada" USE="-ada hardened multitarget lzma -multilib -nls -openmp -fortran -jit -vtv" EXTRA_ECONF="--with-newlib --disable-multilib --disable-libsanitizer --with-arch=armv7e-m --with-tune=cortex-m4 --with-float-abi=hard --with-fpu=fpv4-sp-d16 --with-mode=thumb --with-abi=aapcs-linux --enable-libstdcxx-time=no" crossdev --g 5.4.0-r4 -s4 -t armv7m-hardfloat-eabi --lenv 'USE="newlib-nano"' --ex-gdb --show-fail-log -v + +Same command as above but with ada support (just no libada) + +PORTDIR_OVERLAY="/usr/local/cortex-m4 /var/lib/layman/ada" USE="ada hardened multitarget lzma -multilib -nls -openmp -fortran -jit -vtv" EXTRA_ECONF="--with-newlib --disable-libada --disable-multilib --disable-libsanitizer --with-arch=armv7e-m --with-tune=cortex-m4 --with-float-abi=hard --with-fpu=fpv4-sp-d16 --with-mode=thumb --with-abi=aapcs-linux --enable-libstdcxx-time=no" crossdev --g 6.4.0 -s4 -t armv7m-hardfloat-eabi --genv 'EXTRA_ECONF="--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm"' --lenv 'USE="newlib-nano"' --ex-gdb --show-fail-log -v + +Extra upstream config hack for transactional memory related code in +crtbegin.o, add INHIBIT_LIBC_CFLAGS to EXTRA_ECONF: + +--genv 'EXTRA_ECONF="--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" INHIBIT_LIBC_CFLAGS="-DUSE_TM_CLONE_REGISTRY=0"' + +Basic CFLAGS for target builds: + +CFLAGS="-mthumb -march=armv7e-m -mtune=cortex-m4 -mabi=aapcs \ + -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee \ + -Wa,-mimplicit-it=thumb" + + +Current vendor toolchain produces: + + text data bss dec hex filename + 208576 1112 27888 237576 3a008 _build/nrf52832_xxaa_s132.out + + +Updated toolchain using gcc 5.4.0, newlib 2.4.0, gdb 7.11.1 without libnano* +but with newlib-nano-formatted-io and newlib-nano-malloc enabled and -Os +plus -g debug symbols produces: + + text data bss dec hex filename + 129268 1820 28500 159588 26f64 _build/nrf52832_xxaa_s132.out + + +Updated toolchain using slightly more correct (and bloaty) debug flags, where +DEBUG_BLOAT = -Og -g3 produces: + + text data bss dec hex filename + 145780 1820 28548 176148 2b014 _build/nrf52832_xxaa_s132.out + +Roll your own toolchain ftw! |