Forum > Embedded
Problem linking for Xtensa (ESP32)
electronickiwi:
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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program helloworld;begin writeln('Hello World');end.
I've noticed a linkXXX.res file is created. It's contents are:
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
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:
--- Quote from: ccrause on May 09, 2020, 09:24:42 am ---This option sets the path to compiler utils, not binutils.
--- End quote ---
Compiler utils are anything that the compiler calls. Binutils included.
TRon:
--- Quote from: electronickiwi on May 09, 2020, 10:20:12 am ---and getting this result. I can see it looks for and finds the assembler,
--- End quote ---
Indeed it searhes for and finds the assembler correctly.
--- Quote ---but I don't see any messages about looking for the linker and not finding it,
--- End quote ---
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.
--- Quote ---only that it can't call the (internal?) linker, and switches to the external linker, which has an error.
--- End quote ---
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:
When I run with the -sh option it produces the ppas.bat script:
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---@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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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 <module> _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.
Navigation
[0] Message Index
[#] Next page
[*] Previous page