ivmarkov / rust-esp32-std-demo

Rust on ESP32 STD demo app. A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen.
Apache License 2.0
785 stars 105 forks source link

Define partition config in Cargo.toml #117

Open pyaillet opened 1 year ago

pyaillet commented 1 year ago

Fixes #116 by setting partition.csv path in Cargo.toml as described here

axos88 commented 1 year ago

Tried this approach, it still reports:

I (58) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (76) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 3, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=00010020 vaddr=3c110020 size=2fc20h (195616) map
I (142) esp_image: segment 1: paddr=0003fc48 vaddr=3fc8e200 size=003d0h (   976) load
I (142) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=1016b8h (1054392) map
I (312) esp_image: segment 3: paddr=001416e0 vaddr=3fc8e5d0 size=028b8h ( 10424) load
I (314) esp_image: segment 4: paddr=00143fa0 vaddr=40380000 size=0e1d4h ( 57812) load
I (329) esp_image: segment 5: paddr=0015217c vaddr=50000010 size=00010h (    16) load
E (329) esp_image: Image length 1319344 doesn't fit in partition length 1048576
E (335) boot: Factory app partition is not bootable
E (340) boot: No bootable app partitions in the partition table

when issueing:

 cargo clean -p esp-idf-sys --release && cargo build --release && cargo espflash --release --monitor --speed 1152000

The solution that works for me is adding the following lines to sdkconfig.defaults:

CONFIG_PARTITION_TABLE_SINGLE_APP=
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="../../../../../../partitions.csv"

Which I believe is cleaner, since esp-idf also knows about the correct partition table during build,hence it can report that the image will not fit:

 Error: All app partitions are too small for binary libespidf.bin size 0x22320:
    - Part 'ota0' 0/16 @ 0x10000 size 0x15000 (overflow 0xd320)
    - Part 'ota1' 0/17 @ 0x200000 size 0x15000 (overflow 0xd320)
pyaillet commented 1 year ago

I tried it here and partitions.csv was picked up correctly :\ it might be related to cargo-espflash version.

Anyway, looking at the existing readme, the best solution may be either yours or add the --partition-table=./partitions.csv to this section of the readme.