Hello everyone!
I’m trying to flash my NodeMCU with platformio, but it keeps writing at 0x0000, but it has to start at 0x1000.
I saw the board_build.ldscript parameter, but it seems to be uneffective.
Do you have any ideas?
Thanks!
Hello everyone!
I’m trying to flash my NodeMCU with platformio, but it keeps writing at 0x0000, but it has to start at 0x1000.
I saw the board_build.ldscript parameter, but it seems to be uneffective.
Do you have any ideas?
Thanks!
X/Y problem? Why are you convinced it has to write to 0x1000?
Is your firmware not booting up and you think it’s because of the wrong flash offset settings? Or are you trying to do something custom?
It’ because if i flash with the online ESP flash tool, it detects that it should start at 0x1000, and my firmware works.
When i try it with platformio, it starts on 0x0000 and it doesn’t work.
What exact ESP8266 board and flash size do you have?
What’s the current output project task → Advanced → Verbose Upload?
The board is this one , i’m using Clion, should i post the output of the upload that shows in the terminal?
Ah, then you can just open a terminal inside CLion and use
pio run -t upload -v
to do the same “Verbose Upload”. The point of that is to see the esptool.py invocation and output.
C:\Users\jimmy\.platformio\packages\framework-arduinoespressif8266\tools\elf2bin.py:54: SyntaxWarning: invalid escape sequence '\s'
words = re.split('\s+', line)
C:\Users\jimmy\.platformio\packages\framework-arduinoespressif8266\tools\elf2bin.py:73: SyntaxWarning: invalid escape sequence '\s'
words = re.split('\s+', line)
Creating BIN file ".pio\build\nodemcuv2\firmware.bin" using "C:\Users\jimmy\.platformio\packages\framework-arduinoespressif8266\bootloaders\eboot\eboot.elf" and ".pio\build\nodemcuv2\firmware.elf"
<lambda>(["upload"], [".pio\build\nodemcuv2\firmware.bin"])
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
MethodWrapper(["upload"], [".pio\build\nodemcuv2\firmware.bin"])
Auto-detected: COM4
"C:\Users\jimmy\.platformio\penv\Scripts\python.exe" "C:\Users\jimmy\.platformio\packages\tool-esptoolpy@1.30000.201119\esptool.py" --before default_reset --after hard_reset --chip esp8266 --port "COM4" --baud 115200 write_flash 0x0 .pio\build\nodemcuv2\firmware.bin
esptool.py v3.0
Serial port COM4
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 08:f9:e0:5d:25:40
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 338912 bytes to 244503...
Writing at 0x00000000... (6 %)
Writing at 0x00004000... (13 %)
Writing at 0x00008000... (20 %)
Writing at 0x0000c000... (26 %)
Writing at 0x00010000... (33 %)
Writing at 0x00014000... (40 %)
Writing at 0x00018000... (46 %)
Writing at 0x0001c000... (53 %)
Writing at 0x00020000... (60 %)
Writing at 0x00024000... (66 %)
Writing at 0x00028000... (73 %)
Writing at 0x0002c000... (80 %)
Writing at 0x00030000... (86 %)
Writing at 0x00034000... (93 %)
Writing at 0x00038000... (100 %)
Wrote 338912 bytes (244503 compressed) at 0x00000000 in 21.5 seconds (effective 126.2 kbit/s)...
Hash of data verified.
My platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
board_build.ldscript = eagle.flash.4m1m.ld
lib_deps =
567
No, this is different. The upload address is hardcoded to 0x0 (beginning of flash) because the .bin
file that is uploaded is the “merge” or combination of all needed files (bootloader, app). See source, source, source.
If the firmware doesn’t start up on that board, some flash settings must be wrong. Usually either frequency, mode or linker script (which impacts the expected flash size), per documentation.
Okay, so this sets it up for 4MB flash with 1MB filesystem, with 40 MHz flash in DIO mode. (docs).
What setttings do you use with the “Online ESP flash tool” in regards to flash size, flash mode and frequency?
Dunno, the online tool outputs this:
esptool.js
Serial port WebSerial VendorID 0x1a86 ProductID 0x7523
Connecting...
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 08:f9:e0:5d:25:40
Uploading stub...
Running stub...
Stub running...
Changing baudrate to 921600
Changed
Compressed 267840 bytes to 192014...
Writing at 0x1000... (8%)
Writing at 0x7647... (16%)
Writing at 0xd30b... (25%)
Writing at 0x125ae... (33%)
Writing at 0x175ff... (41%)
Writing at 0x1c755... (50%)
Writing at 0x21c7d... (58%)
Writing at 0x2757d... (66%)
Writing at 0x2ce22... (75%)
Writing at 0x32509... (83%)
Writing at 0x37e19... (91%)
Writing at 0x3deaf... (100%)
Wrote 267840 bytes (192014 compressed) at 0x1000 in 3.58 seconds.
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Okay. Then just try out all the possibilities. There aren’t too many.
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
board_build.ldscript = eagle.flash.4m1m.ld
lib_deps =
tzapu/WiFiManager@^2.0.17
; default: "dio". Try all three others,
; by only having one active and all others commented out
board_build.flash_mode = dout
; board_build.flash_mode = qio
; board_build.flash_mode = qout
I trust you’re using the most basic sketch to test this, like a LED blink and serial print?