jmattsson / esp-toolchains

Releases of toolchains for ESP8266 and ESP32.
13 stars 8 forks source link

Raspberry pi 2+ can't build toolchain (fixed) #5

Open slorquet opened 4 years ago

slorquet commented 4 years ago

After quite some investigation I traced the build failure of this toolchain to gmp. This happens because the raspi 3 and 4 have a 64-bit CPU but Raspbian (Raspberry pi OS) is still a 32 bit build, which freaks out gmp because optimized assembly routines.

A simple fix in the crosstool configuration file allows to toolchain to be built, documented here: https://github.com/crosstool-ng/crosstool-ng/issues/1288

I suggest that the current patch applied before running the build should include the modification required to add the extra cflags that fix the build:

CT_EXTRA_CFLAGS_FOR_HOST="-march=armv7-a -mfloat-abi=hard -mtune=cortex-a5"

I am not sure yet this is enough for a full build, which has been running for 36 minutes at this moment and will likely not complete for many more hours. I will report additional issues on this topic, but as of now it is sure that this change is absolutely required to make it work.

/proc/cpuinfo can detect the pi version. Here is what I get on a raspberry pi 2:

Hardware        : BCM2835
Revision        : a01041
Serial          : 00000000f5xxxxxx
Model           : Raspberry Pi 2 Model B Rev 1.1

and on the failing machine:

Hardware        : BCM2835
Revision        : a01041
Serial          : 000000002exxxxxx
Model           : Raspberry Pi 2 Model B Rev 1.1

ooops... so the build also fails on a raspi 2. I updated the title of the issue, and I think that the required patch can be applied as soon as grep on /proc/cpuinfo reports a Raspberry Pi!

edit: seems wrong. I am not sure of anything now! dmesg reports:

[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Linux version 4.19.97-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1294 SMP Thu Jan 30 13:15:58 GMT 2020
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 2 Model B Rev 1.1
slorquet commented 4 years ago

I confirm that I could build the toolchain with these flags in CT-NG .config :

CT_EXTRA_CFLAGS_FOR_HOST="-march=armv7-a -mfloat-abi=hard -mtune=cortex-a5"
slorquet commented 4 years ago

The raspberry pi toolchain can be downloaded here: http://www.lorquet.fr/toolchain-esp32-pi/ can you please store it in your github releases and make it available for download when building nodemcu on a pi?