mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 05:09:07 +02:00
* Xtensa: patch by Christo Crause: add IDF_PATH variable, read from the appropriate environment variable, part of #37242
git-svn-id: trunk@45698 -
This commit is contained in:
parent
bbd0dc3726
commit
225b06e84a
@ -46,7 +46,8 @@ implementation
|
|||||||
function postprocessexecutable(const fn : string;isdll:boolean):boolean;
|
function postprocessexecutable(const fn : string;isdll:boolean):boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
IDF_PATH: string;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TlinkerEmbedded
|
TlinkerEmbedded
|
||||||
@ -957,6 +958,12 @@ var
|
|||||||
hp: TCmdStrListItem;
|
hp: TCmdStrListItem;
|
||||||
filepath: TCmdStr;
|
filepath: TCmdStr;
|
||||||
begin
|
begin
|
||||||
|
if (target_info.system=system_xtensa_freertos) then
|
||||||
|
if (current_settings.controllertype = ct_esp32) then
|
||||||
|
IDF_PATH := 'IDF_PATH'
|
||||||
|
else
|
||||||
|
IDF_PATH := 'IDF_PATH8266';
|
||||||
|
|
||||||
{ for future use }
|
{ for future use }
|
||||||
StaticStr:='';
|
StaticStr:='';
|
||||||
StripStr:='';
|
StripStr:='';
|
||||||
@ -1148,6 +1155,7 @@ begin
|
|||||||
success:=DoExec(binstr,cmdstr,true,false);
|
success:=DoExec(binstr,cmdstr,true,false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
|
||||||
FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
|
FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
|
||||||
|
|
||||||
GCSectionsStr:='--gc-sections';
|
GCSectionsStr:='--gc-sections';
|
||||||
@ -1165,7 +1173,7 @@ begin
|
|||||||
SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
|
SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
|
||||||
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
||||||
if target_info.system=system_xtensa_freertos then
|
if target_info.system=system_xtensa_freertos then
|
||||||
Replace(cmdstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
|
Replace(cmdstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
|
||||||
if not(cs_link_on_target in current_settings.globalswitches) then
|
if not(cs_link_on_target in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
Replace(cmdstr,'$EXE',FixedExeFileName);
|
Replace(cmdstr,'$EXE',FixedExeFileName);
|
||||||
@ -1198,16 +1206,28 @@ begin
|
|||||||
success:=PostProcessExecutable(FixedExeFileName,false);
|
success:=PostProcessExecutable(FixedExeFileName,false);
|
||||||
|
|
||||||
if success and (target_info.system=system_xtensa_freertos) then
|
if success and (target_info.system=system_xtensa_freertos) then
|
||||||
begin
|
if (current_settings.controllertype = ct_esp32) then
|
||||||
binstr:='$IDF_PATH/components/esptool_py/esptool/esptool.py';
|
begin
|
||||||
Replace(binstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('IDF_PATH')));
|
binstr:='$'+IDF_PATH+'/components/esptool_py/esptool/esptool.py';
|
||||||
success:=DoExec(binstr,'--chip esp32 elf2image --flash_mode dio --flash_freq 40m '+
|
Replace(binstr,'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
|
||||||
'--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
|
success:=DoExec(binstr,'--chip esp32 elf2image --flash_mode dio --flash_freq 40m '+
|
||||||
'--elf-sha256-offset 0xb0 '+
|
'--flash_size '+tostr(embedded_controllers[current_settings.controllertype].flashsize div (1024*1024))+'MB '+
|
||||||
'-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
|
'--elf-sha256-offset 0xb0 '+
|
||||||
FixedExeFileName,
|
'-o '+maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin')))+' '+
|
||||||
true,false);
|
FixedExeFileName,
|
||||||
end
|
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
|
||||||
else
|
else
|
||||||
if success then
|
if success then
|
||||||
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
|
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
|
||||||
|
Loading…
Reference in New Issue
Block a user