@@ -1752,73 +1752,26 @@ def get_app_partition_offset(pt_table, pt_offset):
17521752 return factory_app_params .get ("offset" , "0x10000" )
17531753
17541754
1755- def preprocess_linker_file (src_ld_script , target_ld_script , config_dir = None , extra_include_dirs = None ):
1756- """
1757- Preprocess a linker script file (.ld.in) to generate the final .ld file.
1758- Supports both IDF 5.x (linker_script_generator.cmake) and IDF 6.x (linker_script_preprocessor.cmake).
1759-
1760- Args:
1761- src_ld_script: Source .ld.in file path
1762- target_ld_script: Target .ld file path
1763- config_dir: Configuration directory (defaults to BUILD_DIR/config for main app)
1764- extra_include_dirs: Additional include directories (list)
1765- """
1766- if config_dir is None :
1767- config_dir = str (Path (BUILD_DIR ) / "config" )
1768-
1769- # Convert all paths to forward slashes for CMake compatibility on Windows
1770- config_dir = fs .to_unix_path (config_dir )
1771- src_ld_script = fs .to_unix_path (src_ld_script )
1772- target_ld_script = fs .to_unix_path (target_ld_script )
1773-
1774- # Check IDF version to determine which CMake script to use
1775- framework_version_list = [int (v ) for v in get_framework_version ().split ("." )]
1776-
1777- # IDF 6.0+ uses linker_script_preprocessor.cmake with CFLAGS approach
1778- if framework_version_list [0 ] >= 6 :
1779- include_dirs = [f'"{ config_dir } "' ]
1780- include_dirs .append (f'"{ fs .to_unix_path (str (Path (FRAMEWORK_DIR ) / "components" / "esp_system" / "ld" ))} "' )
1781-
1782- if extra_include_dirs :
1783- include_dirs .extend (f'"{ fs .to_unix_path (dir_path )} "' for dir_path in extra_include_dirs )
1784-
1785- cflags_value = "-I" + " -I" .join (include_dirs )
1786-
1787- return env .Command (
1788- target_ld_script ,
1789- src_ld_script ,
1790- env .VerboseAction (
1791- " " .join ([
1792- f'"{ CMAKE_DIR } "' ,
1793- f'-DCC="{ fs .to_unix_path (str (Path (TOOLCHAIN_DIR ) / "bin" / "$CC" ))} "' ,
1794- f'-DSOURCE="{ src_ld_script } "' ,
1795- f'-DTARGET="{ target_ld_script } "' ,
1796- f'-DCFLAGS="{ cflags_value } "' ,
1797- "-P" ,
1798- f'"{ fs .to_unix_path (str (Path (FRAMEWORK_DIR ) / "tools" / "cmake" / "linker_script_preprocessor.cmake" ))} "' ,
1799- ]),
1800- "Generating LD script $TARGET" ,
1801- ),
1802- )
1803- else :
1804- # IDF 5.x: Use legacy linker_script_generator.cmake method
1805- return env .Command (
1806- target_ld_script ,
1807- src_ld_script ,
1808- env .VerboseAction (
1809- " " .join ([
1755+ def preprocess_linker_file (src_ld_script , target_ld_script ):
1756+ return env .Command (
1757+ target_ld_script ,
1758+ src_ld_script ,
1759+ env .VerboseAction (
1760+ " " .join (
1761+ [
18101762 f'"{ CMAKE_DIR } "' ,
18111763 f'-DCC="{ str (Path (TOOLCHAIN_DIR ) / "bin" / "$CC" )} "' ,
18121764 "-DSOURCE=$SOURCE" ,
18131765 "-DTARGET=$TARGET" ,
1814- f'-DCONFIG_DIR="{ config_dir } "' ,
1766+ f'-DCONFIG_DIR="{ str ( Path ( BUILD_DIR ) / "config" ) } "' ,
18151767 f'-DLD_DIR="{ str (Path (FRAMEWORK_DIR ) / "components" / "esp_system" / "ld" )} "' ,
18161768 "-P" ,
18171769 f'"{ str (Path ("$BUILD_DIR" ) / "esp-idf" / "esp_system" / "ld" / "linker_script_generator.cmake" )} "' ,
1818- ]),
1819- "Generating LD script $TARGET" ,
1770+ ]
18201771 ),
1821- )
1772+ "Generating LD script $TARGET" ,
1773+ ),
1774+ )
18221775
18231776
18241777def generate_mbedtls_bundle (sdk_config ):
0 commit comments