#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_config.h"
#include "user_interface.h"
#include "espconn.h"
extern "C" void ICACHE_FLASH_ATTR
user_init()
{
//wifi_set_opmode(i);
}
I compiled file with this command.
(This work)
xtensa-lx106-elf-g++ -I. -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH -fno-rtti -fno-exceptions -c -o bin/user_main.o user_main.cpp
And linked with this.
xtensa-lx106-elf-gcc -L /home/esp-open-sdk/sdk/lib -T /home/esp-open-sdk/sdk/ld/eagle.app.v6.ld -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lgcc -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -lupgrade -Wl,--end-group bin/user_main.o -o bin/user_main
If any function from SDK is used in file, linking end with undefined reference errors
bin/user_main.o:(.irom0.text+0x0): undefined reference to `wifi_set_opmode(unsigned char)'
bin/user_main.o: In function `user_init':
/home/esp/user_main.cpp:12: undefined reference to `wifi_set_opmode(unsigned char)'
collect2: error: ld returned 1 exit status
Anybody can show minimal commands to compile and link c++ for Xtensa?
Thanks in advance!