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

User avatar
By alonewolfx2
#3742 i cleaned up and try again. but i have same issue
User avatar
By jcmvbkbc
#3744
alonewolfx2 wrote:firstline works without any output.
did you mean "make clean" and "make STANDALONE=y" ?

I mean git clean -fd in esp-open-sdk, crosstool-NG and lx106-hal directories, rm -rf esp-open-sdk/crosstool-NG/.build/src and then make STANDALONE=y
User avatar
By Bananis
#3872 Hey,

Here is a version of the makefile that also builds images for cloud update (user1.bin and user2.bin). This makes it possible to directly update your own code to the device over WIFI, see my writeup here on how to make it work: http://www.esp8266.com/viewtopic.php?f=9&t=620. Saves a lot of time :)

I use the toolchain with Mingw64. You need to copy gen_flashbin.py from the tools folder in the SDK to where you have esptool.exe

/Bananis
You do not have the required permissions to view the files attached to this post.
User avatar
By joostn
#3967
jcmvbkbc wrote:This script produces ELF as expected, but still doesn't work when I flash it. Maybe I'm doing something wrong as well...

I found a way to get all code in Flash by default! Modify the linker script as follows:
Code: Select all .text : ALIGN(4)
  {
...
/*    *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) */
    *(.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)
  {
    _irom0_text_start = ABSOLUTE(.);
    *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
    *(.literal.* .text.*)
    _irom0_text_end = ABSOLUTE(.);
  } >irom0_0_seg :irom0_0_phdr

So I've moved the .text.* and .literal.* to the irom0 section. I've added '-ffunction-sections -fdata-sections' to the gcc compiler flags, which causes my own code to go into .text.* instead of .text. The startup code is in .text so it will end up in the right section.