@@ -345,7 +345,7 @@ def _add_archive(archive_path, link_args):
345
345
if fragment .startswith ("-l" ):
346
346
link_args ["LIBS" ].extend (args )
347
347
elif fragment .startswith ("-L" ):
348
- lib_path = fragment .replace ("-L" , "" ).strip ()
348
+ lib_path = fragment .replace ("-L" , "" ).strip (" ' \" " )
349
349
_add_to_libpath (lib_path , link_args )
350
350
elif fragment .startswith ("-" ) and not fragment .startswith ("-l" ):
351
351
# CMake mistakenly marks LINKFLAGS as libraries
@@ -482,22 +482,15 @@ def extract_linker_script_fragments(framework_components_dir, sdk_config):
482
482
if mcu == "esp32c3" :
483
483
result .append (os .path .join (framework_components_dir , "riscv" , "linker.lf" ))
484
484
485
- result .extend (
486
- [
487
- os .path .join (
488
- framework_components_dir ,
489
- idf_variant ,
490
- "ld" ,
491
- "%s_fragments.lf" % idf_variant ,
492
- ),
493
- os .path .join (
494
- framework_components_dir ,
495
- idf_variant ,
496
- "linker.lf" ,
497
- ),
498
- os .path .join (framework_components_dir , "newlib" , "newlib.lf" ),
499
- ]
500
- )
485
+ # Add extra linker fragments
486
+ for fragment in (
487
+ os .path .join ("esp_system" , "app.lf" ),
488
+ os .path .join ("esp_common" , "common.lf" ),
489
+ os .path .join ("esp_common" , "soc.lf" ),
490
+ os .path .join ("newlib" , "system_libs.lf" ),
491
+ os .path .join ("newlib" , "newlib.lf" ),
492
+ ):
493
+ result .append (os .path .join (framework_components_dir , fragment ))
501
494
502
495
if sdk_config .get ("SPIRAM_CACHE_WORKAROUND" , False ):
503
496
result .append (
@@ -580,13 +573,14 @@ def generate_project_ld_script(sdk_config, ignore_targets=None):
580
573
).format (** args )
581
574
582
575
return env .Command (
583
- os .path .join ("$BUILD_DIR" , "%s.project. ld" % idf_variant ),
576
+ os .path .join ("$BUILD_DIR" , "sections. ld" ),
584
577
os .path .join (
585
578
FRAMEWORK_DIR ,
586
579
"components" ,
587
- idf_variant ,
580
+ "esp_system" ,
588
581
"ld" ,
589
- "%s.project.ld.in" % idf_variant ,
582
+ idf_variant ,
583
+ "sections.ld.in" ,
590
584
),
591
585
env .VerboseAction (cmd , "Generating project linker script $TARGET" ),
592
586
)
@@ -1115,22 +1109,23 @@ def _get_installed_pip_packages():
1115
1109
#
1116
1110
1117
1111
if not board .get ("build.ldscript" , "" ):
1112
+ linker_common = os .path .join (FRAMEWORK_DIR , "components" , "esp_system" , "ld" )
1118
1113
linker_script = env .Command (
1119
- os .path .join ("$BUILD_DIR" , "%s_out .ld" % idf_variant ),
1114
+ os .path .join ("$BUILD_DIR" , "memory .ld" ),
1120
1115
board .get (
1121
1116
"build.esp-idf.ldscript" ,
1122
1117
os .path .join (
1123
- FRAMEWORK_DIR , "components" , idf_variant , "ld" , "%s .ld" % idf_variant
1118
+ FRAMEWORK_DIR , "components" , "esp_system" , "ld" , idf_variant , "memory .ld.in"
1124
1119
),
1125
1120
),
1126
1121
env .VerboseAction (
1127
- '$CC -I"$BUILD_DIR/config" -C -P -x c -E $SOURCE -o $TARGET' ,
1122
+ f '$CC -I"$BUILD_DIR/config" -I" { linker_common } " -C -P -x c -E $SOURCE -o $TARGET' ,
1128
1123
"Generating LD script $TARGET" ,
1129
1124
),
1130
1125
)
1131
1126
1132
1127
env .Depends ("$BUILD_DIR/$PROGNAME$PROGSUFFIX" , linker_script )
1133
- env .Replace (LDSCRIPT_PATH = "%s_out .ld" % idf_variant )
1128
+ env .Replace (LDSCRIPT_PATH = "memory .ld" )
1134
1129
1135
1130
#
1136
1131
# Generate partition table
@@ -1316,7 +1311,7 @@ def _get_installed_pip_packages():
1316
1311
1317
1312
# remove the main linker script flags '-T esp32_out.ld'
1318
1313
try :
1319
- ld_index = extra_flags .index ("%s_out .ld" % idf_variant )
1314
+ ld_index = extra_flags .index ("memory .ld" )
1320
1315
extra_flags .pop (ld_index )
1321
1316
extra_flags .pop (ld_index - 1 )
1322
1317
except :
0 commit comments