queezythegreat / arduino-cmake

Arduino CMake Build system
644 stars 216 forks source link

Fixes for sketch processing #34

Closed jgoppert closed 12 years ago

jgoppert commented 12 years ago

Makes compile/link flags target specific. (this fixes sketch inclusion/link issues). Improved sketch header detection. Added more advanced sketch examples to help testing.

jgoppert commented 12 years ago

Arducopter is failing to find the prototype in leds.pde: static void update_lights();

This is very confusing since the prototype is so regular, working on this now.

jgoppert commented 12 years ago

Seems the current regex for prototypes is too restrictive. It requires all prototypes to start with a \n. This isn't the case for ArduPlane/led_pde. (update_lights) Also , I added a remove_comments function. It seeems to work for the sketch, but when run on entire sources it grabs some of the functions. If you add a new line to update_lights it will compile ArduCopter and ArduPlane currently.

jgoppert commented 12 years ago

Ok, I think I have everything working well now. It builds ArduCopter/ ArduPlane fine.

queezythegreat commented 12 years ago

Thats great that it works, I'll merge in the changes when I have some free time (hopefully this weekend). I will hover be removing the ArduPilot sources. It would have been better if you had used Arduino CMake as a submodule instead of importing the ArduPilot sources right into you fork, makes for a ugly merge.

Anyway thanks for your help with the sketches!

jgoppert commented 12 years ago

I added the ArduPilotMega code/ library as a good test case. It is hard to test the parser on a small example and catch everything. You can remove it if you like. I am developing the main ArduPilotMega code separately from this. Also, I am working on adding basic simulation support similar to that found in ArduPilotMega. See my sim branch.

queezythegreat commented 12 years ago

Yes, I completely agree with you that ArduPilot is a great test case. I would just separate the two, as most people are not developers of Arduino CMake, they will never use the test cases. Maybe this weekend, I will create a new repo with test cases only, for development purposes and ArduPilot as a test case.

queezythegreat commented 12 years ago

So I've integrated your changes, and moved all the examples to a seperate repository (https://github.com/queezythegreat/arduino-cmake-tests). I've updated the generatearduino function to support option both as argument and variables (in order to have backwards compatibility with previous version of Arduino CMake). I've also fixed a minor bug related to setting up the core Arduino library.

Most of the testing I've been doing was on Mac OS X, as my Linux machine has avr-libc 1.8 and I wasn't able to get ArduPilot working (I had problems with PSTR const correctness and some deprecations).