323 Commits

Author SHA1 Message Date
Jaroslav Burian 4f0407e7c7 Merge branch 'fix/mmu-page-size-always-pass' into 'master'
change(esptool_py): always pass --flash-mmu-page-size to elf2image

Closes IDF-12220

See merge request espressif/esp-idf!47002
2026-04-09 17:31:43 +08:00
Radim Karniš 38d37e5e9f feat(idf_py): idf.py flash will reflash only changed data sectors by default
idf.py flash -a is introduced to trigger a flash of all data (not just changed sectors).
2026-04-02 10:59:30 +02:00
Radim Karniš c62515671d change(build): Rename Fast reflashing configuration to Minimize binary changes, make non-experimental 2026-04-02 10:53:32 +02:00
Jaroslav Burian 0a0e64749a change(esptool_py): always pass --flash-mmu-page-size to elf2image
Previously, --flash-mmu-page-size was only passed when the configured
MMU page size was not 64KB. This caused an issue for targets with a
configurable MMU page size whose non-64KB size is the actual default.

Remove the 64KB exclusion and always pass the argument for all targets,
including those without a configurable MMU page size. Since ESP-IDF now
always provides the value, esptool can also use it to change the
default MMU page size.
2026-03-25 12:35:09 +01:00
Mahavir Jain 21f8ca5e6f feat(app_update): add API for checking the spi mode compatibility
New API to check the SPI flash mode from the incoming firmware image
during OTA updates could prevent bootloader/app incompatibility of
DIO vs QIO flash modes.

More information:
 - https://github.com/espressif/esp-hosted-mcu/issues/143#issuecomment-3741753788
 - https://github.com/espressif/esp-idf/issues/9674#issuecomment-1232533757
 - https://github.com/espressif/esp-idf/issues/9542#issuecomment-1211317354
2026-02-10 12:53:50 +05:30
Frantisek Hrbata a034ef8713 feat(build): add initial configuration for fast reflashing
Introduce ESPTOOLPY_FAST_REFLASHING configuration option. It instructs
ldgen to group entity mappings for libraries deemed mutable (prone to
change) separately from those considered immutable (unlikely to change).

Organizing mutable and immutable libraries separately in the linker
script allows the linker to form larger contiguous blocks of data for
immutable libraries in the application's output sections. These blocks
are likely to stay mostly unchanged between application recompilations,
enabling them to be skipped during reflashing.

Separating mutable and immutable libraries in the linker script to
minimize changes in the output sections is insufficient. Padding is
added after the input sections of mutable libraries in the default data
and text output sections. This creates a buffer for the mutable
libraries, allowing additional changes to be made without altering the
layout of the binary image.

Additionally two optimizations currently in use can still mix data from
these libraries, leading to significant changes even within the grouped
immutable libraries.

1. constant merging

    Linker will try to merge input sections that have the MERGE and
    STRING flags from different libraries (object files) to perform
    optimizations like tail merging. For example, adding a string
    literal in a mutable library will also change the addresses of
    string literals from immutable libraries in such a merged section,
    causing changes in the generated code when those literals are
    referenced.

    Disabled with COMPILER_DISABLE_MERGE_CONSTANTS(-fno-merge-constants)

2. literal pools on Xtensa

    As optimization, the linker may merge literal pools from different
    libraries (object files) to improve the generated code size. This
    has the same effect as constant merging, and changes in mutable
    libraries may cause changes in the generated code for immutable
    libraries. To get larger unchanged continuous blocks in the text
    output sections for immutable libraries, we need to ensure that the
    Xtensa literal pools remain close to their references and are not
    merged.

    Disabled with CONFIG_COMPILER_ENABLE_TEXT_SECTION_LITERALS(-mtext-section-literals)

When ESPTOOLPY_FAST_REFLASHING is enabled, these two optimizations are
disabled to achieve larger unchaged continuous blocks for the grouped
immutable libraries, even though disabling these optimizations results
in slightly larger code.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2025-11-13 15:30:42 +01:00
Peter Dragun e3198fff3c feat: Update esptool to v5 2025-09-30 15:28:55 +02:00
Sudeep Mohanty b719292b75 refactor(build-system): Simplify flash target creation
This commit refactors the flash target creation. Now bootloader and
partition table components add dependencies to the flash target directly
from their component CMakeLists.txt files instead of it being done in
the esptool_py component. The commit also removes the redundant
__esptool_py_setup_main_flash_target() function.
2025-09-09 12:21:31 +02:00
Sudeep Mohanty 5eb8e746fc Merge branch 'fix/build_system_create_bin_gen_tgts' into 'master'
feat(build-system): Create build system hooks for post-elf processing

Closes IDFGH-16204

See merge request espressif/esp-idf!41097
2025-08-28 14:35:21 +02:00
Marek Fiala 9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
Sudeep Mohanty 4cfc196680 feat(build-system): Create build system hooks for post-ELF processing
This commit adds new CMake APIs for the build system, viz.,
idf_build_add_post_elf_dependency() and
idf_build_get_post_elf_dependencies().
These APIs allow components to add post-ELF processing hooks before the
binary file is generated.

Closes https://github.com/espressif/esp-idf/issues/17251
2025-08-15 12:22:47 +02:00
Sudeep Mohanty 5d9ee7cc1a fix(bootloader): Fixed bootloader secure boot target creation failure
This commit fixes an issue where the bootloader POST_BUILD target
depended on the signed bootloader image even if it is not created.
2025-07-21 09:40:41 +02:00
Sudeep Mohanty b6ea668e6e refactor(esptool_py): Removed global scope variables from esptool_py project_include.cmake
This commit global variables such as ESPTOOLPY, ESPSECUREPY, ESPEFUSEPY,
ESPMONITOR and ESPTOOLPY_CHIP from the project_include.cmake file of
esptool_py component. All other components which use these variables
have been updated to fetch the same from esptool_py component's
properties.
2025-07-10 11:26:28 +02:00
Sudeep Mohanty 8582294caf refactor(esptool_py): Move utility target creation to project level
This commit refactors the esptool_py component to provide utility
functions for creating utility targets such as erase_flash, merge-bin
and monitor.

The following changes were done in this commit:
- Added __esptool_py_setup_utility_targets() to create utility targets.
- Utility target creation now happens in idf_build_executable() in
  build.cmake.
- Removed more global scope processing and variables from esptool_py
  component project_include.cmake.
2025-07-10 11:26:28 +02:00
Sudeep Mohanty 3a1f34386c refactor(esptool_py): Move flasher_args.json generation to project level
This commit refactors the esptool_py component to move the
flasher_args.json file generation to the main project level cmake file
when idf_build_executable() runs.
2025-07-10 11:26:28 +02:00
Sudeep Mohanty 7c75795a0b refactor(esptool_py): Move binary generation to project level and add utility functions
This commit refactors the esptool_py component to provide utility
functions for binary file generation targets instead of creating the
targets. Binary generation targets are now moved to the respective
projects.

The following changes were done in this commit:
- Added __idf_build_binary() function to esptool_py to create the binary
  file generation target.
- Added __idf_build_secure_binary() as the secure boot equivalent of the
  above function.
- Top level project build now creates its own binary targets in
  idf_build_executable() in build.cmake.
- Bootloader and esp_tee subprojects create their binary file generation
  targets in their respective CMakeLists.txt files.
- All post-build targets such as the app_size_check target are now
  created by the respective projects and not esptool_py.
- General clean-up of the esptool_py cmake files.
2025-07-10 11:26:28 +02:00
Sudeep Mohanty ef4d6462e2 refactor(esptool_py): Move flash target creation to project level and add utility functions
This commit refactors the esptool_py component to provide utility
functions for flash target management instead of creating the targets
directly. Flash target creation is now moved to the project level in
build.cmake file when idf_build_executable() runs.

The following changes were done in this commit:
- Added __esptool_py_setup_tools(), __esptool_py_setup_estool_py_args()
  and __ensure_esptool_py_setup() functions to centralize esptool_py
  setup.
- Added __esptool_py_setup_main_flash_target() which is called by
  idf_build_executable() to create the flash targets.
- Updated esptool_py_flash_target(), esptool_py_custom_target() to
  accept an optional FILENAME_PREFIX argument to enable creation of
  build artifacts based on custom names.
- Create placeholder flash targets early in the build process when
  idf_build_process() is called for components to add dependencies on
  these targets.
- Moved app-flash target creation from esptool_py/CMakeLists.txt to
  build.cmake.
- Added function description to esptool_py functions.
2025-07-10 11:26:28 +02:00
armando 9b845f9f8b fix(flash): mutex between flash rom impl and flash opi 2025-03-20 15:32:21 +08:00
Mahavir Jain 3821d6cb97 fix(esp_tee): TEE otadata partition default encrypted for flash-enc case 2025-03-03 15:50:47 +08:00
Jaroslav Burian 64f4956d4f fix(esptool): Fix flush output while flashing
With the new esptool v5.0 the output is not flushed while flashing
the firmware. This commit fixes the issue by using python unbuffered mode.
2025-02-26 10:04:16 +01:00
harshal.patil eb05db30fc fix(esptool_py): Fix NVS partition being incorrectly marked as encrypted
- The CMake function esptool_py_partition_needs_encryption() in the esptool_py
component used to mark NVS partition as encrypted, instead it should have marked
the NVS keys partition as encrypted.
2025-01-29 18:51:28 +05:30
Laukik Hase 2dee5791a6 feat(esp_tee): Support for ESP-TEE - esptool_py, esp_rom & other components 2024-12-02 11:27:58 +05:30
Laukik Hase 5328dcd00c change(build): Add a new CMake flag NON_OS_BUILD for non-FreeRTOS builds 2024-10-21 19:03:30 +05:30
Roland Dobai 1143b7639f Merge branch 'fix/idfpy_uf2_fail' into 'master'
fix(uf2): Ignore ESPBAUD, ESPPORT when calling idf.py uf2[-app]

Closes IDF-10768

See merge request espressif/esp-idf!33086
2024-10-01 17:12:29 +08:00
Radim Karniš 8935ff4e6c Merge branch 'feat/idf_py_flash_trace' into 'master'
feat(idf_py): Allow tracing interactions during flashing with --trace

Closes IDF-9545

See merge request espressif/esp-idf!33656
2024-09-26 22:06:59 +08:00
Radim Karniš 4a04a9e95c feat(idf_py): Allow tracing interactions during flashing with --trace 2024-09-26 11:27:04 +02:00
Jan Beran d77d1f5a95 fix(uf2): Ignore ESPBAUD, ESPPORT when calling idf.py uf2[-app] 2024-09-23 15:48:59 +02:00
Jakub Kocka 12875d6f66 feat: Enable ESP32-C61 stub 2024-09-23 09:21:44 +02:00
Jaroslav Burian 82c8973add feat: Enable ESP32-C5 stub 2024-09-16 20:27:25 +08:00
Konstantin Kondrashov d2123cf531 fix(esptool_py): Check the size of the bootloader + signature block 2024-09-12 15:38:18 +08:00
C.S.M 44ff115557 refactor(spi_flash): Refactor the flash frequency config file 2024-09-11 14:13:26 +08:00
C.S.M fad2c740b1 feature(spi_flash): Promote the c61 mspi clock frequency from 40 to 80M 2024-08-22 10:58:50 +08:00
Song Ruo Jing 335d39b869 feat(clk): Add basic clock support for esp32c61
- Support SOC ROOT clock source switch
- Support CPU frequency change
- Support RTC SLOW clock source switch
- Support RTC SLOW clock + RC FAST calibration
- Remove FPGA build
2024-07-31 22:41:22 +08:00
Ondrej Kosta 4607cff1f9 fix(esptool): make 80MHZ Flash SPI speed not supported by v0.0 of P4 2024-07-19 15:04:14 +08:00
C.S.M d02758f56b feat(spi_flash): Increase flash frequency from 40M to 80M 2024-07-09 10:49:57 +08:00
Song Ruo Jing 40f3bc2e57 feat(clk): Add basic clock support for esp32c5 mp
- Support SOC ROOT clock source switch
- Support CPU frequency change
- Support RTC SLOW clock source switch
- Support RTC SLOW clock + RC FAST calibration
- Remove FPGA build
2024-06-26 14:26:34 +08:00
laokaiyao 21f870ecd5 remove(c5beta3): remove c5 beta3 system files 2024-06-17 12:02:15 +08:00
Roland Dobai af302c0bee Merge branch 'feat/add_merged_bin_cmd' into 'master'
feat(tools): Add idf.py merge-bin command and cmake target

See merge request espressif/esp-idf!29996
2024-04-22 17:55:36 +08:00
Jan Beran 0dec6fe65d feat(tools): Add idf.py merge-bin command and cmake target 2024-04-16 12:49:18 +02:00
Jakub Kocka 72896395f7 change(esptool_py/project_include): Updated esptool_elf2image_args
Since esptool v4.8 "--dont-append-digest" argument of elf2image is not needed anymore.
2024-04-11 09:33:48 +02:00
Nebojša Cvetković e96da70654 feat(esptool): merge_bin CMake target 2024-04-08 01:41:34 +01:00
wanlei 20c18ac52b feat(esp32c61): final introduce helloworld support 2024-04-02 10:50:52 +08:00
laokaiyao 1b91e84544 feat(esp32c5): add esp32c5 mp target 2024-03-01 10:13:45 +08:00
Jan Beran b1d9762205 feat: Propagate arguments when running ninja monitor 2024-01-31 09:35:44 +01:00
laokaiyao 3d459e423a feat(esp32c5): support esp32c5 beta3 48M xtal 2024-01-09 13:11:11 +08:00
Arno Moonen fec80b5d36 fix(build): fix build failure if CMAKE_EXECUTABLE_SUFFIX is set
From: Arno Moonen <arno.moonen@airios.eu>

Follows original message from Arno Moonen <arno.moonen@airios.eu>

While integrating the ESP-IDF into our existing CMake structure,
I've come across quite some hurdles. Most I've been able to fix
in our CMake files, however this one I could not.

Most of the targets created by the esptool_py component assume
that the EXECUTABLE IDF build property (which contains the name
of the CMake executable target) always equals the name of the
created binary.

This is however not always true. For instance, in our setup we use
CMAKE_EXECUTABLE_SUFFIX_C and CMAKE_EXECUTABLE_SUFFIX_CXX in our
toolchain file (both set to .elf). If we do add_executable(my_app),
the target binary file would actually be my_app.elf.

In order to fix this, I've updated it to use the TARGET_FILE generated
expression. That way we also no longer need the EXECUTABLE_DIR IDF build
property here.

I've fixed this on v5.0.1 (as that's the ESP-IDF version I'm currently
trying to integrate), but I assume it should be easy to apply the same
fix to newer versions and the master branch as well.

Note that this problem might exist in multiple places where EXECUTABLE
is being used. While going through the ESP-IDF code base, I even noticed
that a few places actually already seem to use the TARGET_FILE expression.
To be honest the property name might be somewhat confusing as well, as it
is actually the executable target.

Closes https://github.com/espressif/esp-idf/pull/12558
2023-11-16 08:14:19 +01:00
Xiao Xufeng 1f5fb3f921 spi_flash: fixed issue that enabling HPM-DC by default may cause app unable to restart 2023-10-24 10:38:08 +08:00
Jakob Hasse 548022fbe6 refactor(linux): excluded all non-Linux components from build
* All components which won't build (yet) on Linux are excluded.
  This enables switching to Linux in an application without
  explicitly setting COMPONENTS to main in the main
  CMakeLists.txt.
* ESP Timer provides headers for Linux now
* automatically disabling LWIP in Kconfig if it is not available

doc(linux): brought section
  "Component Linux/Mock Support Overview" up to date
2023-10-16 17:06:54 +08:00
Peter Dragun 9acf412a07 feat(tools): move uf2 generation to esptool 2023-10-09 15:38:30 +02:00
Armando c448597f24 kconfig: introduced CONFIG_IDF_ENV_BRINGUP for new chip bringup usage 2023-06-26 03:30:23 +00:00