Recent

Author Topic: ESP8266 Compiling with xtensa-freertos  (Read 19117 times)

af0815

  • Hero Member
  • *****
  • Posts: 1291
ESP8266 Compiling with xtensa-freertos
« on: January 01, 2022, 05:47:49 pm »
I have created a crosscompiler for xtensa and the lx106 (ESP8266). But i am not able to compile a hello world. Exactly the compiling will work, but not the linking.

Code: Text  [Select][+][-]
  1. @echo on
  2. set IDF_PATH=C:\data\esp\ESP8266_RTOS_SDK
  3. cd C:\data\lazdev\xtensa\projects
  4. C:\data\lazdev\xtensa\fpc\bin\i386-win32\ppcrossxtensa -va -Furtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O3 -Wpesp8266 HelloWorld2.lpr -Fl~/esp/xtensa-lx106-elf-libs/ -FlC:\data\esp\ESP8266_RTOS_SDK\components/esp8266/lib -FlC:\data\esp\ESP8266_RTOS_SDK/components/newlib/newlib/lib -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib/
  5. pause
  6.  
My SDK is under c:\data\esp, not c.\esp to hold my root clean.

If i try my HelloWorld2.lpr to compile i get the following message.

Quote
....
[1.521] Searching file C:\data\lazdev\xtensa\cross\lib\xtensa-freertos\lx106\libstdc++.a... found
[1.523] Searching file C:\data\lazdev\xtensa\cross\lib\xtensa-freertos\lx106\libpthread.a... found
[1.527] Searching file C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe... found
[1.528] Using util C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe
[1.529] Executing "C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -C -P -x c -E -o /esp8266_out.ld -I / /components/esp8266/ld/esp8266.ld" using comspec "C:\WINDOWS\system32\cmd.exe"
[1.530] Executing "C:\WINDOWS\system32\cmd.exe" with command line " /C C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -C -P -x c -E -o /esp8266_out.ld -I / /components/esp8266/ld/esp8266.ld"
xtensa-lx106-elf-gcc.exe: error: /components/esp8266/ld/esp8266.ld: No such file or directory
xtensa-lx106-elf-gcc.exe: warning: '-x c' after last input file has no effect
xtensa-lx106-elf-gcc.exe: fatal error: no input files
compilation terminated.
[1.589] HelloWorld2.lpr(13,24) Error: Error while linking
[1.593] Searching file C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-objdump.exe... found
[1.594] Using util C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-objdump.exe
[1.595] Searching file HelloWorld2.o... found
[1.596] Searching file HelloWorld2.o... found
.....
Maybe i have not given all need information to the crosscompiler. But i created my HelloWorld according the  wiki https://wiki.lazarus.freepascal.org/Xtensa point 1.2.4 to test my crosscompiler.

Any hints how to get this working?   
regards
Andreas

bobihot

  • New Member
  • *
  • Posts: 36
Re: ESP8266 Compiling with xtensa-freertos
« Reply #1 on: January 01, 2022, 07:21:41 pm »
I currently work with him.
But the new one is with core RISK-V and may be good to transfer to him

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: ESP8266 Compiling with xtensa-freertos
« Reply #2 on: January 01, 2022, 07:50:25 pm »
I currently work with him.
But the new one is with core RISK-V and may be good to transfer to him
which is 'him' ? I am talking about ESP8266 - not him (or her)
regards
Andreas

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2023
  • Former Delphi 1-7, 10.2 user
Re: ESP8266 Compiling with xtensa-freertos
« Reply #3 on: January 01, 2022, 11:10:10 pm »
Dial back the attitude mate.

The previous poster, who was trying to help you and whose grasp of English pronouns or translation software may not be perfect, was suggesting that the new ESP8266s have RISK-V cores which may or may not help you.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: ESP8266 Compiling with xtensa-freertos
« Reply #4 on: January 02, 2022, 12:46:24 am »
Quote
error: /components/esp8266/ld/esp8266.ld: No such file or directory

Sounds like a wrong path. Maybe confused between backslash and frontslash?

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: ESP8266 Compiling with xtensa-freertos
« Reply #5 on: January 02, 2022, 09:06:10 am »
Quote
error: /components/esp8266/ld/esp8266.ld: No such file or directory

Sounds like a wrong path. Maybe confused between backslash and frontslash?
I think it is not confused by backslah/frontslash. I think its more a 'hidden' missing enviroment variable. One indication i have found in the wiki with IDF_PATH. But i think another internal information is missing.

@trev and bobihot: Sorry for misunderstanding. I am also a not native speaker and have my troubles with the translation (sometime with google too).
I have no indication that the esp8166 have risc-v. I f you mean other chips from expressif maybe. But this should only end in a wrong objectfile, but not in such a compiler message.

BTW @trev: Dial back the attitude mate -> is not understandable by me. google translate give me a nonsense message in my native language back.
regards
Andreas

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: ESP8266 Compiling with xtensa-freertos
« Reply #6 on: January 02, 2022, 02:25:06 pm »
If i compile with the option -sh
Code: Text  [Select][+][-]
  1. @echo on
  2. set IDF_PATH=C:\data\esp\ESP8266_RTOS_SDK
  3. cd C:\data\lazdev\xtensa\projects
  4. C:\data\lazdev\xtensa\fpc\bin\i386-win32\ppcrossxtensa -sh -Furtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O1 -Wpesp8266 HelloWorld2.lpr -Fl~/esp/xtensa-lx106-elf-libs/ -FlC:\data\esp\ESP8266_RTOS_SDK\components/esp8266/lib -FlC:\data\esp\ESP8266_RTOS_SDK/components/newlib/newlib/lib -Fl~/esp/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib/
  5. pause
  6.  
i get a ppas.bat file with the following content
Code: Pascal  [Select][+][-]
  1. @echo off
  2. SET THEFILE=helloworld2
  3. echo Assembling %THEFILE%
  4. C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-as.exe -o HelloWorld2.o  HelloWorld2.s --longcalls
  5. if errorlevel 1 goto asmend
  6. rem Del HelloWorld2.s
  7. SET THEFILE=HelloWorld2
  8. echo Linking %THEFILE%
  9. C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -C -P -x c -E -o /esp8266_out.ld -I / C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld
  10. ....
  11.  
in the line, where gcc is called, i get a error.
Quote
C:\data\lazdev\xtensa\projects>echo Linking HelloWorld2
Linking HelloWorld2

C:\data\lazdev\xtensa\projects>C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -C -P -x c -E -o /esp8266_out.ld -I / C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld
xtensa-lx106-elf-gcc.exe: error: CreateProcess: No such file or directory

C:\data\lazdev\xtensa\projects>if errorlevel 1 goto linkend1
What will he compile ?! I think i am missing here something.
Any hint ?
regards
Andreas

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: ESP8266 Compiling with xtensa-freertos
« Reply #7 on: January 02, 2022, 02:41:30 pm »
Run the problematic line in a terminal, and give it the same slash to eliminate the possibility of wrong slash.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: ESP8266 Compiling with xtensa-freertos
« Reply #8 on: January 02, 2022, 03:56:20 pm »
If you share the files produced by FPC, I can give it a shot. I already have xtensa SDK.

ccrause

  • Hero Member
  • *****
  • Posts: 862
Re: ESP8266 Compiling with xtensa-freertos
« Reply #9 on: January 02, 2022, 05:10:06 pm »
Quote
error: /components/esp8266/ld/esp8266.ld: No such file or directory

Sounds like a wrong path. Maybe confused between backslash and frontslash?
I think it is not confused by backslah/frontslash. I think its more a 'hidden' missing enviroment variable. One indication i have found in the wiki with IDF_PATH. But i think another internal information is missing.

This may be a Windows specific compiler bug  The path to esp8266.ld is supposed to start with the project exe output folder, which in this case appears to be empty/unspecified.  Do you see other compiler generated files such as Kconfig or kconfig.in etc in your project folder?

As a test, please adding the following to you compiler command:
Code: [Select]
-FEc:\somefolder\HelloWorldThen report which files end up in this folder during the whole build process.
« Last Edit: January 02, 2022, 05:13:18 pm by ccrause »

ccrause

  • Hero Member
  • *****
  • Posts: 862
Re: ESP8266 Compiling with xtensa-freertos
« Reply #10 on: January 02, 2022, 05:33:38 pm »
Code: Text  [Select][+][-]
  1. set IDF_PATH=C:\data\esp\ESP8266_RTOS_SDK

For information, you can also use the command line option -Ff to pass the SDK path to the compiler as alternative to setting IDF_PATH as environment variable.  This makes it a little easier to compile from inside Lazarus...

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: ESP8266 Compiling with xtensa-freertos
« Reply #11 on: January 02, 2022, 05:58:48 pm »
As a test, please adding the following to you compiler command:
Code: [Select]
-FEc:\somefolder\HelloWorldThen report which files end up in this folder during the whole build process.
I have inserted the whole project after the run of test.cmd with all files. In test.cmd is the call for the compiler.
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 862
Re: ESP8266 Compiling with xtensa-freertos
« Reply #12 on: January 02, 2022, 06:48:58 pm »
As a test, please adding the following to you compiler command:
Code: [Select]
-FEc:\somefolder\HelloWorldThen report which files end up in this folder during the whole build process.
I have inserted the whole project after the run of test.cmd with all files. In test.cmd is the call for the compiler.

Thanks, at least adding -FE seemed to have fixed the path to esp8266_out.ld:
Code: [Select]
C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -C -P -x c -E -o C:\data\lazdev\xtensa\projects\/esp8266_out.ld ...
Can you run the ppas.bat and see how far you get?  I'm not sure if Windows will complain about the \/ combination in the path.  If you still get an error when executing this line, try formatting slashes into proper Windows format. This can be fixed in the compiler.

Do you know the date of the compiler source code used to build your cross compiler (i.e. when was the compiler source pulled from git)?  There were a couple of changes around November that may impact your situation.

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: ESP8266 Compiling with xtensa-freertos
« Reply #13 on: January 02, 2022, 07:11:30 pm »
Quote
Lazarus 2.3.0 (rev main-2_3-586-ga9457c2f2b) FPC 3.3.1 i386-win32-win32/win64

FPC:
git log
commit 116c861af6c13f6d3d0d0d91b6dc4e0c1eb88550 (HEAD -> main, origin/main, origin/HEAD)
Author: J. Gareth "Curious Kit" Moreton <gareth@moreton-family.com>
Date:   Mon Dec 27 16:18:13 2021 +0000

    MOV/CMP optimisation is now in both Pass 1 and Pass 2 to catch more
    eventualities
Actual output from ppas.bat (with echo on) as attachment

Edit: the correction of the slashes have no effect
But i have looked at "-I C:\data\lazdev\xtensa\projects\" - the option -I is not found if i ask the help from the cross-gcc
« Last Edit: January 02, 2022, 07:15:53 pm by af0815 »
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 862
Re: ESP8266 Compiling with xtensa-freertos
« Reply #14 on: January 02, 2022, 09:00:45 pm »
Quote
Lazarus 2.3.0 (rev main-2_3-586-ga9457c2f2b) FPC 3.3.1 i386-win32-win32/win64

FPC:
git log
commit 116c861af6c13f6d3d0d0d91b6dc4e0c1eb88550 (HEAD -> main, origin/main, origin/HEAD)
Author: J. Gareth "Curious Kit" Moreton <gareth@moreton-family.com>
Date:   Mon Dec 27 16:18:13 2021 +0000

OK, that is recent enough.

Quote
Actual output from ppas.bat (with echo on) as attachment

Edit: the correction of the slashes have no effect
The following error seems to indicate there is still a file missing: xtensa-lx106-elf-gcc.exe: error: CreateProcess: No such file or directory.  Or at least a file that is not located in any of the search directories that gcc knows.  Or perhaps that gcc cannot create the output file?  Just to confirm, do you get the same error message when the slashes are corrected?

Quote
But i have looked at "-I C:\data\lazdev\xtensa\projects\" - the option -I is not found if i ask the help from the cross-gcc
-I is a standard gcc option. It may not be obvious from the command line help.  Try just plain
Code: [Select]
xtensa-lx106-elf-gcc.exe -IThis should say like the following:
Quote
xtensa-lx106-elf-gcc: error: missing path after '-I'

 

TinyPortal © 2005-2018