-->
Page 34 of 55

Re: New Working GCC for ESP8266

PostPosted: Sat Nov 29, 2014 10:52 am
by jcmvbkbc
joostn wrote:Anyway I did a make clean; make and now I get linker errors as well:
Code: Select all"/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -L../../esp8266/esp_iot_sdk_V0.9.2/lib -L ../../esp8266/esp_iot_sdk_V0.9.2/ld/ -Teagle.app.v6.cpp.ld -Wl,--no-check-sections  -u call_user_start  -Wl,-static -nostdlib  -Xlinker -Map=build/test1.map -Wl,--gc-sections build/obj/uart.o build/obj/main.o build/obj/jnuclib.o build/obj/jnucgpio.o build/obj/jnucasync.o build/obj/jnuckeyboarddebouncer.o build/obj/jnuceventdispatcher.o build/obj/jnucinterruptonchange.o build/obj/jnucinterrupthandlers.o build/obj/jnucinternaltempsensor.o build/obj/jnucble.o build/obj/jnucblecommon.o build/obj/jnucblecentral.o build/obj/jnucdisplaybase.o build/obj/jnucbuffereddisplay.o build/obj/jnuccontrols.o build/obj/jnucpcd8544.o build/obj/jnucili9320.o build/obj/jnucst7735.o build/obj/jnucseps225.o build/obj/jnucsystick.o build/obj/jnucboards.o build/obj/jnucbitmap.o build/obj/jnucfonts.o build/obj/jnucWindowManager.o build/obj/jnucdialogs.o build/obj/someFonts.o build/obj/jnucrotary.o build/obj/jnuctimer.o build/obj/jnucservo.o build/obj/jnucuart.o build/obj/jnucstream.o build/obj/jnucnetcommon.o build/obj/jnuctcpserver.o build/obj/staticfunctionstub.o  -o build/test1.out
/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: warning: cannot find entry symbol call_user_start; defaulting to 0000000040100000
build/obj/jnucasync.o:(.text._ZN4jnuc9function0IvE14invokeEmbeddedIZNS_10TimerQueueC1EvEUlvE0_EEvPKS1_+0x18): undefined reference to `system_os_post'
build/obj/jnucasync.o: In function `void jnuc::function0<void>::invokeEmbedded<jnuc::TimerQueue::TimerQueue()::{lambda()#2}>(jnuc::function0<void> const*)':
jnucasync.cpp:(.text._ZN4jnuc9function0IvE14invokeEmbeddedIZNS_10TimerQueueC1EvEUlvE0_EEvPKS1_+0xc6): undefined reference to `system_os_post'
build/obj/jnucasync.o:(.text._ZN4jnuc10TimerQueue19RescheduleInterruptEv+0xc): undefined reference to `system_get_time'


You don't link with libmain.a which defines call_user_start, system_os_post and system_get_time. Try adding -lmain (and probably other -l directives) to the linker command line.

Re: New Working GCC for ESP8266

PostPosted: Sun Nov 30, 2014 8:53 am
by joostn
You're right of course, the libs were not linked. Not sure how this happened.
Anyway I'm back at the original esptool error. It generates a 16 byte .bin file and then quits.

If anyone finds the proper way to this let me know!

Re: New Working GCC for ESP8266

PostPosted: Sun Nov 30, 2014 9:13 am
by jcmvbkbc
joostn wrote:You're right of course, the libs were not linked. Not sure how this happened.
Anyway I'm back at the original esptool error. It generates a 16 byte .bin file and then quits.

If anyone finds the proper way to this let me know!

I've tried esptool.py elf2image with the produced elf and it succeeded. I've flashed resulting binaries but they fail to run.
Disassembling call_user_start shows that it calls a function that calls Cache_Read_Enable, which I believe sets up transparent SPI flash mapping to memory.
So these functions must be copied by the bootloader to IRAM and run from there, before code would be able to run directly from flash.

Re: New Working GCC for ESP8266

PostPosted: Mon Dec 01, 2014 8:42 am
by joostn
So these functions must be copied by the bootloader to IRAM and run from there, before code would be able to run directly from flash.

So could this be done using something like this?
Code: Select all .text : ALIGN(4)
  {
...
    libmain.a(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
...
  } >iram1_0_seg :iram1_0_phdr

irom0.text : ALIGN(4)
  {
...
    *(EXCLUDE_FILE(libmain.a) .literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
...
  } >irom0_0_seg :irom0_0_phdr

I tried a few things but couldn't get EXCLUDE_FILE to work at all. Stumbled upon this:
http://sourcerytools.com/pipermail/arm- ... 00224.html
which suggests EXCLUDE_FILE should be repeated multiple times in the line, but still it doesn't seem to match my .o files.