- Wed Oct 01, 2014 12:00 pm
#1084
OK, here is a slightly more detailed explanation of what i did to get the GCC compiled, and subsequently compile the AT firmware.
Keep in mind that i work on Linux, i have no idea what prerequistes are needed to get it to compile on Windows, sorry.
First you need get two ZIP files. The first contain jcmvbkbc's fantastic build scripts:
https://github.com/jcmvbkbc/xtensa-toolchain-buildThen the GCC 4.8.1 ZIP that jcmvbkbc worked on to make it usable for the lx106 core:
https://github.com/jcmvbkbc/gcc-xtensa(On both pages there is a "Download ZIP" button to get the archives)
Now grab binutils-2.24 from here:
http://ftp.gnu.org/gnu/binutils/Then gdb-7.6 from here:
http://ftp.gnu.org/gnu/gdb/And finally newlib-2.0.0 from here:
http://ftp.gwdg.de/pub/linux/sources.redhat.com/newlib/(Not sure if that one is really required, but i dl'd it anyways)
OK, now you extract "xtensa-toolchain-build-master.tgz" first. This will create a directory "xtensa-toolchain-build-master" with a bunch of stuff in it. In that buil-directory you now extract the remaining archives. Next you edit the "config" file in there. Comment out (or delete" the line "GCC=gcc-4.9.1", and instead put in a line "GCC=gcc-xtensa-call0-4.8.2".
You may need to edit the variable called "PARALLEL" in there as well, in case you have less or more than 4 processor cores on your host machine.
Next you run "./prepare.sh lx106". This should finish very quickly and report no errors. Once that is done, you run "./build-elf.sh lx106" (EDIT: corrected this one, i forgot to mention the lx106 parameter) which will actually build the toolchain. It may be that it will complain and stop with an error if you have some required lib or -dev packages missing. For example, i had the libmsp-dev package missing, which i then installed through the package manager (apt-get in my case), and then re-run "./build-elf.sh lx106".
It will take a while to compile. Once it is through you are almost there to compile stuff for the ESP8266. I assume you have any of the leaked SDK and the AT firmware sources, those are needed now. First you need to copy two libs from the original toolchain into the SDK's lib directory. These two files are libc and libhal. In the original VM they are in:
XtDevTools/install/builds/RC-2010.1-win32/lx106/xtensa-elf/lib/libc.a
XtDevTools/install/builds/RC-2010.1-win32/lx106/xtensa-elf/arch/lib/libhal.a
Note: I will attach those two files to this post. The reason is simple: In the original VM you will also find the sources to them. Not only that, but they havee a permissive license, that is, one can freely do with them what she/he wants. So i can't see any problem attaching the precompiled binaries here.
Alright, now you have the two extra libs, next step is to edit my Makefile so that it uses the freshly compiled GCC, and also to have it point to the systems include directory, since some sources use things like "#include <string.h>". I attach a modified Makefile here, just edit the path's to the new GCC tools accordingly.
Now that this is done, you can run "make" in the AT firmware directory, assuming it's file/directory layout is adapted to my makefile, but this will throw up an error, telling you that "uint32_t" is redefined. The original SDK defines it in "c_types.h", but some sources also include <stdlib.h> where at some point it will reappear. Simple fix is to just comment out all references to stdlib.h whereever it complains about this.
Finally you should end up with a error free make process for the AT firmware. You will also need my esptool and have it compiled for linux. At the top of the Makefile for it just replace the "TARGET_ARCH = WINDOWS" with "TARGET_ARCH = LINUX", that's it. Run make and copy the resulting executable to whereever you need it according to you firmware Makefile.
Adter all this you should end up with the two .bin files that you can then upload to the flash on the module. Right now i still use the esptool.py, but i'm halfway through implementing that functionality in my tool as well (just had to stop for a while due to a customer project i had to work on).
I hope that this clears up a few things.
Here is the archive with the extra two libs:
extra_libs.tgz
And here a modified Makefile, you still need to edit it to reflect your setup:
Makefile.tgz
I will try to get the sources for the two extra libs to compile with this GCC if i have time, so that we can have a "clean" source-tree for those two as well. But feel free to look into that as well, if you like to. I certainly won't mind.
Again, many thanks to jcmvbkbc for his fantastic work on the build-scripts as well as the coompiler modifications!
Enjoy, and Greetings,
Chris
EDIT: Sorry, messed up the files while i was trying to re-upload the Makefile (had a wrong one in there). Fixed now.
You do not have the required permissions to view the files attached to this post.
Last edited by mamalala on Wed Oct 01, 2014 12:32 pm, edited 1 time in total.