Skip to content
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

Add direct-boot support for ESP32-S3 #107

Merged
merged 3 commits into from
Jul 20, 2022

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Jul 19, 2022

With this we can make use of the direct-boot feature of ESP32-S3.

Please note: We need a recent espflash executable to actually flash the binary

Fixes #39

@bjoernQ bjoernQ requested a review from jessebraham July 19, 2022 14:38
@jessebraham
Copy link
Member

Sorry if this is a silly question, but what am I missing here?

cargo +esp espflash --release --monitor --format=direct-boot --features=direct-boot --example=hello_world
[ ... ]
Finished release [optimized] target(s) in 40.97s
Chip type:         ESP32-S3
Crystal frequency: 40MHz
Flash size:        16MB
Features:          WiFi, BLE
MAC address:       7c:df:a1:e1:ae:30
Error: espflash::invalid_direct_boot

  × binary is not setup correct to support direct boot
  help: See the following page for documentation on how to setup your binary for direct boot:
        https://github.com/espressif/esp32c3-direct-boot-example

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jul 19, 2022

Sorry if this is a silly question, but what am I missing here?

cargo +esp espflash --release --monitor --format=direct-boot --features=direct-boot --example=hello_world
[ ... ]
Finished release [optimized] target(s) in 40.97s
Chip type:         ESP32-S3
Crystal frequency: 40MHz
Flash size:        16MB
Features:          WiFi, BLE
MAC address:       7c:df:a1:e1:ae:30
Error: espflash::invalid_direct_boot

  × binary is not setup correct to support direct boot
  help: See the following page for documentation on how to setup your binary for direct boot:
        https://github.com/espressif/esp32c3-direct-boot-example

Are you using the espflash with today's changes?

@jessebraham
Copy link
Member

Ahh I knew I was forgetting something haha, thanks. Flashes now but I get a backtrace:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0xa (SPI_FAST_FLASH_BOOT)
Saved PC:0x40050f3f
0x40050f3f - rom_config_instruction_cache_mode
    at ??:??
Guru Meditation Error: Core 0 panic'ed (LoadStoreError)
Core 0 register dump:
PC      : 0x42003f9a  PS      : 0x00060330  A0      : 0x8200389b  A1      : 0x3fcf5fc0
0x42003f9a - _ZN17compiler_builtins3mem6memcpy17h9357f21b7722a654E
    at ??:??
A2      : 0x4037de15  A3      : 0x3c005a15  A4      : 0x00000ca4  A5      : 0x00000000
0x4037de15 - _srwtext
    at ??:??
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000003  A9      : 0x4037de18
0x4037de18 - _srwtext
    at ??:??
A10     : 0x00000003  A11     : 0x4037de15  A12     : 0x3c005a15  A13     : 0x00000003
0x4037de15 - _srwtext
    at ??:??
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000003
EXCVADDR: 0x4037de15  LBEG    : 0x42003f97  LEND    : 0x42003fa1  LCOUNT  : 0x00000002
0x4037de15 - _srwtext
    at ??:??
0x42003f97 - _ZN17compiler_builtins3mem6memcpy17h9357f21b7722a654E
    at ??:??
0x42003fa1 - _ZN17compiler_builtins3mem6memcpy17h9357f21b7722a654E
    at ??:??
Backtrace: 0x42003f9a:0x3fcf5fc0 0x42003898:0x3fcf5fe0 0x42000ec8:0x3fcf6000
0x42003f9a - _ZN17compiler_builtins3mem6memcpy17h9357f21b7722a654E
    at ??:??
0x42003898 - memcpy
    at ??:??
0x42000ec8 - startup_direct_boot
    at ??:??

(This repeats)

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jul 19, 2022

Hmmm ... Maybe a wrong alignment? Will check that tomorrow - thanks a lot for testing

Could you try some other examples and maybe release vs debug builds?

@jessebraham
Copy link
Member

The hello_world example works in dev but not release, same with hello_rgb. So it seems to be something to do with building with --release.

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jul 19, 2022

That's very useful - thanks a lot!

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jul 20, 2022

@jessebraham Should now work in both - release and development mode

esp32s3-hal/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working for both profiles now, thanks!

@jessebraham jessebraham merged commit 9fa1d1e into esp-rs:main Jul 20, 2022
jrmoulton pushed a commit to jrmoulton/esp-hal that referenced this pull request Jul 30, 2022
* Add direct-boot support for ESP32-S3
* Make sure to use correct alignments
* Only enable naked_functions and asm_experimental_arch when direct-boot feature is selected
@bjoernQ bjoernQ deleted the feature/direct-boot-esp32-s3 branch October 27, 2022 14:22
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.

Add a direct-boot feature to esp32s3-hal
3 participants