8000 ESP32-c3 Build Fixes, add docs for flashing apps by TheConner · Pull Request #3218 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ESP32-c3 Build Fixes, add docs for flashing apps #3218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

TheConner
Copy link
Contributor

Pull Request Overview

This PR fixes the following warning from esptool when running make flash-app:

Warning: Image file at 0x0 is protected with a hash checksum, so not changing the flash mode setting. Use the --flash_mode=keep option instead of --flash_mode=dio in order to remove this warning, or use the --dont-append-digest option for the elf2image command in order to generate an image file without a hash checksum

It seems that the flashed apps seem to overwrite critical regions of flash, causing the board to enter a infinite loop of trying to boot tock and failing. In order to recover from this I had to re-flash the tock kernel and apps.

Solution: add --dont-append-digest as the warning suggests, resolves issues with the boot loop.

Additionally, I add some extra documentation detailing how to flash apps to the board. It should save others some time in the future.

To reproduce this issue:

  • Build and flash tock kernel make && make flash
  • Build an example app for RISCV target from libtock-c
  • Flash example app to board make flash-app APP=../../../libtock-c/examples/<some-app>/build/rv32imac/rv32imac.0x403B0060.0x3FCC0000.tbf

This results in an infinite loop of trying to boot tock and failing:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:QIO, clock div:2
load:0x40380000,len:0x125c4
ets_loader.c 78 
... etc

Testing Strategy

Repeat the reproduction steps, it should not result in the bootloader failing to boot Tock.

TODO or Help Wanted

Someone else to validate this would be nice

Documentation Updated

  • Updated the readme for the ESP32-c3 board.

Formatting

  • Ran make prepush.

The following warning from esptool when running `make flash-app` causes all apps flashed to the esp32 board to fail:
```
Warning: Image file at 0x0 is protected with a hash checksum, so not changing the flash mode setting. Use the --flash_mode=keep option instead of --flash_mode=dio in order to remove this warning, or use the --dont-append-digest option for the elf2image command in order to generate an image file without a hash checksum
```

The flashed apps seem to overwrite critical regions of flash, causing the board to enter a infinite loop of trying to boot tock and failing.

Solution: add --dont-append-digest as the warning suggests, resolves issues
@bradjc bradjc requested a review from alistair23 September 14, 2022 20:06
@twilfredo
Copy link
Contributor
twilfredo commented Sep 15, 2022

Same problem as #3059 I believe. It looks like this was removed in #3148 .

I think issue is that older versions of the esptool.py don't support dont-append-digest but the current release version installed with pip is esptool.py v4.3 and supports this (without it we get the QIO induced bootloop).

I tested the above with esptool.py v4.3 and can reproduce the bug and is fixed with this patch.

Tested with c_hello/:

tock$ ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x40380000,len:0x125c4
load:0x403925c4,len:0x8
load:0x403b0000,len:0x464
SHA-256 comparison failed:
Calculated: 9d03822e5b1af4ce1056e8343700e8ceeb01c305ac568562f3df955e2bde2725
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x40380000
ESP32-C3 initialisation complete.
Entering main loop.
Hello World!
tock$ 

@bradjc bradjc merged commit 1d20940 into tock:master Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0