How to use external libraries and compile them alo

2020-03-27 01:53发布

问题:

I want to be able to interface some sensors and send the sensor data to Thingspeak cloud using Contiki-OS. C libraries are available for interfacing sensors and the libthingspeak library is available for updating the feed on Thingspeak. I'm able to perform communication between two motes using the examples provided in examples/udp-ipv6 folder, setting one node as client and another as the server. How do I now include the required library code in my application and build it. What changes need to be made in the Makefile? I'm using cc2538 development kit.

回答1:

Use TARGET_LIBFILES variable. For example, to link with standard math library:

TARGET_LIBFILES += -lm

If necessary, add the path where the library resides to LDFLAGS:

LDFLAGS += -L/path/to/libraries


标签: c contiki