Using plaformio with ESP NONOS SDK

Hi.
Does anyone here use a ESP8266 NONOS SDK? I can’t make even the simplest code to work. I copied examples from GitHub - platformio/platform-espressif8266: Espressif 8266: development platform for PlatformIO, code compiles perfectly, but after upload device (wemos d1 mini) gets stuck in a reboot loop.
ets Jan 8 2013,rst cause:2, boot mode:(3,6
Arduino sdk works fine. I don’t know how to bite this :confused:

—edit—
Same with RTOS. only arduino works

What exact platformio.ini are you using?

pretty basic:

[env:esp12e]
platform = espressif8266
board = d1_mini
framework = esp8266-nonos-sdk
monitor_speed = 74880

I experimented with different boards (different flash sizes) but to no avail.
Damn, should I really have to read entire chip and SDK documentation to build and run included sample code?

having the same problem. it is ridicoulus

It very much is! One can always write code in PIO and compile it in external SDK, but cmoooon! The world does not start and end on Arduino.

I am sticking to linux ubuntu compiling for nonos sdk. This platformio is nonsense, shame though, it is advertised really well, was excited to try it out.

Also…arduino doesn’t work too well for me in platformio either. Blinky works, but other stuff not su much. Just tried to run relatively complex code built in platformio, and all hell broke loose. Same code works flawlessly and beatifully in arduino

1 Like

I wonder if configuring if configuring VSCode for NONOS SDK is a viable option, or is it time to say sorry to Eclipse again.

Support for ESP8266 Non-OS SDK and ESP8266 RTOS SDK was added by our community members:

We don’t maintain it personally. It seems that we should remove these SDKs from our supported list and wait when someone will provide better integration.

I have now bought a Wemos D1 mini (D1 Mini NodeMcu mit ESP8266-12F WLAN Module CH340G Lua – AZ-Delivery) and reproduced the problem. It occurs immediately when flashing the blinky firmware.

The problem is the exact same as I have already solved before and reported: The ESP-8266-Non-OS build script doesn’t flash the esp_init_data_default.bin file to the correct address for the module. In fact, it doesn’t flash / compile it all (for all modules, not as only for 1MB modules as I assumed) when you look at the build / flash commands

//compiling image
"esptool" -eo .pioenvs\d1_mini_rtos\firmware.elf -bo .pioenvs\d1_mini_rtos\eagle.flash.bin -bm dio -bf 40 -bz 4M -bs .text -bs .data -bs .rodata -bc -ec -eo .pioenvs\d1_mini_rtos\firmware.elf -es .irom0.text .pioenvs\d1_mini_rtos\eagle.irom0text.bin -ec -v
//uplading
esptool -cd nodemcu -cb 921600 -cp "COM7" -ca 0x00000 -cf .pioenvs\d1_mini_rtos\eagle.flash.bin -ca 0x10000 -cf .pioenvs\d1_mini_rtos\eagle.irom0text.bin

The actuall correct uplaod command for me would be to load esp_init_data_default.bin to 0x3fc000 (4MB module). You can go into your tool-esptool folder and after-flash the file

esptool -cd nodemcu -cb 921600 -cp "COM7" -ca 0x3fc000 -cf "C:\Users\Maxi\.platformio\packages\framework-esp8266-nonos-sdk\bin\esp_init_data_default.bin"

Then the firmware comes right up and works.

Now it’s questionable for me if I should fix this because probably, the community-provided new ESP8266-RTOS/NONOS builders will be far better than the current one and will work with the most current SDK version (see here), so it doesn’t make sense to work on old stuff; that is, when it’s planned to integrate this builder into the main platform-espressif8266. Or what do you think @ivankravets?

But anyways, you have a fix now! :slight_smile:

2 Likes

how to flash it using pio?

As I explained, use esptool and the correct path to the esp_init_data_default.bin file. Depending on your PIO core installation it’s e.g. in C:\Users\<user>\.platformio\packages\tool-esptool\esptool.exe and the esp_init_data_default.bin is in packages\framework-esp8266-nonos-sdk\bin\esp_init_data_default.bin.

You’d need to construct the correct command with the correct path and execute it in a command shell (cmd.exe).

Is there a way to fix this inside pio, so when I upload, everything gets uploaded correctly

We’d have to write a fix for the python builder script but I think there will be an update to this entire platform soon so I didn’t bother with it, see above.

Once you execute that command one time, the contents should be kept there unless you erase the chip, so it should stay there even if you upload another firmware.

1 Like

Thanks @maxgerhardt :blush:

Please re-test with upstream version Espressif 8266 — PlatformIO latest documentation

Does it work now?

1 Like

It very much does! It’s finally blinking :slight_smile:

There was also a bugfix release 2.0.4 so if you do a platform update (pio platform update or via the VSCode IDE) it suffices to say platform = espressif8266 now. (If you want to be extra carefull you can platform = espressif8266@>=2.0.4 to make sure you get at least that version)

2 Likes

Okay another question about using NONOS SDK with platformIO.
How to use heatshrink- a data compression/decompression library for embedded/real-time systems on data files (SPIFFS) for ESP8266 on platformIO. is it possible? I’ve used it already with NONOS SDK, but, not sure how to do it on platformIO

Open a new topic with the exact details of how you implemented it without PlatformIO, not here.