I have a precompiled lib (.a extension) that I want to use integrated on the ESP8266 RTOS SDK examples.
There is a folder on following path (ESP8266_RTOS_SDK\components\esp8266\lib) where there are 22 .a files inside. I have put my lib there, but the compiler is like it is not recognizing the functions of my lib.
I have read something about edit some makefiles. Should I really do this? If yes, I would like to know which is the file to edit? (on which path it is placed)
EDIT
This is my working folder:
I was oriented by Espressif (developer of ESP8266) to make like shown below on component.mk, but it does not worked, compilation keeps showing "undefined reference" for the function of the lib.
Then I created an environment variable called COMPONENT_PATH on Windows, being the path the same as shown in the first picture.
Is there anything wrong with this?
EDIT 2
Created folder "include" inside main:
Added on top of C code: #include "include/lib123.h", which contains only one line: int sum (int a, int b);
Added on main a call: int result = sum(1,2);
Got compiler error: undefined reference to 'sum'
EDIT 3
For every compile try, the following file get updated inside folder \esp\tcp_server\build.
I won't place here directly because the file has more than 10.000 lines: https://raw.githubusercontent.com/jefersonpehls/esp8266_freeRTOS_firebase/master/tcp_server.map
EDIT4
When I try to make, this is what is shown:
make
Toolchain path: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7b
Compiler version: 5.2.0
Python requirements from C:/msys32/home/sandr/esp/ESP8266_RTOS_SDK/requirements.txt are satisfied.
LD build/tcp_server.elf
C:/msys32/home/sandr/esp/tcp_server/build/main\libmain.a(tcp_server_v5.o):(.literal.app_main+0x24): undefined reference to `sum'
C:/msys32/home/sandr/esp/tcp_server/build/main\libmain.a(tcp_server_v5.o): In function `app_main':
C:/msys32/home/sandr/esp/tcp_server/main/tcp_server_v5.c:382: undefined reference to `sum'
collect2.exe: error: ld returned 1 exit status
make: *** [C:\msys32\home\sandr\esp\ESP8266_RTOS_SDK/make/project.mk:510: /home/sandr/esp/tcp_server/build/tcp_server.elf] Error 1
EDIT 5
Here is the complete steps I use to make
sandr@DESKTOP-MA6RTB6 MINGW32 ~
$ cd ~/esp/tcp_server
sandr@DESKTOP-MA6RTB6 MINGW32 ~/esp/tcp_server
$ export PATH="$PATH:/opt/xtensa-lx106-elf/bin"
sandr@DESKTOP-MA6RTB6 MINGW32 ~/esp/tcp_server
$ make
Toolchain path: /opt/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7b
Compiler version: 5.2.0
Python requirements from C:/msys32/home/sandr/esp/ESP8266_RTOS_SDK/requirements.txt are satisfied.
LD build/tcp_server.elf
C:/msys32/home/sandr/esp/tcp_server/build/main\libmain.a(tcp_server_v5.o):(.literal.app_main+0x24): undefined reference to `sum'
C:/msys32/home/sandr/esp/tcp_server/build/main\libmain.a(tcp_server_v5.o): In function `app_main':
C:/msys32/home/sandr/esp/tcp_server/main/tcp_server_v5.c:382: undefined reference to `sum'
collect2.exe: error: ld returned 1 exit status
make: *** [C:\msys32\home\sandr\esp\ESP8266_RTOS_SDK/make/project.mk:510: /home/sandr/esp/tcp_server/build/tcp_server.elf] Error 1
EDIT 6
This is the content of esp\tcp_server\Makefile
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := tcp_server
EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common
include $(IDF_PATH)/make/project.mk
This is the content of esp\tcp_server\main\component.mk
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files
# in directory, adding 'include' to include path.)
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/lib123.a
and IDF_PATH is C:\msys32\home\sandr\esp\ESP8266_RTOS_SDK
EDIT 7
This is $(IDF_PATH)/make/project.mk
https://github.com/jefersonpehls/esp8266_freeRTOS_firebase/blob/master/project.mk