nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.67k stars 3.13k forks source link

Compiling issue #42

Closed 3s1d closed 9 years ago

3s1d commented 9 years ago

Hi,

first of all: great work! The pre-build binary works out of the box. I'm trying to recompile the project in order to slightly extend some (fast) C functionality. However, I can't get it to work.

The GNU toolchain (https://github.com/esp8266/esp8266-wiki/wiki) reports the following errors: 1) xtensa/simcall-fcntl.h can not be found, I side loaded it from a forum post (no Idea whether it is the correct one) 2) XTENSA_WINDOWED_ABI seems not be defined in my environment. So, what is the correct value for _JBLEN?

It was also required to side load some more stuff: wget -O lib/libc.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a wget -O include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz tar -xvzf include.tgz

I managed to circumvent the errors and compile it. However, I had no luck running it. Trying both values for _JBLEN results always in the same issue: The serial console displays "NodeMcu 0.9.4 build 20141222 powered by Lua 5.1.4" and a second or two later the ESP restarts.

Do you have experienced a similar behavior or do you have a hint for me? Regards Juergen

nodemcu commented 9 years ago

I have not test GNU toolchain. simcall-errno.h and simcall-fcntl.h are copied from winxp VM to get compile through. but there still some issue using GNU toolchain, issue #43

xlfe commented 9 years ago

I'm able to successfully compile nodemcu on Ubuntu 12.04 by using the following toolchain instructions

Get / build the toolchain

Instructions from https://github.com/nekromant/esp8266-frankenstein/blob/master/README.hacking

git clone https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make STANDALONE=y

Add the path to your path

export PATH=$PATH:/path/to/xtensa-lx106-elf/bin

Modify the nodemcu makefile

From the Patching section of https://github.com/esp8266/esp8266-wiki/wiki/Toolchain

sed -i -e 's/xt-ar/xtensa-lx106-elf-ar/' -e 's/xt-xcc/xtensa-lx106-elf-gcc/' -e 's/xt-objcopy/xtensa-lx106-elf-objcopy/' Makefile

Modify gen_misc.sh

From Preparing the firmware image https://github.com/esp8266/esp8266-wiki/wiki/Building

cd .output/eagle/debug/image
esptool -eo eagle.app.v6.out -bo eagle.app.v6.flash.bin -bs .text -bs .data -bs .rodata -bc -ec
xtensa-lx106-elf-objcopy --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin
cp eagle.app.v6.flash.bin ../../../../../bin/
cp eagle.app.v6.irom0text.bin ../../../../../bin/
nodemcu commented 9 years ago

now the missing file can be found here: https://github.com/espressif/esp_iot_rtos_sdk/tree/master/extra_include/xtensa

3s1d commented 9 years ago

every ting works fine since christmas. thanks