I am in Ubuntu 18.04 using the tool chain provided in : pfalcon/esp-open-sdk
To build the self-contained, standalone toolchain+SDK:
$ make STANDALONE=y
This is the default choice which most people are looking for, so just the following is enough:
$ make
To build the bare Xtensa toolchain and leave ESP8266 SDK separate:
$ make STANDALONE=n
From those make options I used the plain "make". Don't really know why.
I can compile the code without any errors, just with a warning about timer variables because of the volatile attribute. Removing the volatile attribute removes the warning.
My code is the following:
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
// ESP-12 modules have LED on GPIO2. Change to another GPIO
// for other boards.
static const int pin = 2;
static os_timer_t some_timer;
void some_timerfunc(void *arg)
{
//Do blinky stuff
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & (1 << pin))
{
// set gpio low
gpio_output_set(0, (1 << pin), 0, 0);
}
else
{
// set gpio high
gpio_output_set((1 << pin), 0, 0, 0);
}
}
void ICACHE_FLASH_ATTR user_init()
{
// init gpio subsytem
gpio_init();
// configure UART TXD to be GPIO1, set as output
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
gpio_output_set(0, 0, (1 << pin), 0);
// setup timer (500ms, repeating)
os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
os_timer_arm(&some_timer, 500, 1);
}
And my makefile:
CC = xtensa-lx106-elf-gcc
CFLAGS = -I. -mlongcalls
LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,--end-group -lgcc
LDFLAGS = -Teagle.app.v6.ld
blinky-0x00000.bin: blinky
esptool.py elf2image $^
blinky: blinky.o
blinky.o: blinky.c
flash: blinky-0x00000.bin
esptool.py write_flash 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin
clean:
rm -f blinky blinky.o blinky-0x00000.bin blinky-0x10000.bin
The output after make:
xtensa-lx106-elf-gcc -I. -mlongcalls -c -o blinky.o blinky.c
xtensa-lx106-elf-gcc -Teagle.app.v6.ld blinky.o -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,--end-group -lgcc -o blinky
esptool.py elf2image blinky
esptool.py v1.2
The output after "make flash":
esptool.py write_flash 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin
esptool.py v1.2
Connecting...
Auto-detected Flash size: 32m
Running Cesanta flasher stub...
Flash params set to 0x0040
Writing 36864 @ 0x0... 36864 (100 %)
Wrote 36864 bytes at 0x0 in 3.2 seconds (92.0 kbit/s)...
Writing 200704 @ 0x10000... 200704 (100 %)
Wrote 200704 bytes at 0x10000 in 17.4 seconds (92.2 kbit/s)...
Leaving...
I have been trying to solve it for a few days already, idk where else to look for an answer.
I already read the github documentation about of esptool.py and esp open-sdk