Forum > Embedded
Setting up Xtensa-FreeRTOS for ESP8266
af0815:
First step to build the crosscompiler is to patch fpcupdeluxe - m_any_to_freertosxtensa.pas
--- 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";}};} ---function TAny_FreeRTOSXtensa.GetBinUtils(Basepath:string): boolean;var AsFile: string; S,PresetBinPath:string;begin result:=inherited; if result then exit; if (FSubArch=TSUBARCH.lx6) then FBinUtilsPrefix:=GetCPU(TargetCPU)+'-esp32-elf-'; if (FSubArch=TSUBARCH.lx106) then FBinUtilsPrefix:=GetCPU(TargetCPU)+'-lx106-elf-'; // Start with any names user may have given AsFile:=FBinUtilsPrefix+'as'+GetExeExt; I have to built the tools from espressif with their mysys32 enviroment.
af0815:
I have the helloworld in the SDK under MYSYS32 compiled. The full result is here https://drive.google.com/file/d/1TLg1UTOWFNlaaj-bzS5N5BBKKWivQ3yE/view?usp=sharing
This is the whole HelloWorld including all the files from build.
botster:
--- Quote from: ccrause on January 04, 2022, 06:59:42 am ---Indeed not clear, I agree. Xtensa is only supported in the development version of fpc, so a recent copy of the main branch is required. See https://www.freepascal.org/develop.html for different ways to get the development version source - I suggest using git as this way updating the source is relatively easy once configured. Or use fpcupdeluxe which automates the whole process of downloading fpc source and building the cross compiler.
--- End quote ---
Ah, okay. So the "fpc directory" should be the "fpc source directory". Got it.
Thank you.
--- Quote ---Some of the SDK has been translated in this project. Have a look at the examples to see what is possible at the moment. Not fully updated, so feel free to post issues against the project.
--- End quote ---
That looks very interesting. I'll have to delve into it when I have a bit more time.
I see that you have posted regarding an update to the wiki Xtensa instructions. I will comment further over there.
botster:
Using the updated instructions, I have made progress. Compiling ppcrossxtensa finished with no errors.
Now when I tried to compile the 'hello world' test program the first time, the linker complained that it could not find libc_fnano.a and libstdc++.a.
After removing the 'sysroot' directory (which does not exist) from the last compiler option:
--- 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";}};} ----Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib/The linker was able to find libstdc++.a, but still not libc_fnano.a.
libc_nano.a is in ~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib but not libc_fnano.a, and I don't know where that comes from as I do not find any ESP8266 or FPC source file that refers to it.
The content of the link*.res file in the project build directory (with paths normalized to the instructions) is:
--- 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";}};} ---SEARCH_DIR("~/esp/xtensa-lx106-elf-libs/")SEARCH_DIR("~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/")SEARCH_DIR("~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/")SEARCH_DIR("~/fpc/source/rtl/units/xtensa-freertos/")SEARCH_DIR("~/fpc/source/compiler/")INPUT (hello.o~/fpc/source/rtl/units/xtensa-freertos/system.o~/fpc/source/rtl/units/xtensa-freertos/esp8266.o~/fpc/source/rtl/units/xtensa-freertos/consoleio.o~/fpc/source/rtl/units/xtensa-freertos/heapmgr.o)GROUP(~/esp/xtensa-lx106-elf-libs/libesp8266.a~/esp/xtensa-lx106-elf-libs/liblog.alibc_fnano.a~/esp/xtensa-lx106-elf-libs/libnewlib.a~/esp/xtensa-lx106-elf-libs/libheap.a~/esp/xtensa-lx106-elf-libs/libvfs.a~/esp/xtensa-lx106-elf-libs/libesp_common.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/libcore.a~/esp/xtensa-lx106-elf-libs/libfreertos.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/libphy.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/libnet80211.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/libhal.a~/esp/xtensa-lx106-elf-libs/libnvs_flash.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/librtc.a~/esp/xtensa-lx106-elf-libs/libspi_flash.a~/esp/xtensa-lx106-elf-libs/libesp_ringbuf.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/libgcc.a~/esp8266/ESP8266_RTOS_SDK/components/esp8266/lib/libpp.a~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib/libstdc++.a~/esp/xtensa-lx106-elf-libs/libpthread.a)SECTIONS{ .data : { KEEP (*(.fpc .fpc.n_version .fpc.n_links)) }}
Is the 'f' in libc_fnano.a perhaps a typo that crept in somewhere?
What can I do to help diagnose this issue?
ccrause:
--- Quote from: botster on January 05, 2022, 12:58:03 am ---Using the updated instructions, I have made progress. Compiling ppcrossxtensa finished with no errors.
Now when I tried to compile the 'hello world' test program the first time, the linker complained that it could not find libc_fnano.a and libstdc++.a.
After removing the 'sysroot' directory (which does not exist) from the last compiler option:
--- 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";}};} ----Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib/The linker was able to find libstdc++.a, but still not libc_fnano.a.
libc_nano.a is in ~/esp/xtensa-lx106-elf/xtensa-lx106-elf/lib but not libc_fnano.a, and I don't know where that comes from as I do not find any ESP8266 or FPC source file that refers to it.
--- End quote ---
This is a dependency change from esp8266-rtos-sdk v3.3 to v3.4, perhaps due to the newer gcc toolchain. I'm busy testing a patch so that the compiler can generate the correct library requirements based on the SDK version.
Edit: proposed fix
Navigation
[0] Message Index
[#] Next page
[*] Previous page