diff --git a/compiler/globals.pas b/compiler/globals.pas index d077f2cfb5..d804d33c35 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -986,6 +986,22 @@ implementation result:=getrealtime(st); end; + function idfversionstring(version : longint):string; + { + Convert back the numerical idf_version for esp32 to string + } + begin + result := ''; + if version > 0 then + begin + result := inttostr(version div 10000)+'.'; + version := version - (version div 10000)*10000; + result := result + inttostr(version div 100)+'.'; + version := version - (version div 100)*100; + result := result + inttostr(version); + end; + end; + {**************************************************************************** Default Macro Handling ****************************************************************************} @@ -1065,6 +1081,19 @@ implementation Replace(s,'$OPENBSD_LOCALBASE',GetOpenBSDLocalBase); Replace(s,'$OPENBSD_X11BASE',GetOpenBSDX11Base); {$endif openbsd} +{$ifdef xtensa} + if idf_version > 0 then + Replace(s,'$IDF_VERSION',idfversionstring(idf_version)); + if idfpath <> '' then + Replace(s,'$IDFPATH',idfpath); +{$endif xtensa} +{$ifdef riscv32} + if idf_version > 0 then + Replace(s,'$IDF_VERSION',idfversionstring(idf_version)); + if idfpath <> '' then + Replace(s,'$IDFPATH',idfpath); +{$endif riscv32} + if not substitute_env_variables then exit; { Replace environment variables between dollar signs }