chipKIT® Development Platform

Inspired by Arduino™

Whats the best way to go about porting Libs

Created Tue, 10 Jan 2012 03:20:11 +0000 by Rob Drizzle

Rob Drizzle

Tue, 10 Jan 2012 03:20:11 +0000

I have a camera library for an arduino that I would like to use with the Uno32. I don't mind giving a go at doing the conversion myself, but I have no idea where to start. So my question is there is a general guide or even a "change all of these to this" kinda guild?

Thanks in advance.

Jacob Christ

Tue, 10 Jan 2012 03:43:30 +0000

Quick and dirty answer (that is sorry for the lack of details) but I want to get you rolling:

In the one lib that I've ported there were the issues I ran into.

  1. Changing call specific to atmel registers to chip kit registers. I did this using ifdefs so that the library still worked on atmel when finished.

  2. Changing form int / long types to t_int8 types since a int on a pic32 is not the same as an int on a atmel.

  3. Strings are stored differently in and need to be converted to chipkit style, again wrapped in ifdefs.

How I did it: Import the library and compile. Fix one error message at a time.

All of these issue I think I posted messages on this form to learn how to do and someone helped me. So if you search you will find the answers, if you don't ask about specific errors.


Rob Drizzle

Tue, 10 Jan 2012 04:22:33 +0000

Typically, will work need to be done in the cpp file also.

The first few errors I got in the .h file was:

c:\program files\mpide-0023-windows-20111221\hardware\pic32/main.cpp:46: undefined reference to 'setup' c:\program files\mpide-0023-windows-20111221\hardware\pic32/main.cpp:50: undefined reference to 'loop'

"How I did it: Import the library and compile. Fix one error message at a time."

did you have and empty sketch like:

// empty sketch

void setup()
{ }

void loop() { }

to get ride of those errors?

Jacob Christ

Wed, 11 Jan 2012 07:22:18 +0000

Hmmm.. Is this all the code in your sketch? Any header files?

And yes, you have to roll up your sleeves and dig in to the cpp files.