[CCC DEV] Supporting multiple platforms
Matt Jadud
jadudm at gmail.com
Fri Jun 18 14:18:42 BST 2010
Hi all,
I'd appreciate a quick bit of pushback on how I've re-organized a few
things in the Arduino wrapper.
We want to get some students moving on their work with the ArduPilot
Mega, and to do that, we need to... well, support the ArduPilot Mega.
This is what I've done (all changes in the avr-mega branch:
http://projects.cs.kent.ac.uk/projects/kroc/svn/kroc/branches/avr-mega):
* The deb-pkg build script works a bit better. It's a kludge, but it
creates a package that leaves sensible things in
/usr/local/occam/arduino.
See http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/branches/avr-mega/distribution/deb-pkg
* The helper-wrapper hack that I had written (arduinocc) has been
renamed to "plumb". It takes a new argument, which is a "platform."
Options are currently "arduino," "arduinomega", and "seeedmega". I
would like to rewrite this driver in Python, but don't have time at
the moment. (Or, perhaps, occbuild should just get smarter about the
Arduino? Either way, what exists here is a small hack to be reworked
in whatever way seems appropriate.)
See http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/branches/avr-mega/tvm/arduino/scripts
* I created *.conf files for each "platform." Instead of "atmega328"
or "atmega1280", I went with "arduino", "arduinomega", and "seeedmega"
because the differences are more about the board than the processor. I
think. For example, the Seeed Studio Mega has a smaller footprint than
the Arduino Mega, yet it exposes more digital pins (70 vs. 54). Hence,
its board support is probably different. I say "probably" because we
haven't written the support code yet... perhaps this is a case where
there should be an #IF DEFINED somewhere.
"plumb" sources the appropriate conf file based on the "platform"
argument. This might be unnecessarily fragile, or perhaps we should
handle the platform differences... differently. This was what I came
up with that seemed "not too onerous."
See http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/branches/avr-mega/tvm/arduino/scripts
* The *.conf file lets me add a --search path for the
platform-specific code. This way, things like "plumbing.module" can
end up in occam/arduino/lib, while "iom328p.inc" can end up in
occam/arduino/lib/platforms/arduino. The intention is that the
platform-specific bits (the number of which is small) of "avr.module"
and "wiring.module" will end up in the platform directory, and the
rest of the modules at the top level of /lib.
Does that seem reasonable for now? This has impact on all platforms,
to some degree, but what I've done is actually pretty light-weight in
terms of "commitment." It makes things work for the near-term, and if
anything needs to change, we can do that easily. The only big
difference (for, say, CLJ's Mac and Windows build scripts) is that I
moved things in the Arduino wrapper around.
Comments? Ultimately, we'll want to merge this (and Mega support) back
in to trunk, if that's OK, but there's no rush on that.
Cheers,
M
--
Sent from my TRS-80
More information about the developers
mailing list