@@ -1532,9 +1532,6 @@ def build_bootloader(sdk_config):
15321532 "-DPROJECT_SOURCE_DIR=" + PROJECT_DIR ,
15331533 "-DLEGACY_INCLUDE_COMMON_HEADERS=" ,
15341534 "-DEXTRA_COMPONENT_DIRS=" + str (Path (FRAMEWORK_DIR ) / "components" / "bootloader" ),
1535- f"-DESP_IDF_VERSION={ major_version } " ,
1536- f"-DESP_IDF_VERSION_MAJOR={ framework_version .split ('.' )[0 ]} " ,
1537- f"-DESP_IDF_VERSION_MINOR={ framework_version .split ('.' )[1 ]} " ,
15381535 ],
15391536 )
15401537
@@ -1575,84 +1572,7 @@ def build_bootloader(sdk_config):
15751572 )
15761573
15771574 bootloader_env .MergeFlags (link_args )
1578-
1579- # Handle ESP-IDF 6.0 linker script preprocessing for .ld.in files
1580- # In bootloader context, only .ld.in templates exist and need preprocessing
1581- processed_extra_flags = []
1582-
1583- # Bootloader preprocessing configuration
1584- bootloader_config_dir = str (Path (BUILD_DIR ) / "bootloader" / "config" )
1585- bootloader_extra_includes = [
1586- str (Path (FRAMEWORK_DIR ) / "components" / "bootloader" / "subproject" / "main" / "ld" / idf_variant )
1587- ]
1588-
1589- i = 0
1590- while i < len (extra_flags ):
1591- if extra_flags [i ] == "-T" and i + 1 < len (extra_flags ):
1592- linker_script = extra_flags [i + 1 ]
1593-
1594- # Process .ld.in templates directly
1595- if linker_script .endswith (".ld.in" ):
1596- script_name = os .path .basename (linker_script ).replace (".ld.in" , ".ld" )
1597- target_script = str (Path (BUILD_DIR ) / "bootloader" / script_name )
1598-
1599- preprocessed_script = preprocess_linker_file (
1600- linker_script ,
1601- target_script ,
1602- config_dir = bootloader_config_dir ,
1603- extra_include_dirs = bootloader_extra_includes
1604- )
1605-
1606- bootloader_env .Depends ("$BUILD_DIR/bootloader.elf" , preprocessed_script )
1607- processed_extra_flags .extend (["-T" , target_script ])
1608- # Handle .ld files - prioritize using original scripts when available
1609- elif linker_script .endswith (".ld" ):
1610- script_basename = os .path .basename (linker_script )
1611-
1612- # Check if the original .ld file exists in framework and use it directly
1613- original_script_path = str (Path (FRAMEWORK_DIR ) / "components" / "bootloader" / "subproject" / "main" / "ld" / idf_variant / script_basename )
1614-
1615- if os .path .isfile (original_script_path ):
1616- # Use the original script directly - no preprocessing needed
1617- processed_extra_flags .extend (["-T" , original_script_path ])
1618- else :
1619- # Only generate from template if no original .ld file exists
1620- script_name_in = script_basename .replace (".ld" , ".ld.in" )
1621- bootloader_script_in_path = str (Path (FRAMEWORK_DIR ) / "components" / "bootloader" / "subproject" / "main" / "ld" / idf_variant / script_name_in )
1622-
1623- # ESP32-P4 specific: Check for bootloader.rev3.ld.in
1624- if idf_variant == "esp32p4" and script_basename == "bootloader.ld" :
1625- sdk_config = get_sdk_configuration ()
1626- if sdk_config .get ("ESP32P4_REV_MIN_300" , False ):
1627- bootloader_rev3_path = str (Path (FRAMEWORK_DIR ) / "components" / "bootloader" / "subproject" / "main" / "ld" / idf_variant / "bootloader.rev3.ld.in" )
1628- if os .path .isfile (bootloader_rev3_path ):
1629- bootloader_script_in_path = bootloader_rev3_path
1630-
1631- # Preprocess the .ld.in template to generate the .ld file
1632- if os .path .isfile (bootloader_script_in_path ):
1633- target_script = str (Path (BUILD_DIR ) / "bootloader" / script_basename )
1634-
1635- preprocessed_script = preprocess_linker_file (
1636- bootloader_script_in_path ,
1637- target_script ,
1638- config_dir = bootloader_config_dir ,
1639- extra_include_dirs = bootloader_extra_includes
1640- )
1641-
1642- bootloader_env .Depends ("$BUILD_DIR/bootloader.elf" , preprocessed_script )
1643- processed_extra_flags .extend (["-T" , target_script ])
1644- else :
1645- # Pass through if neither original nor template found (e.g., ROM scripts)
1646- processed_extra_flags .extend (["-T" , linker_script ])
1647- else :
1648- # Pass through any other linker flags unchanged
1649- processed_extra_flags .extend (["-T" , linker_script ])
1650- i += 2
1651- else :
1652- processed_extra_flags .append (extra_flags [i ])
1653- i += 1
1654-
1655- bootloader_env .Append (LINKFLAGS = processed_extra_flags )
1575+ bootloader_env .Append (LINKFLAGS = extra_flags )
16561576 bootloader_libs = find_lib_deps (components_map , elf_config , link_args )
16571577
16581578 bootloader_env .Prepend (__RPATH = "-Wl,--start-group " )
0 commit comments