marcelstoer / docker-nodemcu-build

Docker image to build NodeMCU firmware for the ESP8266 on your machine
https://hub.docker.com/r/marcelstoer/nodemcu-build/
MIT License
129 stars 63 forks source link

instructions for builds with SPIFFS_FIXED_LOCATION set #50

Closed loadedtech closed 5 years ago

loadedtech commented 5 years ago

I think the instructions for "Flashing the built binary" might / should reference the setting:

define SPIFFS_FIXED_LOCATION 0x100000

Presumably the section should include something like: If you set your build to a fixed location using something like: #define SPIFFS_FIXED_LOCATION 0x100000 then the command to flash the image will become esptool.py --port <USB-port-with-ESP8266> write_flash 0x100000 <NodeMCU-firmware-directory>/bin/nodemcu_[integer|float]_<Git-branch>.bin

marcelstoer commented 5 years ago

@loadedtech pls stop reporting more of the same. I don't see how issues 50-53 are different from each other?

loadedtech commented 5 years ago

Sorry for the spam, there was a problem with github — it didn’t show the issue after it was posted.

loadedtech commented 5 years ago

Guys, does anyone have any tips ... I can't get an LFS image larger than 64kb to work. Are there any docs or user_config.h settings you can point me to?

HHHartmann commented 5 years ago

I assume you do not build with the online service?

The setting in user_config.h

#define LUA_FLASH_STORE 0x10000

defines the max size of the area reserved for LFS images. Maybe that's the problem.

loadedtech commented 5 years ago

Gregor, I am trying to build both the firmware and LFS images using this docker image.

In user_config.h I have the following settings:

#define LUA_FLASH_STORE 0x20000
#define BUILD_SPIFFS
#define SPIFFS_FIXED_LOCATION        0x100000
//#define SPIFFS_MAX_FILESYSTEM_SIZE    0x20000
//#define SPIFFS_SIZE_1M_BOUNDARY
#define SPIFFS_CACHE 1          // Enable if you use you SPIFFS in R/W mode
#define SPIFFS_MAX_OPEN_FILES 4 // maximum number of open files for SPIFFS
#define FS_OBJ_NAME_LEN 31      // maximum length of a filename

To build the images I run:

docker run --rm -ti -v path]/nodemcu-firmware:/opt/nodemcu-firmware marcelstoer/nodemcu-build build 
docker run --rm -ti -v [path]/nodemcu-firmware:/opt/nodemcu-firmware -v [path]/lfs:/opt/lua  marcelstoer/nodemcu-build lfs-image

If the resultant LFS image is below 64kB then the NodeMCU runs as expected. If the LFS image gets over 65kB then the Node won't boot.

Any tips would be appreciated.

Hugh

HHHartmann commented 5 years ago

Hmm just reasoning. Ate you using master or dev branch?

Your firmware image is smaller than 1 MByte?

Does it not boot after flashing the firmware or after loading the LFS image?

What happens when you do not set SPIFFS_FIXED_LOCATION?

I have been using LFS images over 64 K successfully.

loadedtech commented 5 years ago

So I'm using marcelstoer/nodemcu-build:latest And yes, the firmware is only 922KB With SPIFFS_FIXED_LOCATION 0x100000 :

I'm building firmware with SPIFFS_FIXED_LOCATION commented out and will let you know what happens with the small and large LFS

loadedtech commented 5 years ago

Ok, so same behaviour with SPIFFS_FIXED_LOCATION commented out

Some more details ... here is the boot info:

NodeMCU 2.2.0.0 built with Docker provided by frightanic.com branch: master commit: c708828bbe853764b9de58fb8113a70f5a24002d SSL: false Build type: float LFS: Size: 0x30000 modules: adc,apa102,bit,bme280,color_utils,crypto,dht,ds18b20,file,gpio,http,hx711,i2c,mdns,mqtt,net,node,ow,pwm,sjson,sntp,spi,tmr,uart,u8g2,websocket,wifi,ws2812,ws2812_effects build created on 2019-03-03 04:05 powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)

When trying to boot it keeps cycling through and printing the following to the console:

ets Jan 8 2013,rst cause:4, boot mode:(3,6) wdt reset load 0x40100000, len 27300, room 16 tail 4 chksum 0x80 load 0x3ffe8000, len 2376, room 4 tail 4 chksum 0x54 load 0x3ffe8948, len 136, room 4 tail 4 chksum 0xa4 csum 0xa4 ����'�{��n|�$ d$lc��|;�l�n��o��$��s�l�$� l`��s�l�l� l ��{�l���� $l {$��sl���b��b|dc�� ���dc��g��gn��l�|쏌 d $�$�|�l �d�g�����# dl�ćcğ�c d �b{$s

loadedtech commented 5 years ago

One thing I've noticed is that no matter what value is set for #define LUA_FLASH_STORE the NodeMCU boot message is the same (LFS: Size: 0x30000). Also, even if #define LUA_NUMBER_INTEGRAL is enabled, the build is integer only but the boot message still says "Build type: float"

However if it's a float build AND "#define LUA_FLASH_STORE 0x40000" then I get the following build error (on OSX with Docker Engine v 18.09.2) :

tensa-lx106-elf-ar: creating .output/eagle/debug/lib/libu8g2lib.a make[2]: Leaving directory '/opt/nodemcu-firmware/app/u8g2lib' /usr/bin/ccache xtensa-lx106-elf-gcc -L/opt/nodemcu-firmware/sdk/esp_iot_sdk_v2.2.1/lib -L/opt/nodemcu-firmware/sdk/esp_iot_sdk_v2.2.1/ld -Wl,--gc-sections -Wl,-Map=mapfile -nostdlib -T../ld/nodemcu.ld -Wl,@../ld/defsym.rom -Wl,--no-check-sections -Wl,--wrap=_xtos_set_exception_handler -Wl,-static -u HX711_module_selected -u WS2812_EFFECTS_module_selected -u UART_module_selected -u CRYPTO_module_selected -u U8G2_module_selected -u I2C_module_selected -u WS2812_module_selected -u SPI_module_selected -u NODE_module_selected -u FILE_module_selected -u DHT_module_selected -u BME280_module_selected -u GPIO_module_selected -u WIFI_module_selected -u PWM_module_selected -u APA102_module_selected -u NET_module_selected -u SNTP_module_selected -u SJSON_module_selected -u HTTP_module_selected -u DS18B20_module_selected -u MDNS_module_selected -u BIT_module_selected -u ADC_module_selected -u TMR_module_selected -u WEBSOCKET_module_selected -u MQTT_module_selected -u OW_module_selected -u COLOR_UTILS_module_selected -Wl,--start-group -lmain -lc -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lwpa2 -lsmartconfig -lcrypto -lwps user/.output/eagle/debug/lib/libuser.a driver/.output/eagle/debug/lib/libdriver.a platform/.output/eagle/debug/lib/libplatform.a task/.output/eagle/debug/lib/libtask.a libc/.output/eagle/debug/lib/liblibc.a lua/.output/eagle/debug/lib/liblua.a lwip/.output/eagle/debug/lib/liblwip.a smart/.output/eagle/debug/lib/smart.a spiffs/.output/eagle/debug/lib/spiffs.a fatfs/.output/eagle/debug/lib/libfatfs.a pm/.output/eagle/debug/lib/libpm.a esp-gdbstub/.output/eagle/debug/lib/libgdbstub.a net/.output/eagle/debug/lib/libnodemcu_net.a mbedtls/.output/eagle/debug/lib/libmbedtls.a modules/.output/eagle/debug/lib/libmodules.a crypto/.output/eagle/debug/lib/libcrypto.a dht/.output/eagle/debug/lib/libdht.a http/.output/eagle/debug/lib/libhttp.a mqtt/.output/eagle/debug/lib/libmqtt.a sjson/.output/eagle/debug/lib/libsjson.a websocket/.output/eagle/debug/lib/libwebsocket.a u8g2lib/.output/eagle/debug/lib/libu8g2lib.a -Wl,--end-group -lm -o .output/eagle/debug/image/eagle.app.v6.out /tmp/esp/esp-open-sdk/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: .output/eagle/debug/image/eagle.app.v6.out section .irom0.text' will not fit in regionirom0_0_seg' collect2: error: ld returned 1 exit status ../Makefile:363: recipe for target '.output/eagle/debug/image/eagle.app.v6.out' failed make[1]: [.output/eagle/debug/image/eagle.app.v6.out] Error 1 make[1]: Leaving directory '/opt/nodemcu-firmware/app' Makefile:272: recipe for target '.subdirs' failed make: [.subdirs] Error 2

HHHartmann commented 5 years ago

The wrong startup message most likely is die to a precaution that was built in to the scripts in the docker image. It modifies the nodemcu-firmware\app\include\user_version.h but only if it is untouched. After the build it discards the changes. Your user_version.h is most likely modified and thus not changed. That's probably due to an aborted build, which didn't get around discarding the changes. Simply discard local changes and on the next build it should get updated.

As to your other problem I am running out of ideas. There was https://github.com/nodemcu/nodemcu-firmware/issues/2546. but it should be fixed. Maybe you are not using the latest version? Or it is not fixed.

loadedtech commented 5 years ago

So I got it working. Here's what I did in case it helps someone else (although my situation may have been idiosyncratic):

  1. Reset local changes to nodemcu-firmware\app\include\user_version.h
  2. Updated git repo git pull origin master
  3. Updated docker image: docker pull marcelstoer/nodemcu-build
  4. Updated user_config.h: 4.1 #define LUA_FLASH_STORE 0x40000 4.2 #define BUILD_SPIFFS 4.3 #define SPIFFS_FIXED_LOCATION 0x100000
  5. Rebuilt the firmware and then rebuilt the LFS image
  6. All good!

Thank you all for the amazing work.