-->
Page 1 of 1

Undefined reference to at_init

PostPosted: Fri Oct 23, 2015 2:30 am
by Atlantis
I was trying to add some custom confiuration AT commands to my project.

On top of user_main.c file I added:

Code: Select all#include <at_custom.h>


And then called at_init() at the beginning of user_init() function.

Unfortunately code does not compile.
Every time I get:

Code: Select allbuild\app_app.a(user_main.o)||In function `user_rf_pre_init':|
D:\Documents\Projects\ESP8266\Test\user\user_main.c|36|undefined reference to `at_init'|
D:\Documents\Projects\ESP8266\Test\user\user_main.c|36|undefined reference to `at_init'|


What is particularly strange, error is reported in user_rf_pre_init (which is empty) although at_init() is called on the beginning of user_init().

What is wrong wrong?
I am using SDK v1.1.1 (in my opinion it most stable version so far).

Re: Undefined reference to at_init

PostPosted: Fri Oct 23, 2015 2:59 am
by Atlantis
What's even stranger, I compiled at example from SDK without encountering any problem.
But now I see, that executing "at_init()" initializes entire standard at command set. Co maybe there is not enough space for my code and at "machine"?
Is there a way to prepare only small set of commands? Basically I need only RST, CWJAP and few more to save default configuration to flash.

Re: Undefined reference to at_init

PostPosted: Fri Oct 23, 2015 3:44 pm
by lethe
The AT commands are provided by a library. You need to tell the linker to link your code against this lib, by adding "-lat" to the linker flags.

Re: Undefined reference to at_init

PostPosted: Sat Oct 24, 2015 1:54 am
by Atlantis
You mean here?

Code: Select all# linker flags used to generate the main object file
LDFLAGS      = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static


It doesn't change change anything. Beside - there is no "-lat" in the Makefile of at example, and it compiles properly.