Skip to content

cpu/esp8266: fix the crashes on startup in vendor code#22010

Merged
gschorcht merged 1 commit intoRIOT-OS:masterfrom
gschorcht:cpu/esp8266/fix_crash_on_startup
Jan 23, 2026
Merged

cpu/esp8266: fix the crashes on startup in vendor code#22010
gschorcht merged 1 commit intoRIOT-OS:masterfrom
gschorcht:cpu/esp8266/fix_crash_on_startup

Conversation

@gschorcht
Copy link
Copy Markdown
Contributor

@gschorcht gschorcht commented Jan 23, 2026

Contribution description

This PR fixes arbitrary crashes or hangs when starting ESP8266 boards.

RIOT uses an older version of the vendor code from the ESP8266-RTOS-SDK, in which the call_user_startup function tried to copy a fixed number of 3 segments from flash memory to RAM. This led to arbitrary crashes or hangs during startup when there were only two segments in the flash memory that needed to be copied to RAM. With this fix, the number of segments specified in the image header is now used.

Testing procedure

Compile and flash an ESP8266 board with command

USEMODULE='sock_dns gnrc_ipv6_nib_dns' BOARD=esp8266-esp-12x \
make -C examples/networking/gnrc/networking flash term

Without the PR, the example should get stuck or crash at startup. With the PR, the example should work.

Issues/PRs references

RIOT uses an older version of the RTOS SDK, in which the `call_user_startup` function copied a fixed number of 3 segments from flash memory to RAM. This led to random crashes when there were only 2 segments to copy in flash memory. With this fix, the number of segments specified in the image header is now used.
@github-actions github-actions bot added Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: cpu Area: CPU/MCU ports labels Jan 23, 2026
@gschorcht gschorcht added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 23, 2026
@riot-ci
Copy link
Copy Markdown

riot-ci commented Jan 23, 2026

Murdock results

✔️ PASSED

f26a325 cpu/esp8266: fix the crashes on startup in vendor code

Success Failures Total Runtime
11003 0 11004 16m:07s

Artifacts

@maribu maribu enabled auto-merge January 23, 2026 13:20
@maribu maribu added this pull request to the merge queue Jan 23, 2026
@leandrolanzieri
Copy link
Copy Markdown
Contributor

Thanks for fixing this one!

@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 23, 2026
@leandrolanzieri leandrolanzieri added the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Jan 23, 2026
@gschorcht gschorcht removed this pull request from the merge queue due to a manual request Jan 23, 2026
@gschorcht
Copy link
Copy Markdown
Contributor Author

Thanks for fixing this one!

Wait, now the example crashes when the esp_wifi module is used. I need to check. 🙈

@gschorcht gschorcht added the State: waiting for maintainer State: Action by a maintainer is required label Jan 23, 2026
@gschorcht
Copy link
Copy Markdown
Contributor Author

gschorcht commented Jan 23, 2026

Thanks for fixing this one!

Wait, now the example crashes when the esp_wifi module is used. I need to check. 🙈

Please forget it, I used a version of ESP8266-RTOS-SDK which I modified for the investigation of another problem with esp_wifi. It is not related to this PR. Without the ESP8266-RTOS-SDK modification it works as expected.

@gschorcht gschorcht added this pull request to the merge queue Jan 23, 2026
@gschorcht gschorcht removed the State: waiting for maintainer State: Action by a maintainer is required label Jan 23, 2026
Merged via the queue into RIOT-OS:master with commit 45533c6 Jan 23, 2026
31 checks passed
@gschorcht gschorcht deleted the cpu/esp8266/fix_crash_on_startup branch January 26, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants