Skip to content

Commit

Permalink
loaders/esp: add readme to document how to build the stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
erhankur committed Nov 23, 2022
1 parent eeb0d52 commit 6cd81a6
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions contrib/loaders/flash/esp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ESP32 Stubs

These are small bits of code that run on the ESP32 to facilitate OpenOCD operation on the chip. The generated `.inc` files in these directories are included in the final `openocd` binary, but these `.inc` files need to be generated separately.

## Building Stubs

The stubs use a specific build of ESP-IDF. Look at at the `stub_flasher_image.h` file for the `ESP32*_STUB_BUILD_IDF_REV` comment to find the ESP-IDF SHA that you need to use to build the stub. The process for each chip (e.g. esp32, esp32s3, etc) is roughly the same, though the stubs may use different versions of IDF. The process is:

1. Download the git repo for the ESP-IDF version.
```bash
git clone https://github.com/espressif/esp-idf.git
```

2. Checkout the right version of ESP-IDF based on the comment in `stub_flasher_image.h` for your target chip (e.g. `036bd3eb26` from `esp32s3/stub_flasher_image.h`)
```bash
cd esp-idf
git checkout 036bd3eb26 # or whatever the SHA is
git submodule update --init --recursive
```

3. Set up the ESP-IDF environment
```bash
./install.sh
source export.sh
```

4. Go back to your `openocd-esp32` directory and build the stub for your target chip
```bash
cd ../openocd-esp32/contrib/loaders/flash/esp/esp32s3
```

5. Build the stub
```bash
make
```

6. Now you can go through the normal OpenOCD build process, and the stub will be included in the final binary.

0 comments on commit 6cd81a6

Please sign in to comment.