[fpc-devel] Linking not working anymore on latest trunk for target arm-freertos (plus fix)

Michael Ring mail at michael-ring.org
Sat Jul 4 09:33:06 CEST 2020


Hi, Linking on arm-freertos target did not work after the merge of some 
of Christo's fixes for esp32-freertos.

Here's the fix for the issue (also attached as diff), Florian, can you 
please check & apply this patch?


Thank you,

Michael


diff --git a/compiler/systems/t_freertos.pas 
b/compiler/systems/t_freertos.pas
index e8f5f8507d..742c71d4c5 100644
--- a/compiler/systems/t_freertos.pas
+++ b/compiler/systems/t_freertos.pas
@@ -82,9 +82,9 @@ begin
           '-L $IDF_PATH/components/esp_rom/esp32/ld '+
           '-T esp32.rom.ld -T esp32.rom.libgcc.ld -T 
esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T 
esp32.rom.newlib-funcs.ld '+
           '-L . -T esp32_out.ld -T esp32.project.ld '+
-         '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld'
-     else
-       ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC 
$GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
+         '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld';
+{$else}
+     ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC 
$GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
  {$endif xtensa}
     end;
  end;
@@ -1160,7 +1160,8 @@ begin
          success:=DoExec(binstr,cmdstr,true,false);
      end;

- 
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  if IDF_PATH <> '' then
+ 
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));

    GCSectionsStr:='--gc-sections';

-------------- next part --------------
diff --git a/compiler/systems/t_freertos.pas b/compiler/systems/t_freertos.pas
index e8f5f8507d..742c71d4c5 100644
--- a/compiler/systems/t_freertos.pas
+++ b/compiler/systems/t_freertos.pas
@@ -82,9 +82,9 @@ begin
          '-L $IDF_PATH/components/esp_rom/esp32/ld '+
          '-T esp32.rom.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld '+
          '-L . -T esp32_out.ld -T esp32.project.ld '+
-         '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld'
-     else
-       ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
+         '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld';
+{$else}
+     ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
 {$endif xtensa}
    end;
 end;
@@ -1160,7 +1160,8 @@ begin
         success:=DoExec(binstr,cmdstr,true,false);
     end;

-  Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  if IDF_PATH <> '' then
+    Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
   FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));

   GCSectionsStr:='--gc-sections';


More information about the fpc-devel mailing list