change(build): Rename Fast reflashing configuration to Minimize binary changes, make non-experimental

This commit is contained in:
Radim Karniš
2026-04-02 10:53:32 +02:00
parent 5ad07fe0f3
commit c62515671d
6 changed files with 79 additions and 74 deletions
+9 -9
View File
@@ -116,23 +116,23 @@ ASSERT((ADDR(NEXT_SECTION) == ADDR(PREV_SECTION) + SIZEOF(PREV_SECTION)), \
#endif
/*
* FAST_REFLASHING_PADDING
* APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING
*
* Aligns the current location (.) to CONFIG_ESPTOOLPY_FAST_REFLASHING_PADDING.
* Aligns the current location (.) to CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING.
* If more than half of the alignment block is already consumed,
* extra padding is applied to skip to the next boundary.
* For example, if the current location (.) is 0x1900 and the padding is 4 KB,
* the location will be moved to 0x3000 instead of 0x2000 because less than
* half of the current 4 KB block remains (0x2000 - 0x1900 < 2 KB).
*/
#if CONFIG_ESPTOOLPY_FAST_REFLASHING
#define FAST_REFLASHING_PADDING() \
#if CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES
#define APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING() \
. = ALIGN((. + ( \
(CONFIG_ESPTOOLPY_FAST_REFLASHING_PADDING - (ALIGN(CONFIG_ESPTOOLPY_FAST_REFLASHING_PADDING) - .)) + \
(CONFIG_ESPTOOLPY_FAST_REFLASHING_PADDING / 2) \
)), CONFIG_ESPTOOLPY_FAST_REFLASHING_PADDING);
(CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING - (ALIGN(CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING) - .)) + \
(CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING / 2) \
)), CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING);
#else
#define FAST_REFLASHING_PADDING()
#define APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING()
#endif
#if CONFIG_LIBC_PICOLIBC
@@ -153,4 +153,4 @@ ASSERT((ADDR(NEXT_SECTION) == ADDR(PREV_SECTION) + SIZEOF(PREV_SECTION)), \
#define SECTION_MAPPINGS_WITH_PADDING(SECTION_NAME) \
\n SECTION_MAPPINGS(SECTION_NAME) \
\n FAST_REFLASHING_PADDING()
\n APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING()
+1 -1
View File
@@ -95,7 +95,7 @@
mapping[dram0_data]
mutable[dram0_data]
FAST_REFLASHING_PADDING();
APP_BUILD_MINIMIZE_BINARY_CHANGES_PADDING();
_data_end_high = ABSOLUTE(.);
} > dram_high_seg
-60
View File
@@ -214,64 +214,4 @@ menu "Serial flasher config"
default ESP_CONSOLE_UART_BAUDRATE if ESP_CONSOLE_UART
default 115200 if !ESP_CONSOLE_UART
menu "Fast Reflashing"
config ESPTOOLPY_FAST_REFLASHING
bool "Enable fast reflashing (Experimental)"
depends on IDF_EXPERIMENTAL_FEATURES
select COMPILER_NO_MERGE_CONSTANTS if IDF_TOOLCHAIN_GCC
help
Enabling this option classifies component libraries into two
categories: mutable and immutable. Mutable libraries are
expected to change frequently during development, while
immutable libraries are considered stable. All project
component libraries are treated as mutable; all other libraries
are treated as immutable.
In the generated linker script, input sections from immutable
libraries are placed before those from mutable libraries. This
layout helps localize changes in the output sections of the ELF
file, so that recompilation primarily affects a confined area
associated with the mutable libraries.
This enables the generation of binary images with large
unmodified regions across recompilations, allowing to flash
only the parts that have changed.
To support this, some compiler optimizations, such as constant
merging, are disabled, which helps minimize differences in the
binary image between builds. However, this may increase the
overall image size and flash usage.
Additionally, this option inserts a padding, defined by the
ESPTOOLPY_FAST_REFLASHING_PADDING option, after the input
sections of mutable libraries. This allows further isolate
changes but also increases the size of the binary image and
flash consumption.
choice ESPTOOLPY_FAST_REFLASHING_PADDING_SIZE
prompt "Padding size"
default ESPTOOLPY_FAST_REFLASHING_PADDING_4KB
depends on ESPTOOLPY_FAST_REFLASHING
help
Selects the amount of padding (in kilobytes) to add after input
sections of mutable libraries when fast reflashing is enabled.
config ESPTOOLPY_FAST_REFLASHING_PADDING_2KB
bool "2 KB"
config ESPTOOLPY_FAST_REFLASHING_PADDING_4KB
bool "4 KB"
config ESPTOOLPY_FAST_REFLASHING_PADDING_8KB
bool "8 KB"
endchoice
config ESPTOOLPY_FAST_REFLASHING_PADDING
int
depends on ESPTOOLPY_FAST_REFLASHING
default 2048 if ESPTOOLPY_FAST_REFLASHING_PADDING_2KB
default 4096 if ESPTOOLPY_FAST_REFLASHING_PADDING_4KB
default 8192 if ESPTOOLPY_FAST_REFLASHING_PADDING_8KB
endmenu
endmenu