Sunday, June 10, 2012

Arduino on NetBSD

I have been toying with using an arduino board to create a low power data logger.  Not surprisingly there is no pre-packaged arduino IDE for NetBSD but there is for Linux and NetBSD can run Linux binaries.  I downloaded the 32bit arduino-1.0.1 software and installed that.  When I tried to run the arduino app it told me I was missing java.  My previous attempts at getting java and NetBSD to play nicely have not turned out well but I thought I may as well give it another go and downloaded java for 32bit Linux.  I installed java and set my PATH to point at it and then ran arduino again.  Much to my surprise the IDE actually runs and seems to mostly work apart from it steadfastly refusing to see any serial ports.  I was able to build an example sketch but I cannot upload it to a board because of the serial port problem.  The IDE gives you the option to upload using using a programmer in which they just call avrdude, this fails because libusb is missing.  A quick look in NetBSD pkgsrc shows that avrdude is actually there so I can build a native version of this tool.  In fact, now that I look it seems that all the "avr" tools required to crossbuild binaries for the arduino boards are available in pkgsrc.  So I could build native tools and use a makefile to produce and upload the binaries.  I think I will stick with just replacing avrdude for the moment.

As for a target... I have a leostick which was given away at the 2012 LinuxConf.au, I have tried plugging this into my laptop and it is attached as a keyboard and mouse which is not very helpful, no serial port is attached.  Apparently this works on some later versions of linux, I guess due to changes in the CDC ACM driver, in NetBSD this seems to be handled by umodem but I haven't yet managed to get it to attach with this driver.  We shall see how it goes.

2 comments:

abs said...

Would there be any sense in putting together a pkgsrc entry for arduino now you have it working?

blymn said...

Perhaps a meta-package would make sense, it seems all the cross-tools are already in pkgsrc.