-->
Page 1 of 1

Linker problems when using I2C

PostPosted: Thu Jul 26, 2018 7:40 pm
by MrAureliusR
Hey folks.
I have been getting to know the SDK and have got a few simple projects compiled and flashed. However, when I try to use I2C I get a bunch of undefined reference errors. Looking through the SDK with find, I can't see any libi2c.a or similar. I had to manually add the driver_lib folder to my include path as well. There seems to be almost no documentation on using esp-open-sdk out there, which is disappointing. Maybe I'm just looking in the wrong places?

Anyway, I would love to know what libraries I need to link to get I2C working. Thanks!

Here's my makefile:

Code: Select allP=main
CC=xtensa-lx106-elf-gcc
LDLIBS=-nostdlib -Wl,-Map=output.map -Wl,--start-group -lm -lc -lhal -lpp -llwip -lphy -lnet80211 -lwpa -lmain -Wl,--end-group -lgcc
CFLAGS= -I. -I../../esp-open-sdk/ESP8266_NONOS_SDK-2.1.0-18-g61248df/driver_lib/include/ -mlongcalls -std=gnu11
LDFLAGS=-Teagle.app.v6.ld

all: $(P)

$(P)-0x00000.bin: $(P)
   esptool.py elf2image $^

$(P): $(P).o

$(P).o: $(P).c

flash: $(P)-0x00000.bin
   esptool.py write_flash 0 $(P)-0x00000.bin 0x10000 $(P)-0x10000.bin

clean:
   rm -f $(P) $(P).o $(P)-0x00000.bin $(P)-0x10000.bin