Problem linking for Xtensa (ESP32) lazarus / 77-Embedded ---------------------------------------------------------------------- electronickiwi · 2020-05-09 04:39 I've been following the instructions at https://wiki.lazarus.freepascal.org/Xtensa, and getting stuck at compiling a test program. I've got the following error message coming up when I try and do the cross-compile for xtensa-freertos. (I'm running on Windows) Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i helloworld.pp(8,17) Error: Can't call the linker, switching to external linkinghelloworld.pp(8,17) Error: Error while linkinghelloworld.pp(8,17) Fatal: There were 2 errors compiling module, stoppingFatal: Compilation aborted  I'm running the following command, adapted from the command in the wiki Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i C:\lazarus\fpc\fpc>compiler\ppcrossxtensa -Furtl\units\xtensa- freertos\ -Tfreertos -XPxtensa-esp32-elf- -O3 -Wpesp32 -FlC:\Users\Wes\esp\xtensa-esp32-elf-libs  -FlC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\lib\ helloworld I can run the command Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i C:\lazarus\fpc\fpc>xtensa-esp32-elf-ld and I get Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xtensa- esp32-elf-ld: no input files, which I think means that the appropriate binutils are on my path. Any ideas? Wes ---------------------------------------------------------------------- TRon · 2020-05-09 05:23 Quotehelloworld.pp(8,17) Error: Can't call the linker, switching to external linking That msg seems to suggest that you haven't setup your configuration for crosscompiling correctly Quotehelloworld.pp(8,17) Error: Error while linking That msg seems to suggest that fpc is unable to locate your linker. That is also configuration related. edit: So, were is your fpc.cfg ?  Sorry, i overlooked the fact that you are invoking the crosscompiler directly  (2x fpc in there ) By default there is a define named NEEDCROSSBINUTILS, which adds a prefix to the name of the binutil it wants to invoke: Does the name then still match ? You can add the option -vt to your parameters for compilation (which results in more output from the compiler) in order to see what linker FPC is looking for and if FPC is able to find it. The -vt option actually outputs information on every file FPC attempts to locate. Furthermore you can use the option -FD (inside your configuration file as well) to add the path to your binutils , which makes it redundant to add this path to your path environment variable. ---------------------------------------------------------------------- ccrause · 2020-05-09 07:24 Quote from: TRon on May 09, 2020, 07:23:20 amYou can add the option -vt to your parameters for compilation (which results in more output from the compiler) in order to see what linker FPC is looking for and if FPC is able to find it. The -vt option actually outputs information on every file FPC attempts to locate.+1.  Difficult to troubleshoot if you don't know exactly what the compiler was looking for and where. Since you didn't specify the binutils prefix, the compiler may have assumed a different prefix (such as xtensa-freertos-). You can also set the prefix to the binutils explicitly with the -XP option. You can also use -XP to specify the path+prefix, I guess on your installation it will be something along the lines of: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -XPC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf/bin/xtensa-esp32-elf-EDIT: probably qualifies for the WoMM certification  . QuoteFurthermore you can use the option -FD (inside your configuration file as well) to add the path to your binutils , which makes it redundant to add this path to your path environment variable.This option sets the path to compiler utils, not binutils. EDIT: As others pointed out this is incorrect! ---------------------------------------------------------------------- marcov · 2020-05-09 08:04 XP is only for the prefix. Paths to binutils should be set with -FD ---------------------------------------------------------------------- PascalDragon · 2020-05-09 08:06 Quote from: ccrause on May 09, 2020, 09:24:42 amQuote from: TRon on May 09, 2020, 07:23:20 amYou can add the option -vt to your parameters for compilation (which results in more output from the compiler) in order to see what linker FPC is looking for and if FPC is able to find it. The -vt option actually outputs information on every file FPC attempts to locate.+1.  Difficult to troubleshoot if you don't know exactly what the compiler was looking for and where. Since you didn't specify the binutils prefix, the compiler may have assumed a different prefix (such as xtensa-freertos-). You can also set the prefix to the binutils explicitly with the -XP option. You can also use -XP to specify the path+prefix, I guess on your installation it will be something along the lines of: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -XPC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf/bin/xtensa-esp32-elf- QuoteFurthermore you can use the option -FD (inside your configuration file as well) to add the path to your binutils , which makes it redundant to add this path to your path environment variable.This option sets the path to compiler utils, not binutils. You're wrong. -FD is the path to the binutils, while -XP is only the filename's prefix. ---------------------------------------------------------------------- electronickiwi · 2020-05-09 08:20 Thank you all for your input.  The -XP option was being used, but only the prefix, not the full path.  I've put in the full path to the bin utils, both as -XP and -FD and get the same error each time. I'm now running this command: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i C:\lazarus\fpc\fpc>compiler\ppcrossxtensa -vt -Furtl\units\xtensa- freertos\ -Tfreertos -XPC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- -O3 -Wpesp32 -FlC:\Users\Wes\esp\xtensa-esp32-elf-libs  -FlC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\lib\ helloworld or this one: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i compiler\ppcrossxtensa -vt -Furtl\units\xtensa-freertos\ -Tfreertos -FDC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\ -XPxtensa-esp32-elf- -O3 -Wpesp32 -FlC:\Users\Wes\esp\xtensa-esp32-elf-libs  -FlC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\lib\ helloworld and getting this result.  I can see it looks for and finds the assembler, but I don't see any messages about looking for the linker and not finding it, only that it can't call the (internal?) linker, and switches to the external linker, which has an error. Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Configfile search: fpc.cfgConfigfile search: C:\Users\Wes\fpc.cfgConfigfile search: C:\ProgramData\fpc.cfgConfigfile search: C:\lazarus\fpc\fpc\compiler\fpc.cfgPath ".\::=::\" not foundPath ".\rtl\xtensa-freertos\" not foundCompiler: C:\lazarus\fpc\fpc\compiler\ppcrossxtensa.exeUsing executable path: C:\lazarus\fpc\fpc\compiler\Using unit path: .\rtl\units\xtensa- freertos\Using unit path: .\compiler\Using library path: C:\Users\Wes\esp\xtensa-esp32-elf-libs\Using library path: C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\lib\Using library path: .\rtl\units\xtensa-freertos\Using library path: .\compiler\Using object path: .\rtl\units\xtensa-freertos\Using object path: .\compiler\Searching file helloworld.pp... foundUnitsearch: system.ppuUnitsearch: system.ppUnitsearch: system.pasUnitsearch: .\rtl\units\xtensa-freertos\system.ppuPPU Loading .\rtl\units\xtensa- freertos\system.ppuSearching file helloworld.pp... foundSearching file helloworld.pp... foundUnitsearch: ESP32.ppuUnitsearch: ESP32.ppUnitsearch: ESP32.pasUnitsearch: .\rtl\units\xtensa- freertos\ESP32.ppuPPU Loading .\rtl\units\xtensa- freertos\esp32.ppuUnitsearch: consoleio.ppuUnitsearch: consoleio.ppUnitsearch: consoleio.pasUnitsearch: .\rtl\units\xtensa- freertos\consoleio.ppuPPU Loading .\rtl\units\xtensa- freertos\consoleio.ppuUnitsearch: heapmgr.ppuUnitsearch: heapmgr.ppUnitsearch: heapmgr.pasUnitsearch: .\rtl\units\xtensa- freertos\heapmgr.ppuPPU Loading .\rtl\units\xtensa- freertos\heapmgr.ppuSearching file helloworld.pp... foundSearching file C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- as.exe... foundUsing assembler: C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- as.exeSearching file helloworld.o... foundSearching file .\rtl\units\xtensa-freertos\system.o... foundSearching file .\rtl\units\xtensa-freertos\esp32.o... foundSearching file libesp32.a... not foundSearching file libesp32.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp32.a... foundSearching file libsoc.a... not foundSearching file libsoc.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libsoc.a... foundSearching file libdriver.a... not foundSearching file libdriver.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libdriver.a... foundSearching file libfreertos.a... not foundSearching file libfreertos.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libfreertos.a... foundSearching file liblog.a... not foundSearching file liblog.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\liblog.a... foundSearching file libesp_common.a... not foundSearching file libesp_common.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libesp_common.a... foundSearching file libheap.a... not foundSearching file libheap.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libheap.a... foundSearching file libnewlib.a... not foundSearching file libnewlib.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libnewlib.a... foundSearching file libvfs.a... not foundSearching file libvfs.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libvfs.a... foundSearching file libesp_ringbuf.a... not foundSearching file libesp_ringbuf.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp_ringbuf.a... foundSearching file libspi_flash.a... not foundSearching file libspi_flash.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libspi_flash.a... foundSearching file libapp_update.a... not foundSearching file libapp_update.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libapp_update.a... foundSearching file libxtensa.a... not foundSearching file libxtensa.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libxtensa.a... foundSearching file libbootloader_support.a... not foundSearching file libbootloader_support.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libbootloader_support.a... foundSearching file libpthread.a... not foundSearching file libpthread.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libpthread.a... foundSearching file libhal.a... not foundSearching file libhal.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libhal.a... foundSearching file libm.a... not foundSearching file libm.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libm.a... foundSearching file libg.a... not foundSearching file libg.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libg.a... foundSearching file libc.a... not foundSearching file libc.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libc.a... foundSearching file libesp_event.a... not foundSearching file libesp_event.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_event.a... foundSearching file .\rtl\units\xtensa- freertos\consoleio.o... foundSearching file .\rtl\units\xtensa- freertos\heapmgr.o... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libesp32.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libsoc.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libdriver.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libfreertos.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\liblog.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_common.a... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libheap.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libnewlib.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libvfs.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp_ringbuf.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libspi_flash.a... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libapp_update.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libxtensa.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libbootloader_support.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libpthread.a... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libhal.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libm.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libg.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libc.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp_event.a... foundhelloworld.pp(3,24) Error: Can't call the linker, switching to external linkinghelloworld.pp(3,24) Error: Error while linkingSearching file helloworld.o... foundSearching file helloworld.o... foundSearching file .\rtl\units\xtensa- freertos\system.o... foundSearching file .\rtl\units\xtensa- freertos\system.o... foundSearching file .\rtl\units\xtensa- freertos\esp32.o... foundSearching file .\rtl\units\xtensa- freertos\esp32.o... foundSearching file .\rtl\units\xtensa- freertos\consoleio.o... foundSearching file .\rtl\units\xtensa- freertos\consoleio.o... foundSearching file .\rtl\units\xtensa- freertos\heapmgr.o... foundSearching file .\rtl\units\xtensa- freertos\heapmgr.o... foundhelloworld.pp(3,24) Fatal: There were 2 errors compiling module, stoppingFatal: Compilation aborted Contents of helloworld.pp Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program helloworld;begin  writeln('Hello World');end. I've noticed a linkXXX.res file is created.  It's contents are: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SEARCH_DIR("C:\Users\Wes\esp\xtensa-esp32-elf- libs\")SEARCH_DIR("C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\xtensa- esp32-elf\lib\")SEARCH_DIR(".\rtl\units\xtensa- freertos\")SEARCH_DIR(".\compiler\")INPUT (helloworld.o.\rtl\units\xtensa-freertos\system.o.\rtl\units\xtensa- freertos\esp32.o.\rtl\units\xtensa- freertos\consoleio.o.\rtl\units\xtensa- freertos\heapmgr.o)GROUP(C:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp32.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libsoc.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libdriver.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libfreertos.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\liblog.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_common.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libheap.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libnewlib.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libvfs.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_ringbuf.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libspi_flash.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libapp_update.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libxtensa.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libbootloader_support.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libpthread.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libhal.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libm.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libg.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libc.aC:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_event.a)SECTIONS{  .data :  {    KEEP (*(.fpc .fpc.n_version .fpc.n_links))  }} ---------------------------------------------------------------------- MiR · 2020-05-09 08:24 One more thing to do is to add -sh parameter to build, this way a linker script will be generated and you see step by step what is happening (and going wrong) in the linker phase. In the past (when I remember correctly) parts of the steps done to link were unix specific, perhaps some detail still needs to be fixed for running on windows. ---------------------------------------------------------------------- marcov · 2020-05-09 09:03 Quote from: ccrause on May 09, 2020, 09:24:42 amThis option sets the path to compiler utils, not binutils. Compiler utils are anything that the compiler calls. Binutils included. ---------------------------------------------------------------------- TRon · 2020-05-09 09:29 Quote from: electronickiwi on May 09, 2020, 10:20:12 amand getting this result.  I can see it looks for and finds the assembler, Indeed it searhes for and finds the assembler correctly. Quotebut I don't see any messages about looking for the linker and not finding it, That is the part that is concerning. After the assembly, when it processed all required files to do so, it should invoke the linker It does so in a similar fashion as the assembler. Searching for it, finding it, then invoking it. That last part is indeed missing from your log. Quoteonly that it can't call the (internal?) linker, and switches to the external linker, which has an error. That it tries the internal linker first should afaik not happen. You could perhaps try to 'override' internal linking with providing the compiler option -Xe (Use external linker) Another thing that might perhaps help is to try to avoid to optimize (so get rid of the option -O3). Other than that i have no idea atm. I am unfamiliar with the target, so have no idea on particular ins and/or outs and with regards to my knowledge regarding the backend i'm out of idea's. Oh, perhaps one thing (but as said i am unfamiliar with this particular toolchain) you could perhaps try and pass some (debug) options through to the linker (which ones those should be i have no idea. You could try to invoke the linker with --help or /help and see if there are any meaningful options you could perhaps pass along at linking stage. I did read something with regards to this toolchain about setting environment variables ? ---------------------------------------------------------------------- electronickiwi · 2020-05-09 09:39 When I run with the -sh option it produces the ppas.bat script: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @echo offSET THEFILE=helloworldecho Assembling %THEFILE%C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- as.exe -o helloworld.o  helloworld.s --longcallsif errorlevel 1 goto asmendDel helloworld.sSET THEFILE=helloworldecho Linking %THEFILE%xtensa-esp32-elf-gcc -C -P -x c -E -o esp32_out.ld -I . C:\Users\Wes\esp\esp-idf/components/esp32/ld/esp32.ldif errorlevel 1 goto linkendSET THEFILE=helloworldecho Linking %THEFILE%C:\Users\Wes\esp\esp- idf/components/esptool_py/esptool/esptool.py --chip esp32 elf2image --flash_mode dio --flash_freq 40m --flash_size 2MB --elf-sha256-offset 0xb0 -o helloworld.bin helloworld.elfif errorlevel 1 goto linkendgoto end:asmendecho An error occurred while assembling %THEFILE%goto end:linkendecho An error occurred while linking %THEFILE%:end  Running that script produces: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Assembling helloworldLinking helloworldLinking helloworldesptool.py v3.0-devTraceback (most recent call last):  File "C:\Users\Wes\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 3430, in     _main()  File "C:\Users\Wes\esp\esp- idf\components\esptool_py\esptool\esptool.py", line 3423, in _main    main()  File "C:\Users\Wes\esp\esp- idf\components\esptool_py\esptool\esptool.py", line 3163, in main    operation_func(args)  File "C:\Users\Wes\esp\esp- idf\components\esptool_py\esptool\esptool.py", line 2633, in elf2image    e = ELFFile(args.input)  File "C:\Users\Wes\esp\esp- idf\components\esptool_py\esptool\esptool.py", line 2108, in __init__    with open(self.name, 'rb') as f:FileNotFoundError: [Errno 2] No such file or directory: 'helloworld.elf'An error occurred while linking helloworld gcc is producing the expected esp32_out.ld file, but there is no helloworld.elf for esptool.py to produce the helloworld.bin from. ---------------------------------------------------------------------- electronickiwi · 2020-05-09 09:45 No change using the -Xe option and leaving out the -O3 option. It still says "Can't call the linker, switching to external linker" I'm assuming I only need to put -Xe and not include the path to the linker (as that is specified in -FD option)? ---------------------------------------------------------------------- TRon · 2020-05-09 09:54 Quote from: electronickiwi on May 09, 2020, 11:45:08 amNo change using the -Xe option and leaving out the -O3 option. Ok, thank for trying and reporting back. I noticed that you posted pretty quick after my post, and the script more or less already explained that the issue is not related to optimising. QuoteIt still says "Can't call the linker, switching to external linker" Sorry to hear that. I have to surrender here. Hopefully one of the more experienced developers or the maintainer of this particular target reads this and is able to help you out here. Perhaps worth a report in the mantis bug-tracker to draw some more attention to it ? QuoteI'm assuming I only need to put -Xe and not include the path to the linker (as that is specified in -FD option)? That is correct. You can try though. FPC will respectfully throw that back in your face with an error ---------------------------------------------------------------------- electronickiwi · 2020-05-09 09:59 Thanks TRon. ---------------------------------------------------------------------- TRon · 2020-05-09 10:55 Quote from: ccrause on May 09, 2020, 09:24:42 amEDIT: As others pointed out this is incorrect! Nevertheless, your input is very much appreciated. You are most probably correct in that i should not have named it literally "to add the path to your binutils", which perhaps suggested that the -FD option is meant only for pointing to binutils. You are able to 'abuse' that option to add about every path that has at least some meaning for the toolchain, so that FPC is able to actually set things in such motion that an executable (or other kind of output) is constructed. As pointed out by others (thank you others), binutils is a chain of tools (hence toolchain) that is/becomes part of the compiler utilities (although originating from external sources). For most generic targets ld, as and others like strip are pretty common, but there are some pretty unorthodox targets out there (that are supported by FPC as well) and which require FPC to (indirectly) invoke a complete set of (exotic) tools in order to produce something useful. Quote... Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -XPC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf/bin/xtensa-esp32-elf-EDIT: probably qualifies for the WoMM certification  . ... and that is perhaps one of such toolchains that installs itself (automatically) in such WoMM manner  Another example is for instance Android with it's .apk files (which is very convenient when the toolchain is able to produce that automatically for you). On top of that, such (wonderful) options allows for a complete standalone (independent from OS) setup for FPC. You can just toss every native + cross compiler versions onto a (big) flash-drive and you never have to worry about installing things again (that is until the next release from FPC/Lazarus team of course .. those blimey releases  ). ---------------------------------------------------------------------- marcov · 2020-05-09 11:14 .py's don't execute on Windows without being prefixed by the interpreter ? ---------------------------------------------------------------------- MiR · 2020-05-09 11:44 Can you please replace your ppcrossxtensa with the file from here: http://temp.michael-ring.org/ppcrossxtensa.exe I have added logging for two important commands. For me the command ldgen fails which as a consequence lets the linker fail. Please try on your system and report back the output. One more thing, I saw that you did not follow instructions because you are using latest esp-idf sdk (binutils from 4.0 have a path with 2019 in it), should not matter too much but it might create crazy issues later in the process when you jumped this first hurdle. Code: [Select]C:\Users\ring\devel\hello>ppcrossxtensa -Fuxtensa- freertos\rtl -Tfreertos -XPxtensa-esp32-elf- -O3 -Wpesp32 hello C:\Users\ring\Desktop\esp-idf/tools/ldgen/ldgen.py --config sdkconfig --fragments C:\Users\ring\Desktop\esp- idf/components/xtensa/linker.lf C:\Users\ring\Desktop\esp- idf/components/soc/linker.lf C:\Users\ring\Desktop\esp- idf/components/esp_event/linker.lf C:\Users\ring\Desktop\esp- idf/components/spi_flash/linker.lf C:\Users\ring\Desktop\esp- idf/components/esp_wifi/linker.lf C:\Users\ring\Desktop\esp- idf/components/lwip/linker.lf C:\Users\ring\Desktop\esp- idf/components/heap/linker.lf C:\Users\ring\Desktop\esp- idf/components/esp_ringbuf/linker.lf C:\Users\ring\Desktop\esp- idf/components/espcoredump/linker.lf C:\Users\ring\Desktop\esp- idf/components/esp32/linker.lf C:\Users\ring\Desktop\esp- idf/components/esp32/ld/esp32_fragments.lf C:\Users\ring\Desktop\esp- idf/components/freertos/linker.lf C:\Users\ring\Desktop\esp- idf/components/newlib/newlib.lf C:\Users\ring\Desktop\esp- idf/components/esp_gdbstub/linker.lf --input C:\Users\ring\Desktop\esp-idf/components/esp32/ld/esp32.project.ld.in --output ./esp32.project.ld --kconfig C:\Users\ring\Desktop\esp- idf/Kconfig --env-file config.env --libraries-file ldgen_libraries --objdump xtensa-esp32-elf-objdump hello.pp(3,18) Error: Can't call the linker, switching to external linking hello.pp(3,18) Error: Error while linking C:\Users\ring\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- ld.exe -g     --gc-sections   -L. -o hello.elf -T link9716.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 C:\Users\ring\Desktop\esp- idf/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 C:\Users\ring\Desktop\esp-idf/components/esp32/ld -T esp32.peripherals.ld FALSE hello.pp(3,18) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted C:\Users\ring\devel\hello>C:\Users\ring\Desktop\esp- idf/tools/ldgen/ldgen.py --config sdkconfig --fragments C:\Users\ring\Desktop\esp-idf/components/xtensa/linker.lf C:\Users\ring\Desktop\esp-idf/components/soc/linker.lf C:\Users\ring\Desktop\esp-idf/components/esp_event/linker.lf C:\Users\ring\Desktop\esp-idf/components/spi_flash/linker.lf C:\Users\ring\Desktop\esp-idf/components/esp_wifi/linker.lf C:\Users\ring\Desktop\esp-idf/components/lwip/linker.lf C:\Users\ring\Desktop\esp-idf/components/heap/linker.lf C:\Users\ring\Desktop\esp-idf/components/esp_ringbuf/linker.lf C:\Users\ring\Desktop\esp-idf/components/espcoredump/linker.lf C:\Users\ring\Desktop\esp-idf/components/esp32/linker.lf C:\Users\ring\Desktop\esp-idf/components/esp32/ld/esp32_fragments.lf C:\Users\ring\Desktop\esp-idf/components/freertos/linker.lf C:\Users\ring\Desktop\esp-idf/components/newlib/newlib.lf C:\Users\ring\Desktop\esp-idf/components/esp_gdbstub/linker.lf --input C:\Users\ring\Desktop\esp-idf/components/esp32/ld/esp32.project.ld.in --output ./esp32.project.ld --kconfig C:\Users\ring\Desktop\esp- idf/Kconfig --env-file config.env --libraries-file ldgen_libraries --objdump xtensa-esp32-elf-objdump Traceback (most recent call last):   File "C:\Users\ring\Desktop\esp-idf\tools\ldgen\ldgen.py", line 150, in     main()   File "C:\Users\ring\Desktop\esp-idf\tools\ldgen\ldgen.py", line 112, in main     _update_environment(args)  # assign args.env and args.env_file to os.environ   File "C:\Users\ring\Desktop\esp-idf\tools\ldgen\ldgen.py", line 41, in _update_environment     env = json.load(args.env_file)   File "C:\Users\ring\AppData\Local\Programs\Python\Python38\lib\json\ __init__.py", line 293, in load     return loads(fp.read(),   File "C:\Users\ring\AppData\Local\Programs\Python\Python38\lib\json\ __init__.py", line 357, in loads     return _default_decoder.decode(s)   File "C:\Users\ring\AppData\Local\Programs\Python\Python38\lib\json\ decoder.py", line 337, in decode     obj, end = self.raw_decode(s, idx=_w(s, 0).end())   File "C:\Users\ring\AppData\Local\Programs\Python\Python38\lib\json\ decoder.py", line 353, in raw_decode     obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Invalid \escape: line 6 column 20 (char 164) ---------------------------------------------------------------------- MiR · 2020-05-09 11:59 Problem is likely in the env file generated from freepascal on windows This:     "IDF_PATH": "C:\Users\ring\Desktop\esp-idf", is not working, this:     "IDF_PATH": "C:/Users/ring/Desktop/esp-idf", makes ldgen.py happy but it seems there is more hacking needed.... Here's what I changed for the logging, based on this and adding perhaps a little more logging here and there you should be able to fix the compiler or to at least write a good bugreport: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i diff --git a/compiler/systems/t_freertos.pas b/compiler/systems/t_freertos.pasindex 4efe4deb79..66a599e003 100644--- a/compiler/systems/t_freertos.pas+++ b/compiler/systems/t_freertos.pas@@ -1144,6 +1144,8 @@ begin         ' --libraries-file ldgen_libraries --objdump xtensa-esp32-elf-objdump';       Replace(binstr,'$IDF_PATH',maybequoted(GetEnvironmentVariable('ID F_PATH')));       Replace(cmdstr,'$IDF_PATH',maybequoted(GetEnvironmen tVariable('IDF_PATH')));+      writeln(binstr);+      writeln(cmdstr);       if success and not(cs_link_nolink in current_settings.globalswitches) then         success:=DoExec(binstr,cmdstr,true,false);     end;@@ -1186,6 +1188,10 @@ begin     Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);     Replace(cmdstr,'$DYNLINK',DynLinkStr);    end;++  writeln(FindUtil(utilsprefix+BinStr));+  writeln(cmdstr);+  writeln(success);   if success and not(cs_link_nolink in current_settings.globalswitches) then     success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false); ---------------------------------------------------------------------- TRon · 2020-05-09 12:08 Ah, yes indeed marcov. Unless resorting to WSL or similar solutions then we are still depending on file association (which is not independent from OS, afaik). In that regards my statement is most certainly too bold. Good catch  On certain platforms it is not always possible to target everything (or even anything due to hardware restrictions ). It is a continues process, adding and improving things etc. For instance i don't  particularly like the version scheme that FPC front-end uses to invoke the correct compiler version, therefor i wrote a front-end for the compiler front-end  As last resort i'm working on bailing out, and invoke a remote compiler (again if possible). But that feature is in early stage and is still being researched. But i already saw another feature i wish to add, and that is that Lazarus seems to support compiler options to be provided from the (main program's) source-code. That could be a nice addition. ---------------------------------------------------------------------- electronickiwi · 2020-05-10 03:15 I've tried a few things with mixed results. First I tried MiR's ppcrossxtensa.exe, and apart from some additional log output got a similar result, including after I changed the IDF_PATH to linux-style. Yes, I was using esp-idfv4.2, this came after trying v4.0 without success.  (I note the wiki says to use v4.0.1 which isn't one of the labels used for esp-idf releases, but 4.0 is?). I now changed back to esp-idfv4.0. I deleted everything and built fpc from source again. Now using MiR compiler the results indicate that the compiler cannot find ".\rtl\xtensa-freertos" which isn't present but ".\rtl\xtensa" and ".\rtl\units\xtensa-freertos" are present, with the latter specified using -Fu Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i C:\source\fpc>compiler\ppcrossxtensa -vt -Furtl\units\xtensa-freertos\ -Tfreertos -FDC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin -XPxtensa-esp32-elf- -Wpesp32 -FlC:\Users\Wes\esp\xtensa-esp32-elf-libs\ -FlC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\lib\ helloConfigfile search: fpc.cfgConfigfile search: C:\Users\Wes\fpc.cfgConfigfile search: C:\ProgramData\fpc.cfgConfigfile search: C:\source\fpc\compiler\fpc.cfgPath ".\::=::\" not foundPath ".\rtl\xtensa-freertos\" not foundCompiler: C:\source\fpc\compiler\ppcrossxtensa.exeUsing executable path: C:\source\fpc\compiler\Using unit path: .\rtl\units\xtensa- freertos\Using unit path: .\compiler\Using library path: C:\Users\Wes\esp\xtensa-esp32-elf-libs\Using library path: C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\xtensa-esp32-elf\lib\Using library path: .\rtl\units\xtensa-freertos\Using library path: .\compiler\Using object path: .\rtl\units\xtensa-freertos\Using object path: .\compiler\Searching file hello.pp... foundUnitsearch: system.ppuUnitsearch: system.ppUnitsearch: system.pasUnitsearch: .\rtl\units\xtensa-freertos\system.ppuPPU Loading .\rtl\units\xtensa- freertos\system.ppuSearching file hello.pp... foundSearching file hello.pp... foundUnitsearch: ESP32.ppuUnitsearch: ESP32.ppUnitsearch: ESP32.pasUnitsearch: .\rtl\units\xtensa-freertos\ESP32.ppuPPU Loading .\rtl\units\xtensa-freertos\esp32.ppuUnitsearch: consoleio.ppuUnitsearch: consoleio.ppUnitsearch: consoleio.pasUnitsearch: .\rtl\units\xtensa-freertos\consoleio.ppuPPU Loading .\rtl\units\xtensa-freertos\consoleio.ppuUnitsearch: heapmgr.ppuUnitsearch: heapmgr.ppUnitsearch: heapmgr.pasUnitsearch: .\rtl\units\xtensa-freertos\heapmgr.ppuPPU Loading .\rtl\units\xtensa- freertos\heapmgr.ppuSearching file hello.pp... foundSearching file C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- as.exe... foundUsing assembler: C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- as.exeSearching file hello.o... foundSearching file .\rtl\units\xtensa-freertos\system.o... foundSearching file .\rtl\units\xtensa-freertos\esp32.o... foundSearching file libesp32.a... not foundSearching file libesp32.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp32.a... foundSearching file libsoc.a... not foundSearching file libsoc.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libsoc.a... foundSearching file libdriver.a... not foundSearching file libdriver.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libdriver.a... foundSearching file libfreertos.a... not foundSearching file libfreertos.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libfreertos.a... foundSearching file liblog.a... not foundSearching file liblog.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\liblog.a... foundSearching file libesp_common.a... not foundSearching file libesp_common.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libesp_common.a... foundSearching file libheap.a... not foundSearching file libheap.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libheap.a... foundSearching file libnewlib.a... not foundSearching file libnewlib.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libnewlib.a... foundSearching file libvfs.a... not foundSearching file libvfs.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libvfs.a... foundSearching file libesp_ringbuf.a... not foundSearching file libesp_ringbuf.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp_ringbuf.a... foundSearching file libspi_flash.a... not foundSearching file libspi_flash.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libspi_flash.a... foundSearching file libapp_update.a... not foundSearching file libapp_update.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libapp_update.a... foundSearching file libxtensa.a... not foundSearching file libxtensa.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libxtensa.a... foundSearching file libbootloader_support.a... not foundSearching file libbootloader_support.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libbootloader_support.a... not foundSearching file C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\xtensa- esp32-elf\lib\libbootloader_support.a... not foundSearching file .\rtl\units\xtensa-freertos\libbootloader_support.a... not foundSearching file .\compiler\libbootloader_support.a... not foundSearching file C:\source\fpc\compiler\libbootloader_support.a... not foundSearching file libpthread.a... not foundSearching file libpthread.a... not foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libpthread.a... foundSearching file libhal.a... not foundSearching file libhal.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libhal.a... foundSearching file libm.a... not foundSearching file libm.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libm.a... foundSearching file libg.a... not foundSearching file libg.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libg.a... foundSearching file libc.a... not foundSearching file libc.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libc.a... foundSearching file libesp_event.a... not foundSearching file libesp_event.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_event.a... foundSearching file .\rtl\units\xtensa- freertos\consoleio.o... foundSearching file .\rtl\units\xtensa- freertos\heapmgr.o... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libesp32.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libsoc.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libdriver.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libfreertos.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\liblog.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libesp_common.a... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libheap.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libnewlib.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libvfs.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp_ringbuf.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libspi_flash.a... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libapp_update.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libxtensa.a... foundSearching file libbootloader_support.a... not foundSearching file libbootloader_support.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libbootloader_support.a... not foundSearching file C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\xtensa- esp32-elf\lib\libbootloader_support.a... not foundSearching file .\rtl\units\xtensa-freertos\libbootloader_support.a... not foundSearching file .\compiler\libbootloader_support.a... not foundSearching file C:\source\fpc\compiler\libbootloader_support.a... not foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf- libs\libpthread.a... foundSearching file C:\Users\Wes\esp\xtensa- esp32-elf-libs\libhal.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libm.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libg.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libc.a... foundSearching file C:\Users\Wes\esp\xtensa-esp32-elf-libs\libesp_event.a... foundC:\Users\Wes\esp\esp-idf-4.0/tools/ldgen/ldgen.py--config sdkconfig --fragments C:\Users\Wes\esp\esp- idf-4.0/components/xtensa/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/soc/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/esp_event/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/spi_flash/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/esp_wifi/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/lwip/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/heap/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/esp_ringbuf/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/espcoredump/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/esp32/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/esp32/ld/esp32_fragments.lf C:\Users\Wes\esp\esp- idf-4.0/components/freertos/linker.lf C:\Users\Wes\esp\esp- idf-4.0/components/newlib/newlib.lf C:\Users\Wes\esp\esp- idf-4.0/components/esp_gdbstub/linker.lf --input C:\Users\Wes\esp\esp- idf-4.0/components/esp32/ld/esp32.project.ld.in --output ./esp32.project.ld --kconfig C:\Users\Wes\esp\esp-idf-4.0/Kconfig --env-file config.env --libraries-file ldgen_libraries --objdump xtensa-esp32-elf-objdumphello.pp(19,27) Error: Can't call the linker, switching to external linkinghello.pp(19,27) Error: Error while linkingSearching file hello.o... foundSearching file hello.o... foundSearching file .\rtl\units\xtensa-freertos\system.o... foundSearching file .\rtl\units\xtensa-freertos\system.o... foundSearching file .\rtl\units\xtensa-freertos\esp32.o... foundSearching file .\rtl\units\xtensa-freertos\esp32.o... foundSearching file .\rtl\units\xtensa-freertos\consoleio.o... foundSearching file .\rtl\units\xtensa-freertos\consoleio.o... foundSearching file .\rtl\units\xtensa-freertos\heapmgr.o... foundSearching file .\rtl\units\xtensa-freertos\heapmgr.o... foundSearching file C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- ld.exe... foundUsing util C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- ld.exeC:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- ld.exe-g     --gc-sections   -L. -o hello.elf -T link12040.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 C:\Users\Wes\esp\esp- idf-4.0/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 C:\Users\Wes\esp\esp- idf-4.0/components/esp32/ld -T esp32.peripherals.ldFALSEhello.pp(19,27) Fatal: There were 2 errors compiling module, stoppingFatal: Compilation aborted Running with the -sh options produces the following ppas.bat (and the cmd window output is similar to above, but ends with TRUE): Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i @echo offSET THEFILE=helloecho Assembling %THEFILE%C:\Users\Wes\.espressif\tools\xtensa- esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf- as.exe -o hello.o  hello.s --longcallsif errorlevel 1 goto asmendDel hello.sSET THEFILE=helloecho Linking %THEFILE%xtensa-esp32-elf-gcc -C -P -x c -E -o esp32_out.ld -I . C:\Users\Wes\esp\esp- idf-4.0/components/esp32/ld/esp32.ldif errorlevel 1 goto linkendSET THEFILE=helloecho Linking %THEFILE%C:\Users\Wes\esp\esp- idf-4.0/components/esptool_py/esptool/esptool.py --chip esp32 elf2image --flash_mode dio --flash_freq 40m --flash_size 2MB --elf- sha256-offset 0xb0 -o hello.bin hello.elfif errorlevel 1 goto linkendgoto end:asmendecho An error occurred while assembling %THEFILE%goto end:linkendecho An error occurred while linking %THEFILE%:end  Running ppas.bat results in Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i FileNotFoundError: [Errno 2] No such file or directory: 'hello.elf' (because it is not being made) Noting that the wiki advises "So far Linux and Mac hosts only" I then decided to try it via WSL (Ubuntu 18.04) and started from scratch.  I've now been able to get helloworld to run on an ESP32 board (after reducing the flash baud rate) by running from Linux . By the way, a couple of recommended changes for the wiki: - find ~/esp/esp-idf/components -name "*.a" -exec cp {} ~/esp/xtensa- esp32-elf-libs \; - for the ESP32:      make FPC=fpc CPU_TARGET=xtensa OS_TARGET=freertos SUBARCH=lx6 "CROSSOPT=-Cplx6 -XPxtensa-esp32-elf- -Cfhard" all -j ---------------------------------------------------------------------- MiR · 2020-05-10 06:23 Seems you are ready for level two  , have a look here: https://github.com/ccrause/fpc-esp-freertos Michael ---------------------------------------------------------------------- electronickiwi · 2020-05-10 06:41 Already there!    Have successfully run your blink example.  Have updated esp-idf to release v4.1-beta to hopefully be on the same basis as you. Looking at some of your other examples to get my pascal knowledge refreshed.  I ran into an issue with the compiler not recognising "result", but fixed that with {$mode objfpc}{$H+} added to the program. Have currently got a problem compiling wifiscan and the other more involved examples that call the esp-idf functions - I think I just need to get all the right paths added to the includes in the command line.  Will let you know how I get on. ---------------------------------------------------------------------- MiR · 2020-05-10 06:46 fpc-esp-freertos is not my work, it is work of ccrause, I am mostly working on freertos for arm processors but I also have esp32 in mind when doing this. This is my project: https://github.com/michael-ring/mbf-freertos Michael ---------------------------------------------------------------------- electronickiwi · 2020-05-10 07:38 Hi Michael Sorry for the mix-up, and thanks for the link, and the earlier help. Wes ---------------------------------------------------------------------- PascalDragon · 2020-05-10 14:38 Quote from: TRon on May 09, 2020, 11:29:25 amQuoteonly that it can't call the (internal?) linker, and switches to the external linker, which has an error. That it tries the internal linker first should afaik not happen. That is in fact a misleading error message by the compiler, cause it prints this if any linker failed, no matter if it was the internal one or not Quote from: marcov on May 09, 2020, 01:14:36 pm.py's don't execute on Windows without being prefixed by the interpreter ? Well, the link script posted by electronickiwi contained a direct call to esptool.py as well and executing it resulted in a call trace inside the Python call, so apparently that does worked correctly. ---------------------------------------------------------------------- peter@jazenga.com · 2020-10-04 11:36 It would be very helpful if someone could share a working fpc.cfg file for xtensa (ESP32) I have both Linux and Windows 10 but so far no success due to missing xtensa tools however they are on the system I am unfamiliar with cross compilation for embedded & RTOS so I don't really know how to create the config or where to place the executable files ---------------------------------------------------------------------- ccrause · 2020-10-04 12:49 Quote from: peter@jazenga.com on October 04, 2020, 01:36:02 pmIt would be very helpful if someone could share a working fpc.cfg file for xtensa (ESP32) I have both Linux and Windows 10 but so far no success due to missing xtensa tools however they are on the system I am unfamiliar with cross compilation for embedded & RTOS so I don't really know how to create the config or where to place the executable files Are you trying to compile for embedded or freertos target?  Embedded should be easier to set up, but then you have to write quite a bit of code to configure the cores, set up interrupt handlers, memory manager etc.  FreeRTOS target perform all the configuration of the processors, but linking to the SDK is a little bit more tricky (but the required steps are documented in the wiki). Post the specific compiler errors you encountered. How are you creating the cross compiler? Using make, or install with fpcupdeluxe? If using make, please show the full command line you used. Are the cross tools (e.g. xtensa-esp32-elf-ld on Linux) in the path or not? If not pass the location to these utilities to the compiler using the -FD option.