I'm working on getting the ArduPilot mega 2.x to compile outside the IDE using make (which will also allow it to be compiled in Eclipse, or NetBeans or whatever)

 

It is a work in progress :(

 

Is anyone else interested in this? otherwise I'll just do it for my own amusement.


So far I've found the following problems, which mainly relate to the way the Arduino IDE tries to auto-handle C function and variable prototype declarations.

 

1. Functions are used before being declared

2. Functions are marked static in a file, but are actually used by other files.

3. There is no .h file declaring all the global variables, structures and constants in use

 

My solution so far is to

1. Add declaration statements at the top of modules where functions, not necessarily externally useful ones that belong in proto.h, are used before the code for them.

2. Build up a proto.h file that is included by every file that is full of "extern .." declarations to define the functions and variables in use all over.

3. Remove "static" in front of functions that are in one file, but used externally to that file (are in proto.h)

 

As for the makefile, there is a generator written in ruby that does the job of creating the makefile automatically. It works ok, so that hasn't been a problem.

 

Once  the compile errors are killed, and the hex file is created, I'll make sure it uploads it the same way the IDE does.

 

Basically all I want to do is muck around with the code base in a small filesystem tree, using vi. Then type "make" and "make install" to upload. The IDE was a nice fast start but now it gets in the way.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hi,

    Are you still pursuing this? Last weekend I noticed that at least since the svn->git transition there is a cmake based build pipeline and even a java tool that emulates the arduino IDE method of merging pde files (thanks, development team! :) . Had to do some minor changes to adapt it to my APM1280 but now I can build and even upload the latest git repo version (taking some stuff out I don't need to reduce the memory footprint, of course). Pretty cool actually.. guess the guys are using it for building the hex images of the mission planner. Once I find the time I maybe write the steps down but it's not much more then just running cmake and make.

  • 3D Robotics

    We've already written a tutorial on using Eclipse in the manual here

     

    The guide to using a makefile is here

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24
DIY Robocars via Twitter
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23
DIY Robocars via Twitter
Oct 23
DIY Robocars via Twitter
Oct 19
DIY Robocars via Twitter
Oct 18
DIY Robocars via Twitter
RT @NeaveEng: Calling all UK based folks interested in @diyrobocars, @f1tenth, @donkey_car, and similar robot racing competitions! @hacky_r…
Oct 13
DIY Robocars via Twitter
RT @araffin2: 🏎️ After hours of video editing, I'm happy to share a best of my Twitch videos on learning to race with RL. 🏎️ Each part is…
Oct 13
More…