mapmot / arduino-overlay

Arduino IDE overlay for gentoo linux
https://bugs.gentoo.org/525882
GNU General Public License v2.0
2 stars 2 forks source link

Add Udoo quad/dual platform via useflag and upstream fork of bossa #10

Closed sarnold closed 6 years ago

sarnold commented 6 years ago

This needs the latest crossdev commits and the kernel patches for mainline/gentoo sources (latest is 4.14.6) mentioned in the wilki so everything works from a Gentoo/mainline install like it does in the vendor images.

https://wiki.gentoo.org/wiki/Udoo

mapmot commented 6 years ago

Thank you for the update. I don't own an Udoo, but have a coupe of Zero SAMD clones. Arduino on the SAMD in Gentoo is even more fragile than AVR, so I am VERY reluctant to merge this out of fear of hurting my precious SAMD toys. I will take a closer look later in the week.

Re: latest crossdev - I have gotten SAMD to work with stable crossdev with the following incantation: EXTRA_ECONF="--disable-multilib --with-arch=armv6s-m --disable-libstdcxx-time" emerge -1 cross-arm-none-eabi/gcc The problem with stable crossdev is that it produces hardfloat toolchain. I would rather work with stable crossdev, instead of adding Yet Another Overlay/Ebuild.

Repoman insists on gnome2_icon_cache_update, which on my gtk3/gnome3 system triggers a 30 minute enumeration of the Adwaita icons. You are trying to make me suffer here: https://github.com/mapmot/arduino-overlay/pull/10/commits/4f1194a9a3523957b3fd4fdbc735ef65ee6f4e2b

sarnold commented 6 years ago

How exactly are you doing samd when the use flag isn't hooked up to anything yet? Also the udoo samd platform stuff is all behind "udooqdl" use flag. Lastly, the latest crossdev-99999999 (in the main tree, not in an overlay) will build you a proper cortex-M toolchain with multilib now. Check the example in the Udoo howto and try that: https://wiki.gentoo.org/wiki/Udoo#Applications

mapmot commented 6 years ago

SAMD needs:

  1. Core: https://github.com/arduino/ArduinoCore-samd
  2. CMSIS:https://github.com/arduino/ArduinoModule-CMSIS-Atmel
  3. BOSSAC
  4. cross-arm-none-eabi toolchain
  5. Custom platform.txt that points to all of the above

1 and 2 are just local git clones in ~/Arduino/hardware/samd 3 is in the overlay 4 took me months to get working, currently binutils-2.29.1-r1 gcc-7.2.0 newlib-2.5.0.20170818 5 is in ~/Arduino/hardware/samd, modelled after what I do in arduino-builder

I haven't gotten around to wrapping everything around in ebuilds yet, but it sure beats the 4.x toolchain that gets downloaded by the Arduino board manager. Still working on a layout of what goes where: /usr/share/arduino, /usr/share/arduino/hardware/blah or /usr/share/arduino-core-blah.

My setup is an Orange Pi + SAMD or AVR, instead of an Udoo :)

sarnold commented 6 years ago

Well, the Udoo samd platform stuff is just another source URI for the board-manager repo, which I assume you could do with upstream Arduino. The only change besides the tool paths in platform.txt is putting it under /usr/share/arduino/[VENDOR]/samd and then it shows up in the GUI menu. Also, I tried with 6.4.0 on Udoo and the linker scripts were coughing warnings all over, and the default flash.ld fails on the linker step. Once I switched to 5.4.0 it all compiles smoothly. Sounds like the Udoo tree (which is still 1.6.x I think) is lagging behind if 7.2.0 works for you; are you using the same version of samd support that the board manager installs?

sarnold commented 6 years ago

Also you should try crossdev with multilib; what is the output of gcc -print-multi-lib with your toolchain? Does it look anything like this? This is 5.4.0 without the extra patches:

arm-none-eabi-gcc -print-multi-lib
.;
thumb;@mthumb
v7-a;@march=armv7-a
v7ve;@march=armv7ve
v8-a;@march=armv8-a
v7-a/fpv3/softfp;@march=armv7-a@mfpu=vfpv3-d16@mfloat-abi=softfp
v7-a/fpv3/hard;@march=armv7-a@mfpu=vfpv3-d16@mfloat-abi=hard
v7-a/simdv1/softfp;@march=armv7-a@mfpu=neon@mfloat-abi=softfp
v7-a/simdv1/hard;@march=armv7-a@mfpu=neon@mfloat-abi=hard
v7ve/fpv4/softfp;@march=armv7ve@mfpu=vfpv4-d16@mfloat-abi=softfp
v7ve/fpv4/hard;@march=armv7ve@mfpu=vfpv4-d16@mfloat-abi=hard
v7ve/simdvfpv4/softfp;@march=armv7ve@mfpu=neon-vfpv4@mfloat-abi=softfp
v7ve/simdvfpv4/hard;@march=armv7ve@mfpu=neon-vfpv4@mfloat-abi=hard
v8-a/simdv8/softfp;@march=armv8-a@mfpu=neon-fp-armv8@mfloat-abi=softfp
v8-a/simdv8/hard;@march=armv8-a@mfpu=neon-fp-armv8@mfloat-abi=hard
thumb/v7-a;@mthumb@march=armv7-a
thumb/v7ve;@mthumb@march=armv7ve
thumb/v8-a;@mthumb@march=armv8-a
thumb/v7-a/fpv3/softfp;@mthumb@march=armv7-a@mfpu=vfpv3-d16@mfloat-abi=softfp
thumb/v7-a/fpv3/hard;@mthumb@march=armv7-a@mfpu=vfpv3-d16@mfloat-abi=hard
thumb/v7-a/simdv1/softfp;@mthumb@march=armv7-a@mfpu=neon@mfloat-abi=softfp
thumb/v7-a/simdv1/hard;@mthumb@march=armv7-a@mfpu=neon@mfloat-abi=hard
thumb/v7ve/fpv4/softfp;@mthumb@march=armv7ve@mfpu=vfpv4-d16@mfloat-abi=softfp
thumb/v7ve/fpv4/hard;@mthumb@march=armv7ve@mfpu=vfpv4-d16@mfloat-abi=hard
thumb/v7ve/simdvfpv4/softfp;@mthumb@march=armv7ve@mfpu=neon-vfpv4@mfloat-abi=softfp
thumb/v7ve/simdvfpv4/hard;@mthumb@march=armv7ve@mfpu=neon-vfpv4@mfloat-abi=hard
thumb/v8-a/simdv8/softfp;@mthumb@march=armv8-a@mfpu=neon-fp-armv8@mfloat-abi=softfp
thumb/v8-a/simdv8/hard;@mthumb@march=armv8-a@mfpu=neon-fp-armv8@mfloat-abi=hard
sarnold commented 6 years ago

Here is 6.4.0 with the extra patches, which you can apply from the ada overlay. Note that it picks up armv6 like it should, plus adds some missing armv8-M stuff:

arm-none-eabi-gcc-6.4.0 -print-multi-lib
.;
thumb;@mthumb
fpu;@mfloat-abi=hard
armv6-m;@mthumb@march=armv6s-m
armv7-m;@mthumb@march=armv7-m
armv7e-m;@mthumb@march=armv7e-m
armv7-ar/thumb;@mthumb@march=armv7
armv8-m.base;@mthumb@march=armv8-m.base
armv8-m.main;@mthumb@march=armv8-m.main
armv7e-m/softfp/fpv5-sp-d16;@mthumb@march=armv7e-m@mfloat-abi=softfp@mfpu=fpv5-sp-d16
armv7e-m/softfp/fpv5-d16;@mthumb@march=armv7e-m@mfloat-abi=softfp@mfpu=fpv5-d16
armv7e-m/softfp;@mthumb@march=armv7e-m@mfloat-abi=softfp@mfpu=fpv4-sp-d16
armv7e-m/fpu/fpv5-sp-d16;@mthumb@march=armv7e-m@mfloat-abi=hard@mfpu=fpv5-sp-d16
armv7e-m/fpu/fpv5-d16;@mthumb@march=armv7e-m@mfloat-abi=hard@mfpu=fpv5-d16
armv7e-m/fpu;@mthumb@march=armv7e-m@mfloat-abi=hard@mfpu=fpv4-sp-d16
armv7-ar/thumb/softfp;@mthumb@march=armv7@mfloat-abi=softfp@mfpu=vfpv3-d16
armv7-ar/thumb/fpu;@mthumb@march=armv7@mfloat-abi=hard@mfpu=vfpv3-d16
armv8-m.main/softfp/fpv5-sp-d16;@mthumb@march=armv8-m.main@mfloat-abi=softfp@mfpu=fpv5-sp-d16
armv8-m.main/softfp/fpv5-d16;@mthumb@march=armv8-m.main@mfloat-abi=softfp@mfpu=fpv5-d16
armv8-m.main/fpu/fpv5-sp-d16;@mthumb@march=armv8-m.main@mfloat-abi=hard@mfpu=fpv5-sp-d16
armv8-m.main/fpu/fpv5-d16;@mthumb@march=armv8-m.main@mfloat-abi=hard@mfpu=fpv5-d16
mapmot commented 6 years ago

CMSIS is actually two parts:

  1. The ARM upstream: https://github.com/ARM-software/CMSIS_5
  2. The Arduino Device modules: https://github.com/arduino/ArduinoModule-CMSIS-Atmel

I am not defending my approach in any way, everything is strictly works for me

SAMD is strictly M0(+), so as expected with EXTRA_ECONF="--disable-multilib --with-arch=armv6s-m" arm-none-eabi-gcc -print-multi-lib .;

I have actually managed to hard brick a couple of SAMDs (No Programming Port) by uploading hardfloat stuff...

The v7 and v8 stuff is probably better done with the appropriate armvX-hardfloat-gnueabihf toolchain.

I am doing everything natively on armv7a, including the Arduino IDE. Building a toolchain is an overnight affair...

sarnold commented 6 years ago

Yeah, I have a Jetson to build the big stuff on (even imx6 quad-core isn't that reliable pushing -j4). Anyway, all that stuff in the output above is for cortex-M and should support M0 (at least 6.4.0 does AFAICT). If you disable multilib you will only get 2 lines of output with the above command (depending on flags) for hardfloat and thumb. My guess is 7.2.0 will also need some patches, so I should build one and test it...

mapmot commented 6 years ago

Since we are probably the only two individuals on Earth masochist enough to use Arduino on Gentoo, I have merged the pull request. We should probably continue the discussion on #11