NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Linking other people's libraries (using them) - possible tutorial topic?

June 30, 2012
by icarus
icarus's Avatar

Hello all, I've been at this for a few years and am pleased to say the nerdkit has gotten me where i am today. I've gotten some help in the past and now it's time to return yet again to clear up some library confusion, hopefully for myself and those to come after me :)

So, Ive been working with a couple different libraries to use graphic lcd screens and lately i find myself re inventing the wheel. I've noticed that a large number of people will post their hard work on the internet and a simple search for "Atmega Avr library for ..." will yield some very pleasing libraries for whatever you can think of.

However, there's a catch. Many of the libraries that you may come across are generalized for any device (as they should be) using macros for things like pin numbers. This is fairly easy to deal with, find the macro defines and change them to the desired pins, ect. That's not so bad is it? I don't think it is.

After performing all that detective work, the real challenge comes out, to allow for the generality of the library, the .c files are not compiled ... ugh! How on earth can we handle this? well, if your crafty, like we are ;) we just find an example use of the library (google helps) and find one of their makefiles and modify it to compile your code, and the nerdkit library, as it already compiles the desired library you downloaded. This defiantly works, and works well. However! every once in a while you'll run into some issues... :(

For example, I downloaded the Dogm102 library from Oliver Kraus on http://code.google.com/p/dogm128/ I modified the makefile in the examples section for the Atmega88 and i got it to work well. however, i tried to do some math functions, SQRT() and SIN() and the code would not compile... Not a good sign.

So, this is where i make a call to get help from the community. I'm sure that the newbies and even some of the experienced programmers can benefit from learning how to add the provisions to our nerdkit makefile to compile other people's libraries along with how to link to them and explanations of header files ect...

I have a question or two myself. I have obtained an understanding that compiling the .c files of a library will yield .o files that can be directly linked but is that all that's too it? Can you just link them in the linker section of the makefile and include the header file in the includes section of the code? Does a typical makefile delete the .o files after it uses them? i figure ours leaves them for the education benefit, but is that normal?

BTW! the Dogm128 library i mentioned above is nowhere near as awesome as oliver's newest library, the U8glib library found at: http://code.google.com/p/u8glib/ It supports many many graphic displays and has good functionality. If anyone is interested, i'd be down for working in a group to develop a nerdkit project to enable the easy use of this library for all nerdkit users. I'm sure that everyone here could benefit from the ability to cheaply display graphics on these displays

-Icarus

Standing on the shoulders of giants, we see to new heights :D

Post a Reply

Please log in to post a reply.

Did you know that sound travels via pressure waves in the air, and you can make these with a piezoelectric buzzer? Learn more...