Commit Graph

2 Commits

Author SHA1 Message Date
Frantisek Hrbata
aaca1e20ea feat(cmakev2): preprocess linker scripts with component includes
Resolve #include lines in linker script templates against the linked
component graph: idf_build_library appends every linked component's
INCLUDE_DIRS to the C preprocessor invocation for each .in linker
script, so a template can include any component header (e.g. a ULP
memory-layout template including soc/soc.h) without the owning
component having to know about it.

Also:
- Always pass -I<config_dir> so templates can include sdkconfig.h.
- Add a FLAGS option to target_linker_script for explicit preprocessor
  flags (e.g. -D__ASSEMBLER__ or ld-snippet include dirs); when given,
  FLAGS replaces the parent-dir==target include heuristic for that
  script.
- Add a MEMORY option to target_linker_script that emits the marked
  linker script as -T before all others, so section-placement scripts
  in one component can reference MEMORY regions and REGION_ALIASes
  declared by a memory-layout script in another component.
- Make C-preprocessor comment keeping (-C) part of the default flag set
  rather than hardcoded, so FLAGS can drop it. linker_script_preprocessor
  no longer forces -C; both the cmakev1 and cmakev2 preprocessors add it
  to their default CFLAGS (output unchanged for existing scripts). A ULP
  template that includes soc/soc.h omits -C so ld does not choke on the
  header's // comments.
- Store per-script metadata (generated output, flags) in MD5-keyed
  component properties instead of parallel lists.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2026-07-15 09:14:35 +09:00
Alexey Lapshin
d9389ba082 change(bootloader): rename bootloader.ld -> bootloader.ld.in
This change passes file through compiler preprocessor which unlocks
future code refactoring.
2025-09-24 00:51:54 +08:00