From b996442506737be3826735cca0f65a9b9911ce0f Mon Sep 17 00:00:00 2001 From: Steve Arnold Date: Fri, 17 Nov 2017 10:09:43 -0800 Subject: configs: update crossdev examples Signed-off-by: Steve Arnold --- configs/armv7m-crossdev.txt | 7 ++-- configs/crossdev-examples.txt | 74 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/configs/armv7m-crossdev.txt b/configs/armv7m-crossdev.txt index 9367f47..b5e2525 100644 --- a/configs/armv7m-crossdev.txt +++ b/configs/armv7m-crossdev.txt @@ -42,12 +42,13 @@ 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: +Basic FLAGS for target builds: -CFLAGS="-mthumb -march=armv7e-m -mtune=cortex-m4 -mabi=aapcs \ +CFLAGS_FOR_TARGET="-mthumb -march=armv7e-m -mtune=cortex-m4 -mabi=aapcs \ -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee \ - -Wa,-mimplicit-it=thumb" + -Wa,-mimplicit-it=thumb -O[s2]" +CXXFLAGS_FOR_TARGET="-g -O[s2] -ffunction-sections -fdata-sections -fno-exceptions" Current vendor toolchain produces: diff --git a/configs/crossdev-examples.txt b/configs/crossdev-examples.txt index 9a44c64..20fe41c 100644 --- a/configs/crossdev-examples.txt +++ b/configs/crossdev-examples.txt @@ -1,8 +1,16 @@ -This works with new USE=ada toolchain overlay and the crossdev-fixes -branch, however, the current crossdev-99999999 wants to put the cross -overlay in the wrong place. The --ov-output swicth does create the -overlay but then fails to look there. Apparently using the (deprecated) -PORTDIR_OVERLAY env var is the only way... +This works with new USE=ada toolchain overlay from 5.4 up and the newer +crossdev, however, crossdev-99999999 still wants to put the cross overlay +in the wrong place. The --ov-output swicth does create the overlay but +then crossdev fails to look there. Apparently using the (deprecated) +PORTDIR_OVERLAY env var is the best way... + +Note these also work (up through cortex-M4, not tested with avr yet) +with USE=ada for cross/embedded gnat. For non-glibc/bare-metal +(currently armv7m with newlib) you should also add "--disable-libada" +to EXTRA_ECONF. + +Note you may need to play with USE flags and set your system linker to +bfd first if gold is default. This worked for arm: @@ -17,15 +25,67 @@ as of 10/06/2017 with: glibc 2.25-r5 linux-headers 4.13 +To go back slightly to match previous headers, and add some USE flags: +(remember to disable other overlays first) + +PORTDIR_OVERLAY="/usr/local/armv7-a /var/lib/layman/ada" \ + USE="ada -graphite hardened -fortran -go -jit multitarget -openmp -vtv" \ + EXTRA_ECONF="--with-arch=armv7-a --with-tune=cortex-a9 --with-float-abi=hard --with-fpu=vfpv3-d16" \ + crossdev --g 5.4.0-r4 --b 2.28.1 --k 4.10 --l 2.24-r4 \ + -t armv7a-hardfloat-linux-gnueabi --ex-gdb -v + +For gcc 4.9.4 try: + +PORTDIR_OVERLAY="/usr/local/armv7-a" \ + USE="-graphite -hardened -fortran -go -jit multitarget -openmp -vtv" \ + EXTRA_ECONF="--with-arch=armv7-a --with-tune=cortex-a9 --with-float-abi=hard --with-fpu=vfpv3-d16" \ + crossdev --g 4.9.4-r1 --b 2.28.1 \ + -t armv7a-hardfloat-linux-gnueabi --ex-gdb -v + This worked for arm64: crossdev -v -t aarch64-unknown-linux-gnu --ex-gdb This worked for cortex-M4: -USE="hardened multitarget lzma -multilib -openmp -fortran -jit" \ +Change the tuning to match your cpu; you need s4 for c++ and ada +(you may also want to relax the hardened flags). + +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 -t armv7m-hardfloat-eabi --ex-gdb \ + crossdev -t armv7m-hardfloat-eabi -s4 --ex-gdb \ --show-fail-log --ov-output /usr/local/cortex-m4 + + +This works for avr: + +Note that, except for pie, hardened and sanitizer can be enabled, +but should be disabled if anything doesn't look right. Also note +that graphite appears to optimize the arduino sketch loops away, +so you probably don't want that... + +And arduino/other newer builds seem to require c++ and even -flto (which +also means it needs gold linker and plugins, maybe a manual step now... +So binutils and gcc need USE=cxx along with stage4 to build the right stuff. + +Lastly note you should not need anything older than 4.9.4 and 2.29.1 for +current arduino IDE use. If you switch to older binutils after installing +current avr toolchain you'll need to make a manual symlink for ldscripts. + +PORTDIR_OVERLAY="/usr/local/portage/cross-avr" \ + USE="cxx -graphite -hardened multitarget lzma multilib -sanitize -nls -openmp -pie -fortran -jit -vtv" \ + EXTRA_ECONF="--enable-libstdcxx-time=no" \ + crossdev --g 6.4.0 -t avr -s4 --ex-gdb --show-fail-log -v + +This works for avr and older gcc / binutils: +Note gcc 4.8.4 is broken wrt avr-libc, at least it fails mmcu compat test +for "standard" arduino cpus (notably uno and mega) so does not install the +required crtm*.o files. + +PORTDIR_OVERLAY="/usr/local/portage/cross-avr" \ + USE="cxx -graphite -hardened multitarget lzma multilib -nls -openmp nopie nossp -sanitize -fortran -jit -vtv" \ + EXTRA_ECONF="--enable-libstdcxx-time=no" \ + crossdev --g 4.9.4-r1 --b 2.25.1-r1 -t avr -s4 \ + --ex-gdb --show-fail-log -v -- cgit v1.2.3-65-gdbad