Recent

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

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #15 on: January 02, 2022, 09:25:29 pm »
You can also add -v to the gcc command in ppas.bat to see more details:
Code: [Select]
C:\data\lazdev\xtensa\projects>C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -v -C -P -x c -E -o C:\data\lazdev\xtensa\projects\/esp8266_out.ld -I C:\data\lazdev\xtensa\projects\/ C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #16 on: January 02, 2022, 09:37:58 pm »
As i said, correction of the slashes did not change the errormessage for me. The message came from xtensa-lx106-elf-gcc.exe itself.

The reason for me to use the -sh option, is to detect the error on commandline direct.

in the meanwhile i have inserted the -v


Quote
C:\data\lazdev\xtensa\projects>C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -v -C -P -x c -E -o C:\data\lazdev\xtensa\projects\esp8266_out.ld -I C:\data\lazdev\xtensa\projects\ C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld
Using built-in specs.
COLLECT_GCC=C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe
Target: xtensa-lx106-elf
Configured with: /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=i686-host_w64-mingw32 --target=xtensa-lx106-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf --with-headers=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/include --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG esp-2020r3-49-gd5524c1' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --with-mpfr=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --with-mpc=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --with-isl=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-libstdcxx-time=yes
Thread model: posix
gcc version 8.4.0 (crosstool-NG esp-2020r3-49-gd5524c1)
COLLECT_GCC_OPTIONS='-v' '-C' '-P' '-E' '-o' 'C:\data\lazdev\xtensa\projects\esp8266_out.ld' '-I' 'C:\data\lazdev\xtensa\projects\'
 cc1 -E -quiet -C -v -I C:\data\lazdev\xtensa\projects\ -P -iprefix c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/ C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld -o C:\data\lazdev\xtensa\projects\esp8266_out.ld
xtensa-lx106-elf-gcc.-iprefix c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/exe: error: CreateProcess: No such file or directory
One line is interesting.
Quote
-iprefix c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/exe
I think this line produces the error



regards
Andreas

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #17 on: January 02, 2022, 09:42:44 pm »
The dir
Quote
C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\libexec\gcc\xtensa-lx106-elf\8.4.0
exist without exe dir.
Quote
c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/exe
is a miracle.
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #18 on: January 02, 2022, 10:03:54 pm »
As i said, correction of the slashes did not change the errormessage for me. The message came from xtensa-lx106-elf-gcc.exe itself.

The reason for me to use the -sh option, is to detect the error on commandline direct.

in the meanwhile i have inserted the -v


Quote
C:\data\lazdev\xtensa\projects>C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe -v -C -P -x c -E -o C:\data\lazdev\xtensa\projects\esp8266_out.ld -I C:\data\lazdev\xtensa\projects\ C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld
Using built-in specs.
COLLECT_GCC=C:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\xtensa-lx106-elf-gcc.exe
Target: xtensa-lx106-elf
Configured with: /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=i686-host_w64-mingw32 --target=xtensa-lx106-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf --with-headers=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/include --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG esp-2020r3-49-gd5524c1' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --with-mpfr=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --with-mpc=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --with-isl=/builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-lx106-elf/buildtools/complibs-host --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-libstdcxx-time=yes
Thread model: posix
gcc version 8.4.0 (crosstool-NG esp-2020r3-49-gd5524c1)
COLLECT_GCC_OPTIONS='-v' '-C' '-P' '-E' '-o' 'C:\data\lazdev\xtensa\projects\esp8266_out.ld' '-I' 'C:\data\lazdev\xtensa\projects\'
 cc1 -E -quiet -C -v -I C:\data\lazdev\xtensa\projects\ -P -iprefix c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/ C:\data\esp\ESP8266_RTOS_SDK/components/esp8266/ld/esp8266.ld -o C:\data\lazdev\xtensa\projects\esp8266_out.ld
xtensa-lx106-elf-gcc.-iprefix c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/exe: error: CreateProcess: No such file or directory
One line is interesting.
Quote
-iprefix c:\data\lazdev\xtensa\cross\bin\xtensa-freertos\bin\../lib/gcc/xtensa-lx106-elf/8.4.0/exe
I think this line produces the error

That is interesting indeed. Not sure how to fix that.  I checked with my setup on Linux, but the cross-gcc version is much older (5.2.0) and the output looks quite a bit different.

A way to skip all the hassle of recreating the linker scripts is to copy the original linker scripts generated when building the example project into the library folder.  The original scripts are esp8266_out.ld and esp8266.project.ld.  Find these in the original SDK example build folder (in my case it is in the build/esp8266 folder, together with libesp8266.a) and copy into the same destination folder as the other libraries. In your case it should go into C:\data\lazdev\xtensa\cross\lib\xtensa-freertos\lx106\ (I assume this is where libesp8266.a and other libraries are saved).

If the compiler can locate these scripts (it searches in the library folders list) it will not try to regenerate them, avoiding this troublesome gcc call and also the following ldgen.py script.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #19 on: January 07, 2022, 09:33:35 am »
Due the troubles with compiling under Linux - https://forum.lazarus.freepascal.org/index.php?topic=57725.msg429858;topicseen#msg429858 - i will suspend my test. If it works under Linux, i will test it with Linux too and than think about windows.
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #20 on: January 07, 2022, 11:56:06 am »
I tried configuring Windows 10 Personal according to the instructions given by Espressif, but I cannot get python to work in the msys2 environment.  Can you perhaps give your steps to get to the point of building a SDK example? Specifically getting a command environment where one can execute make to compile a SDK example.  After that I can start testing on Windows.

Regarding Linux, I have compiled and tested all these examples with esp8266-rtos-sdk v3.3 and some with v3.4 on an esp8266 board (with the exception of one or two esp32 specific projects).  If anything doesn't work, it is only a matter of finding out what configuration setting is different from a working setup and fixing that.  Unfortunately there are a number of different tools and libraries involved, so it sometimes isn't easy to identify a problem.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #21 on: January 08, 2022, 08:21:53 am »
Actual i have removed the whole msys2 installation.

As i remember i have used pacman. I have found a hint here https://stackoverflow.com/questions/50784367/how-to-install-python-development-tools-on-msys2

Edit: I'm setuping this new - BUT the python is included in the MSYS2 installation from espressif.

Quote
$ pacman -Qs python
local/mingw-w64-i686-python2 2.7.15-2
    A high-level scripting language (mingw-w64)
local/mingw-w64-i686-python2-appdirs 1.4.3-3
    A small Python module for determining appropriate platform-specific dirs,
    e.g. a "user data dir" (mingw-w64)
local/mingw-w64-i686-python2-asn1crypto 0.24.0-2
    Python ASN.1 library with a focus on performance and a pythonic API
    (mingw-w64)
local/mingw-w64-i686-python2-cachecontrol 0.12.5-1
    httplib2 caching for requests (mingw-w64)
local/mingw-w64-i686-python2-certifi 2018.8.24-1
    Python package for providing Mozilla's CA Bundle (mingw-w64)
local/mingw-w64-i686-python2-cffi 1.11.5-2
    Foreign Function Interface for Python calling C code (mingw-w64)
local/mingw-w64-i686-python2-chardet 3.0.4-2
    Python2 module for character encoding auto-detection (mingw-w64)
local/mingw-w64-i686-python2-colorama 0.3.9-3
    Python API for cross-platform colored terminal text (mingw-w64)
local/mingw-w64-i686-python2-cryptography 2.3.1-1
    A package designed to expose cryptographic recipes and primitives to Python
    developers (mingw-w64)
local/mingw-w64-i686-python2-distlib 0.2.7-1
    Low-level components of distutils2/packaging (mingw-w64)
local/mingw-w64-i686-python2-html5lib 1.0.1-3
    A Python HTML parser/tokenizer based on the WHATWG HTML5 spec (mingw-w64)
local/mingw-w64-i686-python2-idna 2.7-2
    Internationalized Domain Names in Applications (mingw-w64)
local/mingw-w64-i686-python2-ipaddress 1.0.22-1
    Port of the 3.3+ ipaddress module to 2.6, 2.7, 3.2 (mingw-w64)
local/mingw-w64-i686-python2-lockfile 0.12.2-1
    Platform-independent file locking module (mingw-w64)
local/mingw-w64-i686-python2-msgpack 0.5.6-1
    MessagePack serializer implementation for Python (mingw-w64)
local/mingw-w64-i686-python2-packaging 17.1-1
    Core utilities for Python packages (mingw-w64)
local/mingw-w64-i686-python2-pip 18.0-2
    An easy_install replacement for installing pypi python packages (mingw-w64)
local/mingw-w64-i686-python2-ply 3.11-2
    Implementation of lex and yacc parsing tools (mingw-w64)
local/mingw-w64-i686-python2-progress 1.4-3
    Easy to use progress bars for Python (mingw-w64)
local/mingw-w64-i686-python2-pyasn1 0.4.4-1
    ASN.1 types and codecs (mingw-w64)
local/mingw-w64-i686-python2-pycparser 2.19-1
    Complete parser of the C language, written in pure Python (mingw-w64)
local/mingw-w64-i686-python2-pyparsing 2.2.0-3
    General parsing module for Python (mingw-w64)
local/mingw-w64-i686-python2-pytoml 0.1.19-1
    A TOML-0.4.0 parser/writer for Python. (mingw-w64)
local/mingw-w64-i686-python2-requests 2.19.1-3
    Requests is the only Non-GMO HTTP library for Python, safe for human
    consumption. (mingw-w64)
local/mingw-w64-i686-python2-retrying 1.3.3-1
    A general purpose Python retyring library (mingw-w64)
local/mingw-w64-i686-python2-setuptools 40.4.3-1
    Easily download, build, install, upgrade, and uninstall Python packages
    (mingw-w64)
local/mingw-w64-i686-python2-six 1.11.0-2
    Python 2 and 3 compatibility utilities (mingw-w64)
local/mingw-w64-i686-python2-urllib3 1.23-2
    HTTP library with thread-safe connection pooling and file post support
    (mingw-w64)
local/mingw-w64-i686-python2-webencodings 0.5.1-3
    This is a Python implementation of the WHATWG Encoding standard (mingw-w64)

Insert in .bash_profile (in MSYS2 home/username to find)
export IDF_PATH="${HOME}/esp/ESP8266_RTOS_SDK"
PATH="/d/data/xtensa-lx106-elf/bin:${PATH}"

BTW - my installation of all tools is in D:\data

Quote

$ make flash
Toolchain path: /d/data/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: esp-2020r3-49-gd5524c1
Compiler version: 8.4.0
Python requirements from D:/data/msys32/home/andi/esp/ESP8266_RTOS_SDK/requirements.txt are satisfied.
CC build/bootloader/main/bootloader_start.o
AR build/bootloader/main/libmain.a
CC build/bootloader/bootloader_support/src/bootloader_random.o
CC build/bootloader/bootloader_support/src/flash_encrypt.o
CC build/bootloader/bootloader_support/src/bootloader_sha.o
$ make flash
Toolchain path: /d/data/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: esp-2020r3-49-gd5524c1
Compiler version: 8.4.0
Python requirements from D:/data/msys32/home/andi/esp/ESP8266_RTOS_SDK/requirements.txt are satisfied.
CC build/bootloader/main/bootloader_start.o
AR build/bootloader/main/libmain.a
CC build/bootloader/bootloader_support/src/bootloader_random.o
CC build/bootloader/bootloader_support/src/flash_encrypt.o
CC build/bootloader/bootloader_support/src/bootloader_sha.o
.....
CC build/wpa_supplicant/src/wps/wps_attr_process.o
AR build/wpa_supplicant/libwpa_supplicant.a
Generating esp8266.project.ld
LD build/hello-world.elf
esptool.py v2.4.0
Flashing binaries to serial port COM3 (app at offset 0x10000)...
esptool.py v2.4.0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 4c:75:25:10:c4:08
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 10432 bytes to 7018...
Wrote 10432 bytes (7018 compressed) at 0x00000000 in 0.6 seconds (effective 130.5 kbit/s)...
Hash of data verified.
Compressed 169280 bytes to 108550...
Wrote 169280 bytes (108550 compressed) at 0x00010000 in 9.6 seconds (effective 140.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 83...
Wrote 3072 bytes (83 compressed) at 0x00008000 in 0.0 seconds (effective 1534.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Its running on the device
Quote
ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 7040, room 16
chksum 0x20
load 0x3ffe8408, len 24, room 8
tail 0
chksum 0xa9
load 0x3ffe8420, len 3324, room 8
tail 4
chksum 0xe3
csum 0xe3
I (84) boot: ESP-IDF v3.4-53-g83517ba1 2nd stage bootloader
I (84) boot: compile time 10:31:29
I (84) qio_mode: Enabling default flash chip QIO
I (100) boot: SPI Speed      : 40MHz
I (113) boot: SPI Mode       : QIO
I (126) boot: SPI Flash Size : 2MB
I (139) boot: Partition Table:
I (150) boot: ## Label            Usage          Type ST Offset   Length
I (173) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (196) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (219) boot:  2 factory          factory app      00 00 00010000 000f0000
I (242) boot: End of partition table
I (255) esp_image: segment 0: paddr=0x00010010 vaddr=0x40210010 size=0x1cc70 (11
7872) map
0x40210010: _stext at ??:?

I (338) esp_image: segment 1: paddr=0x0002cc88 vaddr=0x4022cc80 size=0x071f0 ( 2
9168) map
I (353) esp_image: segment 2: paddr=0x00033e80 vaddr=0x3ffe8000 size=0x00544 (
1348) load
I (361) esp_image: segment 3: paddr=0x000343cc vaddr=0x40100000 size=0x00080 (
 128) load
I (388) esp_image: segment 4: paddr=0x00034454 vaddr=0x40100080 size=0x050c0 ( 2
0672) load
I (424) boot: Loaded app from partition at offset 0x10000
Hello world!
This is ESP8266 chip with 1 CPU cores, WiFi, silicon revision 1, 2MB external fl
ash
The next step can be the tests with fpc. The MSYS2 System is up and running.

« Last Edit: January 08, 2022, 10:43:01 am by af0815 »
regards
Andreas

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #22 on: January 08, 2022, 02:14:52 pm »
compiling with windows: i patched fpcupdeluxe to work with the correct tools and adapted the fpc.cfg for the correct type. And build the crosscompiler. this well done (says fpcupdeluxe)

Now i use the following script to make the steps more transparent
Code: Text  [Select][+][-]
  1. @echo on
  2. set IDF_PATH=D:\data\msys32\home\andi\esp\ESP8266_RTOS_SDK
  3. cd D:\data\lazdev\xtensa\projects\helloworld
  4. D:\data\lazdev\xtensa\fpc\bin\i386-win32\ppcrossxtensa -sh -Furtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O- -Wpesp8266 -WP4.0 HelloWorld2.lpr -FlD:\data\msys32\home\andi\esp\xtensa-lx106-elf-libs -FlD:\data\msys32\home\andi\esp\ESP8266_RTOS_SDK\components/esp8266/lib -FED:\data\lazdev\xtensa\projects\helloworld
  5. pause
  6.  
after this i get a ppas.bat. if i start this i get
Quote
Assembling helloworld2
Linking D:\data\lazdev\xtensa\projects\helloworld\HelloWorld2
D:\data\xtensa-lx106-elf\bin\xtensa-lx106-elf-ld.exe: cannot find libc_fnano.a
D:\data\xtensa-lx106-elf\bin\xtensa-lx106-elf-ld.exe: cannot find libstdc++.a
An error occurred while linking D:\data\lazdev\xtensa\projects\helloworld\HelloWorld2
Drücken Sie eine beliebige Taste . . .
it will correct because c_fnano and libstdc++ are not built for this target.
« Last Edit: January 08, 2022, 02:22:03 pm by af0815 »
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #23 on: January 08, 2022, 04:19:56 pm »
Code: Text  [Select][+][-]
  1.  -WP4.0
after this i get a ppas.bat. if i start this i get
Quote
Assembling helloworld2
Linking D:\data\lazdev\xtensa\projects\helloworld\HelloWorld2
D:\data\xtensa-lx106-elf\bin\xtensa-lx106-elf-ld.exe: cannot find libc_fnano.a
D:\data\xtensa-lx106-elf\bin\xtensa-lx106-elf-ld.exe: cannot find libstdc++.a

Interesting, it seems as if fpcupdeluxe did not pull the latest fpc source.  At least I cannot find an esp8266rtos_30400.pp mentioned in the fpcupdeluxe.txt file, which is the unit that determines the basic library list for linking. This file should be located in fpcsrc\rtl\freertos\xtensa\ folder.  If it is there, it is not included in the MakeFile, which should include this unit in the list of compiled units.

Also, the latest esp8266 SDK version is 3.4, so specify -WP3.4 .  If this is a fpcupdeluxe supplied parameter it should be corrected there.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #24 on: January 08, 2022, 04:36:53 pm »
According https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#get-started-get-esp-idf it is cloned from git and in ESP8266_RTOS_SDK/make/version.mkit is coded as
Quote
IDF_VERSION_MAJOR := 4
IDF_VERSION_MINOR := 0
IDF_VERSION_PATCH := 0
this is IMHO 4.0.

This is not a standard parameter of fpcupdeluxe.

Edit:
If it is not the absolute latest version of FPC, it can be my fault. I have fight against the wrong detection of the tollset at building the cross compiler, so it can be the basic fpc is few days old. I am correcting this yet.
Quote
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC was at revision/hash: 3.3.1-9835-g3cf00af48d
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC is now at revision/hash: 3.3.1-9884-g307c284f6a
« Last Edit: January 08, 2022, 04:46:09 pm by af0815 »
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #25 on: January 08, 2022, 07:11:39 pm »
According https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#get-started-get-esp-idf it is cloned from git and in ESP8266_RTOS_SDK/make/version.mkit is coded as
Quote
IDF_VERSION_MAJOR := 4
IDF_VERSION_MINOR := 0
IDF_VERSION_PATCH := 0
this is IMHO 4.0.

This is not a standard parameter of fpcupdeluxe.

Edit:
If it is not the absolute latest version of FPC, it can be my fault. I have fight against the wrong detection of the tollset at building the cross compiler, so it can be the basic fpc is few days old. I am correcting this yet.
Quote
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC was at revision/hash: 3.3.1-9835-g3cf00af48d
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC is now at revision/hash: 3.3.1-9884-g307c284f6a

OK, seems like you are on the trunk version of esp8266-rtos-sdk which is not tested with fpc to check the build requirements. Using - WP4.0 in fpc should then fall back to the v3. 4 SDK settings.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #26 on: January 08, 2022, 07:30:45 pm »
This is the 'official' way of installing the sdk according the website.
regards
Andreas

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #27 on: January 09, 2022, 02:36:45 pm »
This is the 'official' way of installing the sdk according the website.
Yes, I see. The problem is that the current esp8266 Get Started link results in installing the latest master branch, which is updated weekly.  This presents a shifting support target, my preference would be to only support release versions.  But this doesn't appear to be the cause of your compilation problems.

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: ESP8266 Compiling with xtensa-freertos
« Reply #28 on: January 09, 2022, 03:10:22 pm »
compiling with windows: i patched fpcupdeluxe to work with the correct tools and adapted the fpc.cfg for the correct type. And build the crosscompiler. this well done (says fpcupdeluxe)

Now i use the following script to make the steps more transparent
Code: Text  [Select][+][-]
  1. @echo on
  2. set IDF_PATH=D:\data\msys32\home\andi\esp\ESP8266_RTOS_SDK
  3. cd D:\data\lazdev\xtensa\projects\helloworld
  4. D:\data\lazdev\xtensa\fpc\bin\i386-win32\ppcrossxtensa -sh -Furtl/units/xtensa-freertos/ -Tfreertos -XPxtensa-lx106-elf- -O- -Wpesp8266 -WP4.0 HelloWorld2.lpr -FlD:\data\msys32\home\andi\esp\xtensa-lx106-elf-libs -FlD:\data\msys32\home\andi\esp\ESP8266_RTOS_SDK\components/esp8266/lib -FED:\data\lazdev\xtensa\projects\helloworld
  5. pause
  6.  
after this i get a ppas.bat. if i start this i get
Quote
Assembling helloworld2
Linking D:\data\lazdev\xtensa\projects\helloworld\HelloWorld2
D:\data\xtensa-lx106-elf\bin\xtensa-lx106-elf-ld.exe: cannot find libc_fnano.a
D:\data\xtensa-lx106-elf\bin\xtensa-lx106-elf-ld.exe: cannot find libstdc++.a
An error occurred while linking D:\data\lazdev\xtensa\projects\helloworld\HelloWorld2
Drücken Sie eine beliebige Taste . . .
it will correct because c_fnano and libstdc++ are not built for this target.

If -WP is larger than 3.3 fpc should load unit esp8266rtos_30400, which only links to libc_nano, not libc_fnano.  Your attached build log does not show a unit esp8266_30300 or esp8266_30400 being build, so something is funny with the version of the cross fpc as downloaded and/or build by fpcupdeluxe. 

Can you verify that esp8266_30300.pp and esp8266_30400.pp do exist in D:/data/lazdev/xtensa/fpcsrc/rtl/freertos/xtensa and also that these units are referenced in /fpcsrc/rtl/freertos/MakeFile?  These changes were implemented in this commit, but was included before commit 307c284f6a which is your latest fpc revision.  So this is a bit puzzling...

Then there remains a problem with locating libstdc++.  In the latest bin tools this library should be located in D:\data\xtensa-lx106-elf\xtensa-lx106-elf\lib, together with libc_nano.  You either have to copy the libraries in this folder to your overall library folder (D:\data\msys32\home\andi\esp\xtensa-lx106-elf-lib) if these libraries are not already there, or add another -FlD:\data\xtensa-lx106-elf\xtensa-lx106-elf\lib statement to your project's compile command to add this path to fpc's library search list.

Disclaimer: I'm translating from Linux paths to what I assume is equivalent to your Windows folder structures, but the exact paths I mention above may not be correct.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: ESP8266 Compiling with xtensa-freertos
« Reply #29 on: January 09, 2022, 03:21:45 pm »
I have changed to the 3.4 version (with git no problem). And rebuild the example and copy the produced files to xtensa-lx106-elf-libs like int the Xtensa - FPC wiki described

Ok, now the problem with libc_nano and  libstdc++.a are gone.

Actual i have
Quote
Assembling blink
Linking D:\data\lazdev\xtensa\projects\blink\blink
Linking D:\data\lazdev\xtensa\projects\blink\blink
Traceback (most recent call last):
  File "D:\data\msys32\home\andi\esp\ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py", line 35, in <module>
    import serial.tools.list_ports as list_ports
ModuleNotFoundError: No module named 'serial'
An error occurred while linking D:\data\lazdev\xtensa\projects\blink\blink
Drücken Sie eine beliebige Taste . . .
But this looks python specific problem and i must handle this.

it is a bit tricky :-)
Code: Text  [Select][+][-]
  1. python -m pip install --upgrade pip
  2. pip uninstall serial
  3. pip uninstall pyserial
  4. pip install pyserial
  5.  
you must first upgrade to the last pip version, then uninstall serial and pyserial, because there is maybe an internal naming conflict, after this you can reinstall pyserial (only)
Now i get a blink.bin
 
« Last Edit: January 09, 2022, 03:34:59 pm by af0815 »
regards
Andreas

 

TinyPortal © 2005-2018