[3] Arduino Pre-Processor

17 views
Skip to first unread message

Massimo Banzi

unread,
Jun 11, 2017, 10:31:09 AM6/11/17
to Arduino Developers
Hi All

Thanks for the feedback on my earlier email. I'm going to respond to your messages in the next couple of days. In the meantime I would like to break down the discussion into 6 separate threads to make it simpler to comment.

We're kicking off with the release of the new Arduino pre-processor.

Following up from my previous email, we're kicking off a new phase in the developement of the open source Arduino IDE where we want to tackle some of the features we need to take the platform to the next stage. Some of these have been on the roadmap for a long time but we couldn't tackle them for a variety of reasons. As I mentioned in San Mateo, now it's a good time to reboot these efforts.

One of the main building blocks of the Arduino IDE is the pre-processor: a tool which takes your .ino files and processes them in various ways to generate a valid set of .cpp files that can be compiled by GCC.

As you may know, we use currently use ctags to parse the sketch and perform the arduino-preprocessing (in particular adding the forward prototypes where needed).
The use of ctags, even if it's much better than the previous approach based on regexp, still suffers from some issues mainly because ctags is not a full C++11 parser and sometimes get confused when the user provides a sufficiently complex sketch.

In the past months Cristian Maglie has been working on a replacement of ctags based on clang+llvm. This quickly turned out to be a very powerful tool that not only can parse much better than ctags but it and can also perform the full arduino-preprocessing by itself. For this reason he called it "arduino-preprocessor".

As a bonus, clang has support for diagnostics (errors and warnings) and code-completions, so he has also added to the arduino-preprocessor the possibility to output them in a machine-parsable way so they can be used inside the Arduino IDE (and possibly move forward the long standing issue https://github.com/arduino/Arduino/issues/849).


Please beware that this is still highly experimental and a lot of testing is required, BTW the tests of arduino-builder runs successfully and he has used it integrated in the Arduino IDE for quite a while now, without problems, so we're off to a very promising start.

let us know what you think.

Massimo and Cristian.

Carmine Spizuoco

unread,
Jun 13, 2017, 2:15:37 PM6/13/17
to Massimo Banzi, Arduino Developers

Hi All,

A few steps forward ...

On osx machine
Arduino-preprocessor: still problems with llvm + clang, tried to compile sources, create xcode project but for now not good news.

Arduino-builder: Compiled, launch executable as follows:
./arduino-builder 
-hardware /Applications/Arduino.app/Contents/Java/hardware 
-tools /Applications/Arduino.app/Contents/Java/tools 
-libraries /Applications/Arduino.app/Contents/Java/libraries 
-fqbn arduino : Avr: yun 
-verbose 
blink.ino


I have this error:
Fork / exec / bin / avr-g ++: no such file or directory

On ubuntu 64 machine in virtualBox:
Arduino-preprocessor: Compiled and executed. 
Not complicated ( it only needs dependency to install libtinfo-dev.  FYI)


Arduino-builder: Compiled, launch executable as follows:
./arduino-builder 
-hardware /Applications/Arduino.app/Contents/Java/hardware 
-tools /Applications/Arduino.app/Contents/Java/tools 
-libraries /Applications/Arduino.app/Contents/Java/libraries 
-fqbn arduino : Avr: yun
-verbose blink.ino


I have this error:
Fork / exec / bin / avr-g ++: no such file or directory  (snapshot FYI)


Obviously, this file exist in a folder hardware/tools/avr/bin.


Same behavior osX and Linux…. 

Some idea?

C.







--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

Reply all
Reply to author
Forward
0 new messages