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

User avatar
By jcmvbkbc
#2388
Necromant wrote:Libc looks like newlib, but compiled in some weird way so that some things are missing (sscanf, atoi). Has anyone tried building newlib with crosstool? Why do we have to carry around libc.a?

I've added an xtensa patch for newlib to lx106-g++ branch of my crosstool repo, as libc is a prerequisite for libstdc++.
Mentioned that in the g++ thread, got no feedback so far. I've no hardware ATM (damaged my ESP01 trying to attach JTAG to it), so can't check how/if it works.
I will fix whatever issues there anyone would care to report.

Necromant wrote:That leaves us with a smallwer list of essential blobs we have no sources whatsoever:

  • libhal.a

This should be rather straightforward. I think I'll do it eventually, probably after cleaning up and upstreaming call0 ABI patches.
User avatar
By 0ff
#2390 libhal.a source is in the windows VM.
liblwip is upstream lwip 1.4.0 RC2, but with added ICACHE_FLASH_ATTR so that it's loaded off to the flash.
User avatar
By Necromant
#2396
tinhead wrote:libupgrade is usefull for ota fw updates, you can find sources of that lib on my 1drv. Json, well, that depends what one call usefull.


From what it looks like right now - it's very ugly and can be reworked in a much cleaner and simpler way.
For json - I'd prefer something opensource and supported, like jsmm. This thing looks like it's been ripped from something called Contiki with hell knows what modifications if any.

tinhead wrote:so? where is your point?


Just trying to make a list of blobs, what they do and find out what can be done to ditch them.

tinhead wrote:no, main is in ROM, libmain contains only call_user_start


Hm... Okay, they prefer to call it 'call_user_start', however technically it's the 'main()' of actual user firmware, and that's how they usually call it in other SoCs.
From how I made sense of the bootpath - iROM loads data from the start of SPI flash to internal SRAM and starts executing code there. And the first thing that's called 'call_user_start' that in turn
initializes watchdog and some other things and calls user_init();

Doing a little bit of disassembly, looks like libmain.a also contains a handfull of functions like wdt_*, wifi_*, ets_* and system_* calls. So it won't be that simple.
Last edited by Necromant on Mon Nov 10, 2014 4:57 am, edited 1 time in total.
User avatar
By Necromant
#2397
0ff wrote:libhal.a source is in the windows VM.
liblwip is upstream lwip 1.4.0 RC2, but with added ICACHE_FLASH_ATTR so that it's loaded off to the flash.


AFAIK there should be some cleaner way to send huge chunks of code to 'irom0.text' with some linker magic that doesn't require such bloody patching. Btw, remind me, does xtensa-gcc support -fPIC?