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

Compilation fails for ESP32 : myproject.partition.bin missing. #163

Closed
UltimateUnicorn opened this issue Mar 6, 2019 · 5 comments · Fixed by #457
Closed

Compilation fails for ESP32 : myproject.partition.bin missing. #163

UltimateUnicorn opened this issue Mar 6, 2019 · 5 comments · Fixed by #457
Milestone

Comments

@UltimateUnicorn
Copy link

UltimateUnicorn commented Mar 6, 2019

Hello. Thanks for the support and many advices you've already provided here.
I would like to report a bug that occurs when I try to compile a sketch for an ESP32.

My setup

Steps to reproduce

  • Create a new project (I copied the HelloServer.ino from the examples directory into a new directory called test and renamed HelloServer.ino into test.ino).
  • Compile it using arduino-cli compile --fqbn esp32:esp32:esp32 test (from the parent directory of test) -> works well (I got a "normal" output from the compiler and the following files have been created in the test folder : test.esp32.esp32.esp32.bin & test.esp32.esp32.esp32.elf.
  • Upload the project : arduino-cli upload --fqbn esp32:esp32:esp32 -p /dev/ttyUSB0 test -> doesn't work. I get the following output :

No new serial port detected.
usage: esptool write_flash [-h] [--flash_freq {keep,40m,26m,20m,80m}]
[--flash_mode {keep,qio,qout,dio,dout}]
[--flash_size FLASH_SIZE]
[--spi-connection SPI_CONNECTION] [--no-progress]
[--verify] [--compress | --no-compress]

[ ...]
esptool write_flash: error: argument : [Errno 2] No such file or directory: 'test/test.esp32.esp32.esp32.partitions.bin'
Error: exit status 2
Error during upload.

Additional information

  • When using the Espressif toolchain & ESP-IDF on the same computer I can upload the sketch and it runs.
  • I used the exact same procedure using the Arduino IDE version 1.8.8 under Windows : it worked flawlessly.
  • I just realized that there is no newline between "directory:" and "test/tes....." on my console. Don't know if it's relevant.

Feel free to contact me for additional details / testings.
Thanks.

@per1234
Copy link
Contributor

per1234 commented Mar 7, 2019

The ESP32 core's recipe.objcopy.eep.pattern creates a file named {build.project_name}.partitions.bin:
https://github.com/espressif/arduino-esp32/blob/master/platform.txt#L80

recipe.objcopy.eep.pattern={tools.gen_esp32part.cmd} -q "{runtime.platform.path}/tools/partitions/{build.partitions}.csv" "{build.path}/{build.project_name}.partitions.bin"

and then the upload recipe expects to find that file in {build.path}, but arduino-cli doesn't copy that file from the temporary build folder to the sketch folder, thus the error.

@WayneBooth
Copy link

WayneBooth commented Mar 30, 2019

I have same problem. Happy to provide details is required.
For now I have two workarounds:

Edit platform.txt to remove the upload for partitions.bin

102,103c102,105
< tools.esptool_py.upload.pattern="{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader_{build.boot}_{build.flash_freq}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
< tools.esptool_py.upload.pattern.linux=python "{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader_{build.boot}_{build.flash_freq}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
---
> tools.esptool_py.upload.pattern="{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader_{build.boot}_{build.flash_freq}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 
> #0x8000 "{build.path}/{build.project_name}.partitions.bin"
> tools.esptool_py.upload.pattern.linux=python "{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader_{build.boot}_{build.flash_freq}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 
> #0x8000 "{build.path}/{build.project_name}.partitions.bin"

or simply upload manually
path_to_tool/esptool.py --port /dev/ttyUSB0 write_flash 0x10000 ~/Arduino/tst/tst.esp32.esp32.esp32.bin

@ubidefeo
Copy link

@WayneBooth I recommend manual upload for now.
If you issue an erase_flash command this will delete the partition scheme and if you manually upload a firmware after such operation your program will not run.
@cmaglie how can we tackle copying the partition.bin file as well?

@per1234 per1234 added the bug label May 24, 2019
@thbar
Copy link

thbar commented Jul 26, 2019

I met the same problem. Thanks @WayneBooth for the work-arounds. If it helps someone not familiar with esptool, on a Mac here is exactly what I had to do (using the installed Arduino IDE):

~/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool --port /dev/cu.SLAB_USBtoUART write_flash 0x10000 WifiScan/WifiScan.esp32.esp32.esp32.bin 

After that, attaching using screen /dev/cu.SLAB_USBtoUART 115200 allowed me to verify that the upload succeeded.

@jdwolin
Copy link

jdwolin commented Aug 5, 2019

Same problem here!

@cmaglie cmaglie added this to the 0.6.0 milestone Sep 12, 2019
@rsora rsora modified the milestones: 0.6.0, 0.7.0 Oct 7, 2019
cmaglie added a commit that referenced this issue Oct 28, 2019
Previously the compile command copied only the following artifacts:

  sketch.ino.hex (or .bin)
  sketch.ino.elf

now also the files matching the glob sketch.ino.*.hex will be copied.
This allows for some 3rd party core (like esp32) to copy also the extra
file sketch.ino.partitions.bin.

Should fix #163
cmaglie added a commit that referenced this issue Oct 29, 2019
Previously the compile command copied only the following artifacts:

  sketch.ino.hex (or .bin)
  sketch.ino.elf

now also the files matching the glob sketch.ino.*.hex will be copied.
This allows for some 3rd party core (like esp32) to copy also the extra
file sketch.ino.partitions.bin.

Should fix #163
cmaglie added a commit that referenced this issue Oct 29, 2019
* Copy multiple build artifacts matching a name pattern.

Previously the compile command copied only the following artifacts:

  sketch.ino.hex (or .bin)
  sketch.ino.elf

now also the files matching the glob sketch.ino.*.hex will be copied.
This allows for some 3rd party core (like esp32) to copy also the extra
file sketch.ino.partitions.bin.

Should fix #163

* Added test for improved support for esp32:esp32

#163

* Run of "go mod tidy"
per1234 added a commit that referenced this issue Aug 9, 2021
[skip changelog] Add security policy link to readme
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 a pull request may close this issue.

8 participants