Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By eriksl
#96353 Ok, got quite far, but now it bails on building newlib and now I know why: in the currently used version of ct-ng, newlib v2.0.0 is available which has xtensa support. This version is now dropped, so there is no more newlib support for xtensa. I will have to check if jcmvbkbc has patches for this in the meantime, or maybe someone else, or I will be stuck here. I have no clue what's required to have newlib building on xtensa, I'd say actually nothing special, but who knows...
User avatar
By eriksl
#96354 Not yet completely finished, but it looks like the build process now proceeds without issues.

This is what I did. I maintain a fork of the crosstool-NG git(hub) repo, which has the relevant changes from Max Filipov applied (cherry picked) on top. Somewhere in the last year the original crosstool-ng had newlib 2.0.0 removed (as being obsolete). I simply took the relevant commit (nice and clean) and reverted it in my fork. Now newlib 2.0.0, with patches from Max, is available again.

Update: the build now stops with an error, though:
Code: Select all[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:56: error: 'intptr_t' undeclared (first use in this function)
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:65: error: expected ',' or ';' before 'counters'
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:559:39: error: expected ';' before 'new_node'
[ERROR]    make[4]: *** [Makefile:921: _gcov_merge_add.o] Error 1
[ERROR]    make[4]: *** Waiting for unfinished jobs....
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:56: error: 'intptr_t' undeclared (first use in this function)
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:65: error: expected ',' or ';' before 'counters'
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:559:39: error: expected ';' before 'new_node'
[ERROR]    make[4]: *** [Makefile:921: _gcov_merge_topn.o] Error 1
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:56: error: 'intptr_t' undeclared (first use in this function)
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:65: error: expected ',' or ';' before 'counters'
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:559:39: error: expected ';' before 'new_node'
[ERROR]    make[4]: *** [Makefile:921: _gcov_merge_ior.o] Error 1
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:56: error: 'intptr_t' undeclared (first use in this function)
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:510:65: error: expected ',' or ';' before 'counters'
[ERROR]    /home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/libgcc/libgcov.h:559:39: error: expected ';' before 'new_node'
[ERROR]    make[4]: *** [Makefile:921: _gcov_merge_time_profile.o] Error 1
[ERROR]    make[3]: *** [Makefile:13271: all-target-libgcc] Error 2

Let's me look into this. Maybe we can completely disable this libgcov thing.
User avatar
By eriksl
#96355 The libgcov thing I was able to fix (typedef unsigned long long int intptr_t), but now I have an error I really don't know how to fix:

Code: Select all/home/erik/src/esp/crosstool-NG/.build/xtensa-lx106-elf/src/gcc/gcc/../include/ansidecl.h:40:1: error: expected initializer before 'extern'


There is really nothing wrong with this code:

Code: Select all#ifndef _ANSIDECL_H
#define _ANSIDECL_H 1

#ifdef __cplusplus
extern "C" {
#endif
User avatar
By davydnorris
#96357 I used the espressif/crosstool-NG repo revved to the latest, which is on the crosstool esp-1.25.x branch, and then I added back the esp8266 sample from the last time it was available, and compared it with the existing ones to update.

When I tried to build this I got an error in zlib, which was mentioned in an issue - it needs to be updated to latest, which is 1.2.13, so I updated the package info for that directly from the main crosstool repo . Then I built

Here are the sample files - these need to be put under the directory xtensa-esp8266-elf (note the name change)
You do not have the required permissions to view the files attached to this post.