Go Down

Topic: Help with compiling Arduino sketches in a Windows OS using Makefiles (Read 965 times) previous topic - next topic

relic1974

I am a total noob when it comes to using makefiles and dealing with source code with many components, .c and .h files.  I am only use to working within the Arduino IDE environment working with .ino files and libraries.  I also do not have Linux installed, nor do I have much experience with it.

I have spent weeks researching how to accomplish compiling using makefiles in windows with no luck.  Some of the projects I am starting to work on now demand it.  I've found that there are too many tools with no clear cut way on how to use makefiles to compile from source code and upload to the arduino.  I understand the process somewhat, but it seems that a special cmd line tool is needed, and I've found several such as GNU Make.  But I have no idea how to use these utilities.

My wish is that someone would provide a very clear solution for noobs like me (noob to the makefile process), especially when working with source code repositories that contain main.c files and the multitude of .h and .c support files, what tools are required, and how to compile and upload these programs.

In my last attempt, I started simple using the Blink example.  I copied it and added the .cpp extension, created a makefile for it with the board parameters, paths, and function prototypes as instructed.  When I tried 'make' in the windows cmd line windows obviously had no idea what to do.

Every tutorial and forum I have read provides examples and files/tools but nothing seems to be geared towards the windows users.  Is there anyone out there who can explain how to do this clearly, and for those who have never worked with source files and the cmd line to compile?

Much thanks in advance...

Jantje

relic1974
First of all. Make should not make much difference in Linux, windows or mac. It is make.exe in windows and make in linux (don't know about mac) but the options are the same. there is of course the / and \ for paths and no c:\ in linux then you should have 90% or more of the differences (at least in the make example/tutorial world).

secondly
I don't quite understand the need for make files. For sure when you don't know make. You say some of the projects demand it. Why? Which projects?

Don't get me wrong. Make is a great tool; but there are many tools to hide the complexity of make and use make as a core engine. My Arduino eclipse plugin is such a tool (runs on windows). It builds the makefiles for you so you don't have to care about make. To be precise My plugin doesn't generate the make file but CDT does. So actually I can't help you out with make itself.

Ask yourself: Why do I need make? What do I want to achieve?

Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

relic1974

It's just much more easier and faster compiling all those files via command line.  I tried the Atmel Studio cmd line and did get a program to compile.  I tried using 'make upload' but it failed to upload

Go Up