PDA

View Full Version : [Question(s)] Bioloid C programming: including libCM-5.a in makefile



tjo5010
04-08-2009, 02:12 PM
This may seem mundane to experienced programmers, but I am a mechanical engineering student trying to figure out programming the Bioloid robots in C. I know the basics of C programming, but the makefile is a mystery to me. I am using WinAVR to make the program.

I've been following the Robotis Expert Manual and it instructed to include the following lines in the makefile:
under #additional libraries:
ROBOTIS_LIB = -lCM-5 -L../../lib
and under #Linker flags:
LDFLAGS += $(ROBOTIS_LIB)

I have both the libCM-5.h and the libCM-5.a files, but I don't really know where to put them to make this work. so far I just have them in the same file as the C file "bioloidattempt1." Each time I hit "Make All" it gives me the following:

Linking: Bioloidattempt1.elf
avr-gcc -mmcu=atmega128 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=bioloidmain.o -std=gnu99 -Wp,-M,-MP,-MT,Bioloidattempt1.o,-MF,.dep/Bioloidattempt1.elf.d bioloidmain.o --output Bioloidattempt1.elf -Wl,-Map=Bioloidattempt1.map,--cref -lm lCM-5 -L../../lib
avr-gcc: lCM-5: No such file or directory
make.exe: *** [Bioloidattempt1.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:00

If anyone can give me some advice on where to put both files and the code to insert into the makefile, I would appreciate it!

lnxfergy
04-08-2009, 03:43 PM
This may seem mundane to experienced programmers, but I am a mechanical engineering student trying to figure out programming the Bioloid robots in C. I know the basics of C programming, but the makefile is a mystery to me. I am using WinAVR to make the program.

I've been following the Robotis Expert Manual and it instructed to include the following lines in the makefile:
under #additional libraries:
ROBOTIS_LIB = -lCM-5 -L../../lib
and under #Linker flags:
LDFLAGS += $(ROBOTIS_LIB)

I have both the libCM-5.h and the libCM-5.a files, but I don't really know where to put them to make this work. so far I just have them in the same file as the C file "bioloidattempt1." Each time I hit "Make All" it gives me the following:

Linking: Bioloidattempt1.elf
avr-gcc -mmcu=atmega128 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=bioloidmain.o -std=gnu99 -Wp,-M,-MP,-MT,Bioloidattempt1.o,-MF,.dep/Bioloidattempt1.elf.d bioloidmain.o --output Bioloidattempt1.elf -Wl,-Map=Bioloidattempt1.map,--cref -lm lCM-5 -L../../lib
avr-gcc: lCM-5: No such file or directory
make.exe: *** [Bioloidattempt1.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:00

If anyone can give me some advice on where to put both files and the code to insert into the makefile, I would appreciate it!

I've not programmed the CM-5 using AVR-GCC (I've never actually fired up my CM-5)... but, the -L../../lib means you should have your .a file up two directories in a diretory called lib (.. = up a directory)

-Fergs

tjo5010
04-08-2009, 04:02 PM
Thanks Fergs!
Actually that helped a lot. I didnt know what that meant, but now that i know i was able to find the file and insert the library. It compiles with no errors now.

Thanks again,
Trev

Adrenalynn
04-08-2009, 05:29 PM
You can also give it an explicit location to start the search for the library from: -L/foo/bar/my/directory/lib