Extremely simple C code development
Posted: Mon Mar 27, 2017 6:25 pm
Colleagues,
I'd like to keep my R.P. setup as simple and independent as possible, and avoid hooking it to the Internet. For the purpose, I experimented with the C compiler included in the 0.97 ecosystem. I wrote the Hello World with the nano editor over an USB console connection, which compiled and executed from the command line just fine.
Complications began when trying to access hardware, which requires using the API. So I wrote the blink led C example with the nano editor, replacing the
line temporarily with the full path of the header file on the R.P. board:
This compiles, but it seems the linker doesn't find the library to link against:
Now, I don't seem to be able to set the library path right.
A symbol dump suggests that the library is there, and should contain the required functions:
Attempts to guide LD explicitly to the library fail as well:
... and some other option variants with the same end result.
What am I missing? Such a simple LED blinking app should be compile-able from the command line without all the heavyweight wrestling with github cloning and makefiles, no?
Regards,
Mikko
I'd like to keep my R.P. setup as simple and independent as possible, and avoid hooking it to the Internet. For the purpose, I experimented with the C compiler included in the 0.97 ecosystem. I wrote the Hello World with the nano editor over an USB console connection, which compiled and executed from the command line just fine.
Complications began when trying to access hardware, which requires using the API. So I wrote the blink led C example with the nano editor, replacing the
Code: Select all
#include "redpitaya/rp.h"
Code: Select all
#include "/opt/redpitaya/include/redpitaya/rp.h
Code: Select all
In function 'main'
ledblink.c:(.text+0x3e): undefined reference to 'rp_Init'
ledblink.c:(.text+0x70): undefined reference to 'rp_DpinSetState'
ledblink.c:(.text+0x82): undefined reference to 'rp_DpinSetState'
ledblink.c:(.text+0x9a): undefined reference to 'rp_Release'
collect2: error: ld returned 1 exit status
Code: Select all
root@rp-f018cb: LD_LIBRARY_PATH=/opt/redpitaya/lib
root@rp-f018cb: echo $LD_LIBRARY_PATH
/opt/redpitaya/lib
root@rp-f018cb: gcc ledblink.c
... same undefined reference errors
Code: Select all
root@rp-f018cb: nm -D /opt/redpitaya/lib/librp.so
... a lot of lines ...
00007ff6 T rp_Init
... a lot of lines ...
Code: Select all
root@rp-f018cb: gcc -L /opt/redpitaya/lib ledblink.c
...same undefined reference errors
Code: Select all
root@rp-f018cb: gcc --library /opt/redpitaya/lib/librp.so ledblink.c
...same undefined reference errors
What am I missing? Such a simple LED blinking app should be compile-able from the command line without all the heavyweight wrestling with github cloning and makefiles, no?
Regards,
Mikko