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

How to build a custom bootloader for a 26mhz esp32c2? #1052

Closed
AlexeyTuboltsev opened this issue Dec 26, 2023 · 3 comments
Closed

How to build a custom bootloader for a 26mhz esp32c2? #1052

AlexeyTuboltsev opened this issue Dec 26, 2023 · 3 comments

Comments

@AlexeyTuboltsev
Copy link

I'm trying to build an example from esp-wifi for my esp32c2 with a 26mhz crystal. After running through some hoops to pass the "xtal-26mhz" feature from esp-wifi's Cargo.toml down to esp-hal/esp32c3-hal I finally managed to build the code but now I get a boot loop with this error:

  !! A panic occured in '/home/lexey/esp-hal/esp-hal-common/src/rtc_cntl/rtc/esp32c2.rs', at line 65, column 5
                                                                                                               
PanicInfo {
    payload: Any { .. },
    message: Some( Did you flash the right bootloader configured for 26MHz xtal?, ),
    location: Location {
          file: "/home/lexey/esp-hal/esp-hal-common/src/rtc_cntl/rtc/esp32c2.rs", line: 65,  col: 5, },
          can_unwind: true,
          force_no_backtrace: false,
      }
    
    Backtrace:  0x4201e65c
                      0x420000d0

In the original pull request where this feature was added author mentions that a custom bootloader is necessary (#301). How do I make one?
Thank you!

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 27, 2023

Easiest way to build a suitable bootloader is to use esp-idf and build one of the examples (which one doesn't matter - examples/get-started/hello_world is probably a good fit)

Do esptool.py set-target esp32c2

Before building you need to use menuconfig to set Component config → Hardware Settings → Main XTAL Config → Main XTAL frequency to 26MHz (40 by default)

After idf.py build you should find the bootloader as examples/get-started/hello_world/build/bootloader/boot loader.bin

That can be used with espflash

@AlexeyTuboltsev
Copy link
Author

Thank you very much! I'll give it a try later today

@SergioGasquez
Copy link
Member

SergioGasquez commented Dec 29, 2023

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants