mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-31 01:56:31 +03:00
Introduce a new `--mutable-libraries-file` option that accepts a file containing the filenames of mutable libraries, each listed on a separate line. Mutable libraries are component libraries expected to change during development. In contrast, immutable component libraries are not expected to change. In the generated linker script, the input sections of mutable libraries are grouped together rather than being mixed with those of immutable libraries. The goal is to create large continuous areas in the ELF file's output sections that remain unchanged for immutable libraries during application recompilation, allowing these areas to be skipped during flashing. The build system identifies the mutable libraries and passes them to ldgen using the `--mutable-libraries-file` option. It maintains information about component sources, one of which is `project_components`. This source type identifies components that are directly related to the project being developed and are very likely to change. Mappings for mutable libraries are explicitly created for all sections in the default scheme. This happens before the entity `(archive:object_file:symbol/input_section)` node tree with placements is generated and is equivalent to having these mappings in the mapping linker fragment. All placements for mappings, whether newly added or already existing as defined in linker fragments, associated with mutable libraries are flagged as `mutable` in the entity node tree. This flag ensures that these placements are included in the final linker script. Currently, ldgen only emits placements that are either significant or forced. A placement is considered significant if, for example, it is not already covered by a placement in parent node. For instance, `*(.iram1 .iram1.*)` placement already includes `*libapp_trace.a:(.iram1 .iram1.*)`, so the latter is not emitted by default. The `mutable` flag ensures that placements for mutable libraries are emitted in the linker script and placed at dedicated location. The locations where placements for mutable libraries are specified in the linker script are identified by a new `mutable` marker, for example, `mutable[flash_text]`. The placements for immutable libraries remain in the existing `mapping` marker, for example, `mapping[flash_text]`. The `mutable` marker for each target is placed after the `mapping` marker. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>