View Issue Details

IDProjectCategoryView StatusLast Update
0037335FPCCompilerpublic2020-07-12 10:34
ReporterChristo Crause Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version3.3.1 
Summary0037335: Xtensa [patch] ESP8266 support for t_freertos.pas
DescriptionAttached patch adds ESP8266 controller support to t_freertos.pas.

The patch follows the ESP32 logic as far as possible. A little bit more detail from the SDK is required to resolve all the linker script symbols, in particular a couple of Kconfig files needs to be passed to ldgen.py to relocate some of the library code in the linker script. If not included some symbols become unreachable during linking. Other details:
- Enclose all Xtensa specific code in ifdefs.
- Resolve IDF_PATH environment variable at start of MakeExecutable and store in a variable for reuse.
- Sdkconfig.h and config.env now gets overwritten every time because the information stored is controller specific.
- Replaced hardcoded binutlis prefix with FindUtil (credit: Alfred in 0037308).
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Christo Crause

2020-07-12 10:02

reporter  

t_freertos.patch (20,422 bytes)   
Index: t_freertos.pas
===================================================================
--- t_freertos.pas	(revision 45742)
+++ t_freertos.pas	(working copy)
@@ -46,8 +46,6 @@
           function postprocessexecutable(const fn : string;isdll:boolean):boolean;
        end;
 
-       var
-         IDF_PATH: string;
 
 {*****************************************************************************
                                   TlinkerEmbedded
@@ -73,21 +71,7 @@
   platform_select='';
 {$endif}
 begin
-  with Info do
-   begin
-{$ifdef xtensa}
-     if target_info.system=system_xtensa_freertos then
-       ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES '+
-         '-u call_user_start_cpu0 -u ld_include_panic_highint_hdl -u esp_app_desc -u vfs_include_syscalls_impl -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u newlib_include_locks_impl -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u app_main -u uxTopUsedPriority '+
-         '-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
-{$else}
-       ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
-{$endif xtensa}
-   end;
+  Info.ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
 end;
 
 
@@ -960,15 +944,16 @@
   t: Text;
   hp: TCmdStrListItem;
   filepath: TCmdStr;
+  {$ifdef XTENSA}
+  IdfPath: TCmdStr;
+  {$endif XTENSA}
 begin
-  IDF_PATH:='';
-{$ifdef xtensa}
-  if (target_info.system=system_xtensa_freertos) then
-    if (current_settings.controllertype = ct_esp32) then
-      IDF_PATH := 'IDF_PATH'
-    else
-      IDF_PATH := 'IDF_PATH8266';
-{$endif xtensa}
+{$ifdef XTENSA}
+  if (current_settings.controllertype = ct_esp32) then
+    IdfPath := trim(GetEnvironmentVariable('IDF_PATH'))
+  else
+    IdfPath := trim(GetEnvironmentVariable('IDF_PATH8266'));
+{$endif XTENSA}
 
   { for future use }
   StaticStr:='';
@@ -979,194 +964,256 @@
   success:=true;
   Result:=false;
 
-  if target_info.system=system_xtensa_freertos then
+  {$ifdef XTENSA}
+  { generate a sdkconfig.h if none is provided,
+    only a few fields are provided to far }
+  if not(Sysutils.FileExists('sdkconfig.h')) then
     begin
-      { generate a sdkconfig.h if none is provided,
-        only a few fields are provided to far }
-      if not(Sysutils.FileExists('sdkconfig.h')) then
+      Assign(t,'sdkconfig.h');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
+
+      if (current_settings.controllertype = ct_esp32) then
         begin
-          Assign(t,'sdkconfig.h');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
           writeln(t,'#pragma once');
           writeln(t,'#define CONFIG_APP_BUILD_USE_FLASH_SECTIONS 1');
           writeln(t,'#define CONFIG_BT_RESERVE_DRAM 0x0');
           writeln(t,'#define CONFIG_ESP32_ULP_COPROC_RESERVE_MEM 0');
           writeln(t,'#define CONFIG_ESP32_TRACEMEM_RESERVE_DRAM 0x0');
-
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
+        end
+      else
+        begin
+          // TODO: APP_OFFSET & APP_SIZE depends on partition table
+          // Default for partition table: Single factory app, no OTA
+          writeln(t,'#define APP_OFFSET 0x10000');
+          writeln(t,'#define APP_SIZE 0xf0000');
+          // Include build version of sdkconfig.h for custom configuration, if available
+          S:=IdfPath+'/libs/sdkconfig.h';
+          if SysUtils.FileExists(S) then
+            writeln(t,'#include "'+S+'"')
+          else
+            // Assume SOC_FULL_ICACHE option not selected (default)
+            writeln(t,'#define CONFIG_SOC_IRAM_SIZE 0xC000');
         end;
 
-      { generate an sdkconfig if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('sdkconfig')) then
-        begin
-          Assign(t,'sdkconfig');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an sdkconfig if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('sdkconfig')) then
+    begin
+      Assign(t,'sdkconfig');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an Kconfig if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('Kconfig')) then
-        begin
-          Assign(t,'Kconfig');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an Kconfig if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('Kconfig')) then
+    begin
+      Assign(t,'Kconfig');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an Kconfig.projbuild if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('Kconfig.projbuild')) then
-        begin
-          Assign(t,'Kconfig.projbuild');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an Kconfig.projbuild if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('Kconfig.projbuild')) then
+    begin
+      Assign(t,'Kconfig.projbuild');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an kconfigs.in if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('kconfigs.in')) then
-        begin
-          Assign(t,'kconfigs.in');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an kconfigs.in if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('kconfigs.in')) then
+    begin
+      Assign(t,'kconfigs.in');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an kconfigs_projbuild.in if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('kconfigs_projbuild.in')) then
-        begin
-          Assign(t,'kconfigs_projbuild.in');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an kconfigs_projbuild.in if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('kconfigs_projbuild.in')) then
+    begin
+      Assign(t,'kconfigs_projbuild.in');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate a config.env if none is provided,
-        COMPONENT_KCONFIGS and COMPONENT_KCONFIGS_PROJBUILD are dummy fields and might
-        be needed to be filed properly }
-      if not(Sysutils.FileExists('config.env')) then
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
+
+  { generate a config.env if none is provided,
+    COMPONENT_KCONFIGS and COMPONENT_KCONFIGS_PROJBUILD are dummy fields and might
+    be needed to be filed properly }
+  //if not(Sysutils.FileExists('config.env')) then
+    begin
+      Assign(t,'config.env');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
+
+      writeln(t,'{');
+      if (current_settings.controllertype = ct_esp32) then
         begin
-          Assign(t,'config.env');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
-
-          writeln(t,'{');
           writeln(t,'    "COMPONENT_KCONFIGS": "Kconfig",');
           writeln(t,'    "COMPONENT_KCONFIGS_PROJBUILD": "Kconfig.projbuild",');
           writeln(t,'    "IDF_CMAKE": "y",');
           writeln(t,'    "IDF_TARGET": "esp32",');
-          writeln(t,'    "IDF_PATH": "'+GetEnvironmentVariable('IDF_PATH')+'",');
+          writeln(t,'    "IDF_PATH": "'+IdfPath+'",');
           writeln(t,'    "COMPONENT_KCONFIGS_SOURCE_FILE": "kconfigs.in",');
           writeln(t,'    "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE": "kconfigs_projbuild.in"');
-          writeln(t,'}');
-
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
-
-      { generate ldgen_libraries }
-      Assign(t,'ldgen_libraries');
-      {$push}{$I-}
-      Rewrite(t);
-      if ioresult<>0 then
-        exit;
-
-      hp:=TCmdStrListItem(StaticLibFiles.First);
-      while assigned(hp) do
+        end
+      else
         begin
-          FindLibraryFile(hp.Str,target_info.staticClibprefix,target_info.staticClibext,filepath);
-          writeln(t,filepath);
-          hp:=TCmdStrListItem(hp.Next);
+          writeln(t,'    "IDF_PATH": "'+IdfPath+'",');
+          writeln(t,'    "IDF_TARGET": "esp8266",');
+          writeln(t,'    "IDF_CMAKE": "n"');
         end;
+      writeln(t,'}');
 
       Close(t);
       if ioresult<>0 then
         exit;
       {$pop}
+    end;
 
-      binstr:='xtensa-esp32-elf-gcc';
-      cmdstr:='-C -P -x c -E -o esp32_out.ld -I . $IDF_PATH/components/esp32/ld/esp32.ld';
+  { generate ldgen_libraries }
+  Assign(t,'ldgen_libraries');
+  {$push}{$I-}
+  Rewrite(t);
+  if ioresult<>0 then
+    exit;
 
-      Replace(binstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      Replace(cmdstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      success:=DoExec(binstr,cmdstr,true,true);
-
-      { generate linker maps for esp32 }
-      binstr:='$IDF_PATH/tools/ldgen/ldgen.py';
-      cmdstr:='--config sdkconfig --fragments $IDF_PATH/components/xtensa/linker.lf $IDF_PATH/components/soc/linker.lf $IDF_PATH/components/esp_event/linker.lf '+
-        '$IDF_PATH/components/spi_flash/linker.lf $IDF_PATH/components/esp_wifi/linker.lf $IDF_PATH/components/lwip/linker.lf '+
-        '$IDF_PATH/components/heap/linker.lf $IDF_PATH/components/esp_ringbuf/linker.lf $IDF_PATH/components/espcoredump/linker.lf $IDF_PATH/components/esp32/linker.lf '+
-        '$IDF_PATH/components/esp32/ld/esp32_fragments.lf $IDF_PATH/components/freertos/linker.lf $IDF_PATH/components/newlib/newlib.lf '+
-        '$IDF_PATH/components/esp_gdbstub/linker.lf '+
-        '--input $IDF_PATH/components/esp32/ld/esp32.project.ld.in --output ./esp32.project.ld --kconfig $IDF_PATH/Kconfig --env-file config.env '+
-        '--libraries-file ldgen_libraries --objdump xtensa-esp32-elf-objdump';
-      Replace(binstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      Replace(cmdstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      if success and not(cs_link_nolink in current_settings.globalswitches) then
-        success:=DoExec(binstr,cmdstr,true,false);
+  hp:=TCmdStrListItem(StaticLibFiles.First);
+  while assigned(hp) do
+    begin
+      FindLibraryFile(hp.Str,target_info.staticClibprefix,target_info.staticClibext,filepath);
+      writeln(t,filepath);
+      hp:=TCmdStrListItem(hp.Next);
     end;
 
-  if IDF_PATH <> '' then
-    Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  Close(t);
+  if ioresult<>0 then
+    exit;
+  {$pop}
+
+  binstr:='gcc';
+  if (current_settings.controllertype = ct_esp32) then
+    cmdstr:='-C -P -x c -E -o esp32_out.ld -I . $IDF_PATH/components/esp32/ld/esp32.ld'
+  else
+    cmdstr:='-C -P -x c -E -o esp8266_out.ld -I . $IDF_PATH/components/esp8266/ld/esp8266.ld';
+  Replace(cmdstr,'$IDF_PATH',IdfPath);
+  success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,true);
+
+  { generate linker maps }
+  binstr:='$IDF_PATH/tools/ldgen/ldgen.py';
+  if (current_settings.controllertype = ct_esp32) then
+    cmdstr:='--config sdkconfig '+
+            '--fragments $IDF_PATH/components/xtensa/linker.lf $IDF_PATH/components/soc/linker.lf $IDF_PATH/components/esp_event/linker.lf '+
+            '$IDF_PATH/components/spi_flash/linker.lf $IDF_PATH/components/esp_wifi/linker.lf $IDF_PATH/components/lwip/linker.lf '+
+            '$IDF_PATH/components/heap/linker.lf $IDF_PATH/components/esp_ringbuf/linker.lf $IDF_PATH/components/espcoredump/linker.lf $IDF_PATH/components/esp32/linker.lf '+
+            '$IDF_PATH/components/esp32/ld/esp32_fragments.lf $IDF_PATH/components/freertos/linker.lf $IDF_PATH/components/newlib/newlib.lf '+
+            '$IDF_PATH/components/esp_gdbstub/linker.lf '+
+            '--input $IDF_PATH/components/esp32/ld/esp32.project.ld.in '+
+            '--output ./esp32.project.ld '+
+            '--kconfig $IDF_PATH/Kconfig '+
+            '--env-file config.env '+
+            '--libraries-file ldgen_libraries '+
+            '--objdump xtensa-esp32-elf-objdump'
+  else
+    cmdstr:='--config sdkconfig '+
+            '--fragments $IDF_PATH/components/esp8266/ld/esp8266_fragments.lf '+
+            '$IDF_PATH/components/esp8266/ld/esp8266_bss_fragments.lf $IDF_PATH/components/esp8266/linker.lf '+
+            '$IDF_PATH/components/freertos/linker.lf $IDF_PATH/components/log/linker.lf '+
+            '$IDF_PATH/components/lwip/linker.lf $IDF_PATH/components/spi_flash/linker.lf '+
+            '--env "COMPONENT_KCONFIGS_PROJBUILD=  $IDF_PATH/components/bootloader/Kconfig.projbuild '+
+            '$IDF_PATH/components/esptool_py/Kconfig.projbuild  $IDF_PATH/components/partition_table/Kconfig.projbuild"'+
+            '--env "COMPONENT_KCONFIGS=$IDF_PATH/components/app_update/Kconfig '+
+            '$IDF_PATH/components/esp8266/Kconfig  $IDF_PATH/components/freertos/Kconfig '+
+            '$IDF_PATH/components/log/Kconfig $IDF_PATH/components/lwip/Kconfig" '+
+            '--input $IDF_PATH/components/esp8266/ld/esp8266.project.ld.in '+
+            '--output ./esp8266.project.ld '+
+            '--kconfig $IDF_PATH/Kconfig '+
+            '--env-file config.env '+
+            '--libraries-file ldgen_libraries '+
+            '--objdump xtensa-lx106-elf-objdump';
+
+  Replace(binstr,'$IDF_PATH',IdfPath);
+  Replace(cmdstr,'$IDF_PATH',IdfPath);
+  if success and not(cs_link_nolink in current_settings.globalswitches) then
+    success:=DoExec(binstr,cmdstr,true,false);
+
+  if (current_settings.controllertype = ct_esp32) then
+    Info.ExeCmd[1] := Info.ExeCmd[1]+' -u call_user_start_cpu0 -u ld_include_panic_highint_hdl -u esp_app_desc -u vfs_include_syscalls_impl -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u newlib_include_locks_impl '+
+       '-u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u app_main -u uxTopUsedPriority '+
+       '-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
+    Info.ExeCmd[1] := Info.ExeCmd[1]+' -u call_user_start -u g_esp_sys_info -u _printf_float -u _scanf_float '+
+      '-L $IDF_PATH/components/esp8266/ld -T esp8266.peripherals.ld -T esp8266.rom.ld '+ // SDK scripts
+      '-L . -T esp8266_out.ld -T esp8266.project.ld'; // Project scripts
+
+  Replace(Info.ExeCmd[1],'$IDF_PATH',IdfPath);
+  {$endif XTENSA}
+
   FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
 
   GCSectionsStr:='--gc-sections';
-  //if not(cs_link_extern in current_settings.globalswitches) then
   if not(cs_link_nolink in current_settings.globalswitches) then
    Message1(exec_i_linking,current_module.exefilename);
 
@@ -1179,8 +1226,9 @@
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  if target_info.system=system_xtensa_freertos then
-    Replace(cmdstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  {$ifdef XTENSA}
+  Replace(cmdstr,'$'+IdfPath,IdfPath);
+  {$endif}
   if not(cs_link_on_target in current_settings.globalswitches) then
    begin
     Replace(cmdstr,'$EXE',FixedExeFileName);
@@ -1212,32 +1260,31 @@
   if success and not(cs_link_nolink in current_settings.globalswitches) then
     success:=PostProcessExecutable(FixedExeFileName,false);
 
-{$ifdef xtensa}
-  if success and (target_info.system=system_xtensa_freertos) then
-    if (current_settings.controllertype = ct_esp32) then
-      begin
-        binstr:='$'+IDF_PATH+'/components/esptool_py/esptool/esptool.py';
-        Replace(binstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
-        success:=DoExec(binstr,'--chip esp32 elf2image --flash_mode dio --flash_freq 40m '+
-          '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
-          '--elf-sha256-offset 0xb0 '+
-          '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
-          FixedExeFileName,
-          true,false);
-      end
-    else if (current_settings.controllertype = ct_esp8266) then
-      begin
-        binstr:='$'+IDF_PATH+'/components/esptool_py/esptool/esptool.py';
-        Replace(binstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
-        success:=DoExec(binstr,'--chip esp8266 elf2image --flash_mode dout --flash_freq 40m '+
-          '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
-          '--version=3 '+
-          '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
-          FixedExeFileName,
-          true,false);
-      end
+{$ifdef XTENSA}
+  if success then
+   begin
+      binstr:=IdfPath+'/components/esptool_py/esptool/esptool.py';
+      if (current_settings.controllertype = ct_esp32) then
+        begin
+          success:=DoExec(binstr,'--chip esp32 elf2image --flash_mode dio --flash_freq 40m '+
+            '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
+            '--elf-sha256-offset 0xb0 '+
+            '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
+            FixedExeFileName,
+            true,false);
+        end
+      else if (current_settings.controllertype = ct_esp8266) then
+        begin
+          success:=DoExec(binstr,'--chip esp8266 elf2image --flash_mode dout --flash_freq 40m '+
+            '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
+            '--version=3 '+
+            '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
+            FixedExeFileName,
+            true,false);
+        end
+   end
   else
-{$endif xtensa}
+{$endif XTENSA}
     if success then
       success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
         FixedExeFileName+' '+
t_freertos.patch (20,422 bytes)   

Christo Crause

2020-07-12 10:08

reporter   ~0123912

Tested with ESP8266_RTOS_SDK V3.3

Christo Crause

2020-07-12 10:34

reporter   ~0123913

Apologies, the previous patch still checked if sdkconfig.h existed before writing. This patch disables that check so that it gets recreated every time.
t_freertos2.patch (20,475 bytes)   
Index: compiler/systems/t_freertos.pas
===================================================================
--- compiler/systems/t_freertos.pas	(revision 45742)
+++ compiler/systems/t_freertos.pas	(working copy)
@@ -46,8 +46,6 @@
           function postprocessexecutable(const fn : string;isdll:boolean):boolean;
        end;
 
-       var
-         IDF_PATH: string;
 
 {*****************************************************************************
                                   TlinkerEmbedded
@@ -73,21 +71,7 @@
   platform_select='';
 {$endif}
 begin
-  with Info do
-   begin
-{$ifdef xtensa}
-     if target_info.system=system_xtensa_freertos then
-       ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES '+
-         '-u call_user_start_cpu0 -u ld_include_panic_highint_hdl -u esp_app_desc -u vfs_include_syscalls_impl -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u newlib_include_locks_impl -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u app_main -u uxTopUsedPriority '+
-         '-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
-{$else}
-       ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
-{$endif xtensa}
-   end;
+  Info.ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
 end;
 
 
@@ -960,15 +944,16 @@
   t: Text;
   hp: TCmdStrListItem;
   filepath: TCmdStr;
+  {$ifdef XTENSA}
+  IdfPath: TCmdStr;
+  {$endif XTENSA}
 begin
-  IDF_PATH:='';
-{$ifdef xtensa}
-  if (target_info.system=system_xtensa_freertos) then
-    if (current_settings.controllertype = ct_esp32) then
-      IDF_PATH := 'IDF_PATH'
-    else
-      IDF_PATH := 'IDF_PATH8266';
-{$endif xtensa}
+{$ifdef XTENSA}
+  if (current_settings.controllertype = ct_esp32) then
+    IdfPath := trim(GetEnvironmentVariable('IDF_PATH'))
+  else
+    IdfPath := trim(GetEnvironmentVariable('IDF_PATH8266'));
+{$endif XTENSA}
 
   { for future use }
   StaticStr:='';
@@ -979,194 +964,256 @@
   success:=true;
   Result:=false;
 
-  if target_info.system=system_xtensa_freertos then
+  {$ifdef XTENSA}
+  { generate a sdkconfig.h if none is provided,
+    only a few fields are provided to far }
+  //if not(Sysutils.FileExists('sdkconfig.h')) then
     begin
-      { generate a sdkconfig.h if none is provided,
-        only a few fields are provided to far }
-      if not(Sysutils.FileExists('sdkconfig.h')) then
+      Assign(t,'sdkconfig.h');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
+
+      if (current_settings.controllertype = ct_esp32) then
         begin
-          Assign(t,'sdkconfig.h');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
           writeln(t,'#pragma once');
           writeln(t,'#define CONFIG_APP_BUILD_USE_FLASH_SECTIONS 1');
           writeln(t,'#define CONFIG_BT_RESERVE_DRAM 0x0');
           writeln(t,'#define CONFIG_ESP32_ULP_COPROC_RESERVE_MEM 0');
           writeln(t,'#define CONFIG_ESP32_TRACEMEM_RESERVE_DRAM 0x0');
-
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
+        end
+      else
+        begin
+          // TODO: APP_OFFSET & APP_SIZE depends on partition table
+          // Default for partition table: Single factory app, no OTA
+          writeln(t,'#define APP_OFFSET 0x10000');
+          writeln(t,'#define APP_SIZE 0xf0000');
+          // Include build version of sdkconfig.h for custom configuration, if available
+          S:=IdfPath+'/libs/sdkconfig.h';
+          if SysUtils.FileExists(S) then
+            writeln(t,'#include "'+S+'"')
+          else
+            // Assume SOC_FULL_ICACHE option not selected (default)
+            writeln(t,'#define CONFIG_SOC_IRAM_SIZE 0xC000');
         end;
 
-      { generate an sdkconfig if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('sdkconfig')) then
-        begin
-          Assign(t,'sdkconfig');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an sdkconfig if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('sdkconfig')) then
+    begin
+      Assign(t,'sdkconfig');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an Kconfig if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('Kconfig')) then
-        begin
-          Assign(t,'Kconfig');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an Kconfig if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('Kconfig')) then
+    begin
+      Assign(t,'Kconfig');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an Kconfig.projbuild if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('Kconfig.projbuild')) then
-        begin
-          Assign(t,'Kconfig.projbuild');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an Kconfig.projbuild if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('Kconfig.projbuild')) then
+    begin
+      Assign(t,'Kconfig.projbuild');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an kconfigs.in if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('kconfigs.in')) then
-        begin
-          Assign(t,'kconfigs.in');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an kconfigs.in if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('kconfigs.in')) then
+    begin
+      Assign(t,'kconfigs.in');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate an kconfigs_projbuild.in if none is provided,
-        this is a dummy so far }
-      if not(Sysutils.FileExists('kconfigs_projbuild.in')) then
-        begin
-          Assign(t,'kconfigs_projbuild.in');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
 
-          writeln(t);
+  { generate an kconfigs_projbuild.in if none is provided,
+    this is a dummy so far }
+  if not(Sysutils.FileExists('kconfigs_projbuild.in')) then
+    begin
+      Assign(t,'kconfigs_projbuild.in');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
 
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
+      writeln(t);
 
-      { generate a config.env if none is provided,
-        COMPONENT_KCONFIGS and COMPONENT_KCONFIGS_PROJBUILD are dummy fields and might
-        be needed to be filed properly }
-      if not(Sysutils.FileExists('config.env')) then
+      Close(t);
+      if ioresult<>0 then
+        exit;
+      {$pop}
+    end;
+
+  { generate a config.env if none is provided,
+    COMPONENT_KCONFIGS and COMPONENT_KCONFIGS_PROJBUILD are dummy fields and might
+    be needed to be filed properly }
+  //if not(Sysutils.FileExists('config.env')) then
+    begin
+      Assign(t,'config.env');
+      {$push}{$I-}
+      Rewrite(t);
+      if ioresult<>0 then
+        exit;
+
+      writeln(t,'{');
+      if (current_settings.controllertype = ct_esp32) then
         begin
-          Assign(t,'config.env');
-          {$push}{$I-}
-          Rewrite(t);
-          if ioresult<>0 then
-            exit;
-
-          writeln(t,'{');
           writeln(t,'    "COMPONENT_KCONFIGS": "Kconfig",');
           writeln(t,'    "COMPONENT_KCONFIGS_PROJBUILD": "Kconfig.projbuild",');
           writeln(t,'    "IDF_CMAKE": "y",');
           writeln(t,'    "IDF_TARGET": "esp32",');
-          writeln(t,'    "IDF_PATH": "'+GetEnvironmentVariable('IDF_PATH')+'",');
+          writeln(t,'    "IDF_PATH": "'+IdfPath+'",');
           writeln(t,'    "COMPONENT_KCONFIGS_SOURCE_FILE": "kconfigs.in",');
           writeln(t,'    "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE": "kconfigs_projbuild.in"');
-          writeln(t,'}');
-
-          Close(t);
-          if ioresult<>0 then
-            exit;
-          {$pop}
-        end;
-
-      { generate ldgen_libraries }
-      Assign(t,'ldgen_libraries');
-      {$push}{$I-}
-      Rewrite(t);
-      if ioresult<>0 then
-        exit;
-
-      hp:=TCmdStrListItem(StaticLibFiles.First);
-      while assigned(hp) do
+        end
+      else
         begin
-          FindLibraryFile(hp.Str,target_info.staticClibprefix,target_info.staticClibext,filepath);
-          writeln(t,filepath);
-          hp:=TCmdStrListItem(hp.Next);
+          writeln(t,'    "IDF_PATH": "'+IdfPath+'",');
+          writeln(t,'    "IDF_TARGET": "esp8266",');
+          writeln(t,'    "IDF_CMAKE": "n"');
         end;
+      writeln(t,'}');
 
       Close(t);
       if ioresult<>0 then
         exit;
       {$pop}
+    end;
 
-      binstr:='xtensa-esp32-elf-gcc';
-      cmdstr:='-C -P -x c -E -o esp32_out.ld -I . $IDF_PATH/components/esp32/ld/esp32.ld';
+  { generate ldgen_libraries }
+  Assign(t,'ldgen_libraries');
+  {$push}{$I-}
+  Rewrite(t);
+  if ioresult<>0 then
+    exit;
 
-      Replace(binstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      Replace(cmdstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      success:=DoExec(binstr,cmdstr,true,true);
-
-      { generate linker maps for esp32 }
-      binstr:='$IDF_PATH/tools/ldgen/ldgen.py';
-      cmdstr:='--config sdkconfig --fragments $IDF_PATH/components/xtensa/linker.lf $IDF_PATH/components/soc/linker.lf $IDF_PATH/components/esp_event/linker.lf '+
-        '$IDF_PATH/components/spi_flash/linker.lf $IDF_PATH/components/esp_wifi/linker.lf $IDF_PATH/components/lwip/linker.lf '+
-        '$IDF_PATH/components/heap/linker.lf $IDF_PATH/components/esp_ringbuf/linker.lf $IDF_PATH/components/espcoredump/linker.lf $IDF_PATH/components/esp32/linker.lf '+
-        '$IDF_PATH/components/esp32/ld/esp32_fragments.lf $IDF_PATH/components/freertos/linker.lf $IDF_PATH/components/newlib/newlib.lf '+
-        '$IDF_PATH/components/esp_gdbstub/linker.lf '+
-        '--input $IDF_PATH/components/esp32/ld/esp32.project.ld.in --output ./esp32.project.ld --kconfig $IDF_PATH/Kconfig --env-file config.env '+
-        '--libraries-file ldgen_libraries --objdump xtensa-esp32-elf-objdump';
-      Replace(binstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      Replace(cmdstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
-      if success and not(cs_link_nolink in current_settings.globalswitches) then
-        success:=DoExec(binstr,cmdstr,true,false);
+  hp:=TCmdStrListItem(StaticLibFiles.First);
+  while assigned(hp) do
+    begin
+      FindLibraryFile(hp.Str,target_info.staticClibprefix,target_info.staticClibext,filepath);
+      writeln(t,filepath);
+      hp:=TCmdStrListItem(hp.Next);
     end;
 
-  if IDF_PATH <> '' then
-    Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  Close(t);
+  if ioresult<>0 then
+    exit;
+  {$pop}
+
+  binstr:='gcc';
+  if (current_settings.controllertype = ct_esp32) then
+    cmdstr:='-C -P -x c -E -o esp32_out.ld -I . $IDF_PATH/components/esp32/ld/esp32.ld'
+  else
+    cmdstr:='-C -P -x c -E -o esp8266_out.ld -I . $IDF_PATH/components/esp8266/ld/esp8266.ld';
+  Replace(cmdstr,'$IDF_PATH',IdfPath);
+  success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,true);
+
+  { generate linker maps }
+  binstr:='$IDF_PATH/tools/ldgen/ldgen.py';
+  if (current_settings.controllertype = ct_esp32) then
+    cmdstr:='--config sdkconfig '+
+            '--fragments $IDF_PATH/components/xtensa/linker.lf $IDF_PATH/components/soc/linker.lf $IDF_PATH/components/esp_event/linker.lf '+
+            '$IDF_PATH/components/spi_flash/linker.lf $IDF_PATH/components/esp_wifi/linker.lf $IDF_PATH/components/lwip/linker.lf '+
+            '$IDF_PATH/components/heap/linker.lf $IDF_PATH/components/esp_ringbuf/linker.lf $IDF_PATH/components/espcoredump/linker.lf $IDF_PATH/components/esp32/linker.lf '+
+            '$IDF_PATH/components/esp32/ld/esp32_fragments.lf $IDF_PATH/components/freertos/linker.lf $IDF_PATH/components/newlib/newlib.lf '+
+            '$IDF_PATH/components/esp_gdbstub/linker.lf '+
+            '--input $IDF_PATH/components/esp32/ld/esp32.project.ld.in '+
+            '--output ./esp32.project.ld '+
+            '--kconfig $IDF_PATH/Kconfig '+
+            '--env-file config.env '+
+            '--libraries-file ldgen_libraries '+
+            '--objdump xtensa-esp32-elf-objdump'
+  else
+    cmdstr:='--config sdkconfig '+
+            '--fragments $IDF_PATH/components/esp8266/ld/esp8266_fragments.lf '+
+            '$IDF_PATH/components/esp8266/ld/esp8266_bss_fragments.lf $IDF_PATH/components/esp8266/linker.lf '+
+            '$IDF_PATH/components/freertos/linker.lf $IDF_PATH/components/log/linker.lf '+
+            '$IDF_PATH/components/lwip/linker.lf $IDF_PATH/components/spi_flash/linker.lf '+
+            '--env "COMPONENT_KCONFIGS_PROJBUILD=  $IDF_PATH/components/bootloader/Kconfig.projbuild '+
+            '$IDF_PATH/components/esptool_py/Kconfig.projbuild  $IDF_PATH/components/partition_table/Kconfig.projbuild"'+
+            '--env "COMPONENT_KCONFIGS=$IDF_PATH/components/app_update/Kconfig '+
+            '$IDF_PATH/components/esp8266/Kconfig  $IDF_PATH/components/freertos/Kconfig '+
+            '$IDF_PATH/components/log/Kconfig $IDF_PATH/components/lwip/Kconfig" '+
+            '--input $IDF_PATH/components/esp8266/ld/esp8266.project.ld.in '+
+            '--output ./esp8266.project.ld '+
+            '--kconfig $IDF_PATH/Kconfig '+
+            '--env-file config.env '+
+            '--libraries-file ldgen_libraries '+
+            '--objdump xtensa-lx106-elf-objdump';
+
+  Replace(binstr,'$IDF_PATH',IdfPath);
+  Replace(cmdstr,'$IDF_PATH',IdfPath);
+  if success and not(cs_link_nolink in current_settings.globalswitches) then
+    success:=DoExec(binstr,cmdstr,true,false);
+
+  if (current_settings.controllertype = ct_esp32) then
+    Info.ExeCmd[1] := Info.ExeCmd[1]+' -u call_user_start_cpu0 -u ld_include_panic_highint_hdl -u esp_app_desc -u vfs_include_syscalls_impl -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u newlib_include_locks_impl '+
+       '-u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u app_main -u uxTopUsedPriority '+
+       '-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
+    Info.ExeCmd[1] := Info.ExeCmd[1]+' -u call_user_start -u g_esp_sys_info -u _printf_float -u _scanf_float '+
+      '-L $IDF_PATH/components/esp8266/ld -T esp8266.peripherals.ld -T esp8266.rom.ld '+ // SDK scripts
+      '-L . -T esp8266_out.ld -T esp8266.project.ld'; // Project scripts
+
+  Replace(Info.ExeCmd[1],'$IDF_PATH',IdfPath);
+  {$endif XTENSA}
+
   FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
 
   GCSectionsStr:='--gc-sections';
-  //if not(cs_link_extern in current_settings.globalswitches) then
   if not(cs_link_nolink in current_settings.globalswitches) then
    Message1(exec_i_linking,current_module.exefilename);
 
@@ -1179,8 +1226,9 @@
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
-  if target_info.system=system_xtensa_freertos then
-    Replace(cmdstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  {$ifdef XTENSA}
+  Replace(cmdstr,'$'+IdfPath,IdfPath);
+  {$endif}
   if not(cs_link_on_target in current_settings.globalswitches) then
    begin
     Replace(cmdstr,'$EXE',FixedExeFileName);
@@ -1212,32 +1260,31 @@
   if success and not(cs_link_nolink in current_settings.globalswitches) then
     success:=PostProcessExecutable(FixedExeFileName,false);
 
-{$ifdef xtensa}
-  if success and (target_info.system=system_xtensa_freertos) then
-    if (current_settings.controllertype = ct_esp32) then
-      begin
-        binstr:='$'+IDF_PATH+'/components/esptool_py/esptool/esptool.py';
-        Replace(binstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
-        success:=DoExec(binstr,'--chip esp32 elf2image --flash_mode dio --flash_freq 40m '+
-          '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
-          '--elf-sha256-offset 0xb0 '+
-          '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
-          FixedExeFileName,
-          true,false);
-      end
-    else if (current_settings.controllertype = ct_esp8266) then
-      begin
-        binstr:='$'+IDF_PATH+'/components/esptool_py/esptool/esptool.py';
-        Replace(binstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
-        success:=DoExec(binstr,'--chip esp8266 elf2image --flash_mode dout --flash_freq 40m '+
-          '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
-          '--version=3 '+
-          '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
-          FixedExeFileName,
-          true,false);
-      end
+{$ifdef XTENSA}
+  if success then
+   begin
+      binstr:=IdfPath+'/components/esptool_py/esptool/esptool.py';
+      if (current_settings.controllertype = ct_esp32) then
+        begin
+          success:=DoExec(binstr,'--chip esp32 elf2image --flash_mode dio --flash_freq 40m '+
+            '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
+            '--elf-sha256-offset 0xb0 '+
+            '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
+            FixedExeFileName,
+            true,false);
+        end
+      else if (current_settings.controllertype = ct_esp8266) then
+        begin
+          success:=DoExec(binstr,'--chip esp8266 elf2image --flash_mode dout --flash_freq 40m '+
+            '--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
+            '--version=3 '+
+            '-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
+            FixedExeFileName,
+            true,false);
+        end
+   end
   else
-{$endif xtensa}
+{$endif XTENSA}
     if success then
       success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
         FixedExeFileName+' '+
t_freertos2.patch (20,475 bytes)   

Issue History

Date Modified Username Field Change
2020-07-12 10:02 Christo Crause New Issue
2020-07-12 10:02 Christo Crause File Added: t_freertos.patch
2020-07-12 10:08 Christo Crause Note Added: 0123912
2020-07-12 10:34 Christo Crause Note Added: 0123913
2020-07-12 10:34 Christo Crause File Added: t_freertos2.patch