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

User avatar
By eriksl
#59067 Hi people,

I have been using the opensdk for some time, and I must say it works (in two senses) quite good. The only thing is the C compiler that is quite ancient now. I am hoping that newer gcc versions will have (even) better optimisation -> less code -> more space for IRAM (which I am constantly struggling with).

I noticed that Fedora 24 comes with a "prebuilt" xtensa cross compiler. I tried it, got it more or less working with some tweaking, but it appears this compiler generates code with endianness the wrong way around, so it's incompatible with the black box libs from ESP. Anyone know a workaround for that maybe?

Otherwise maybe knows a way to update gcc in opensdk? It seems it has been taken verbatim from a site that's no longer maintained. Also it seems that the "stock" xtensa gcc needs some patching get it working for esp8266 at all, so no use to download it from gcc itself.

Thx.
User avatar
By jcmvbkbc
#59093
eriksl wrote:I am hoping that newer gcc versions will have (even) better optimisation -> less code -> more space for IRAM (which I am constantly struggling with).

Not that much to make a difference.

eriksl wrote:I noticed that Fedora 24 comes with a "prebuilt" xtensa cross compiler. I tried it, got it more or less working with some tweaking, but it appears this compiler generates code with endianness the wrong way around, so it's incompatible with the black box libs from ESP. Anyone know a workaround for that maybe?

There's no workaround for that. The whole toolchain (compiler, assembler and linker) needs to be patched and rebuilt for a specific xtensa core.

eriksl wrote:Otherwise maybe knows a way to update gcc in opensdk?

cd crosstool-NG inside esp-open-sdk, run ./ct-ng menuconfig and select gcc-5.2.0 in the "C compiler" menu. Then run ./ct-ng build

eriksl wrote:It seems it has been taken verbatim from a site that's no longer maintained.

What do you mean?
User avatar
By eriksl
#59838 Thanks for you information. Sorry I didn't react for such a long time, I simply didn't get the notification.

If you say it isn't expected that the code will slim down, indeed, it has little use then.

Again, thx.