How to compile c++ for xtensa?
Posted: Wed Apr 26, 2017 6:32 am
Hello, i want compile simple c++ code for xtensa, but i can't.
I compiled file with this command.
(This work)
And linked with this.
If any function from SDK is used in file, linking end with undefined reference errors
Anybody can show minimal commands to compile and link c++ for Xtensa?
Thanks in advance!
Code: Select all
#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)
Code: Select all
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.
Code: Select all
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
Code: Select all
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!