espressif / idf-extra-components

Additional components for ESP-IDF, maintained by Espressif
136 stars 85 forks source link

create_esp_enc_img does not run when input file is present (IDFGH-13194) (IEC-133) #349

Closed bonnee closed 5 days ago

bonnee commented 1 week ago

Answers checklist.

IDF version.

5.2.2

Operating System used.

Linux

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

What is the expected behavior?

I expect create_esp_enc_img to keep the encrypted image updated

What is the actual behavior?

The output image is created once and never updated when the input binary file changes

Steps to reproduce.

  1. Create a project
  2. Add espressif__esp_encrypted_img component
  3. Add a call to create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin, ${project_dir}/rsa_key/private.pem, ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin.enc app) in a CMakeLists.txt file
  4. Build the project and observe that the encrypted binary is created
  5. Change something in the project and build again
  6. Observe the .bin update while the .bin.enc is untouched

Build or installation Logs.

Clean build log:

[98/99] Generating binary image from built executable
esptool.py v4.7.0
Creating esp32c3 image...
Merged 2 ELF sections
Successfully created esp32c3 image.
Generated /home/bonnee/src/rt/kill-switch/master/build/bootloader/bootloader.bin
[99/99] cd /home/bonnee/src/rt/kill-switch/master/build/bootloader/esp-idf/esptool_py && /home/bonnee/.espressif/python_env/idf5.2_py3.12_env/bin/python /opt/esp-idf/components/partition_table/check_sizes.py --offset 0x9000 bootloader 0x0 /home/bonnee/src/rt/kill-switch/master/build/bootloader/bootloader.bin
Bootloader binary size 0x7120 bytes. 0x1ee0 bytes (21%) free.
[916/918] Generating binary image from built executable
esptool.py v4.7.0
Creating esp32c3 image...
Merged 1 ELF section
Successfully created esp32c3 image.
Generated /home/bonnee/src/rt/kill-switch/master/build/kill-switch.bin
[917/918] cd /home/bonnee/src/rt/kill-switch/master/build/esp-idf/esptool_py...ition-table.bin /home/bonnee/src/rt/kill-switch/master/build/kill-switch.bin
kill-switch.bin binary size 0xf0380 bytes. Smallest app partition is 0x100000 bytes. 0xfc80 bytes (6%) free.
[918/918] Generating pre-encrypted binary
Encrypting image ...
Done

Dirty build log

[10/11] Generating binary image from built executable
esptool.py v4.7.0
Creating esp32c3 image...
Merged 1 ELF section
Successfully created esp32c3 image.
Generated /home/bonnee/src/rt/kill-switch/master/build/kill-switch.bin
[11/11] cd /home/bonnee/src/rt/kill-switch/master/build/esp-idf/esptool_py &...ition-table.bin /home/bonnee/src/rt/kill-switch/master/build/kill-switch.bin
kill-switch.bin binary size 0xf0380 bytes. Smallest app partition is 0x100000 bytes. 0xfc80 bytes (6%) free.

It can be clearly seen that the function is never called in the second log