building Marlin 3D printer in Atmel Studio?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been unsuccessful looking for a reference describing how to build the Marlin 3D printer firmware in Atmel Studio.  It seems to be very deeply Arduino-based, and the makefile seems to be Linux-oriented.  I'm running Studio v. 7 and have a JTAGICE MKII to program a controller board... but I have no idea how to take this mess of source code, some from the github https://github.com/MarlinFirmware/Marlin and some apparently from various Arduino sources and build a working firmware.  Can anyone suggest a starting point?

 

In the meantime I've created a solution in Atmel Studio and am adding .h and .cpp files one at a time, but it's tough slogging.  The Marlin source code doesn't even have a main()!  So I'm open to any advice.  I just want to build it and flash a controller board for some testing.

 

 

This topic has a solution.
Last Edited: Sat. Jan 7, 2017 - 10:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you just want to build an existing Arduino project, Visual Micro for Atmel Studio is probably the way to go:

 

http://www.visualmicro.com/page/...

 

Rewriting the whole thing without Arduino libraries would be more difficult, although it does not seem to depend on Arduino libraries as much as some other/most Arduino projects. There is indeed no main() function, but look into Marlin_main.cpp - you will find typical Arduino seetup() and loop() functions, which are entry points for the code and might be a good start for you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for replying, though I don't think this is totally an Arduino project, as you mentioned.  I already put the code from loop() into main() and am calling the code from setup.  My difficulties are around the countless #include dependencies.  I know I don't need many of them from their names alone, but right now am just trying to get a full-code compile.  The majority of the application is in C++ but many of the included library source is in C.  I'm comfortable with both, but ignorant of Arduino (would rather just flash a chip with my JTAGICE MKII).  Then there are the verbose routines in digital_write.c, which I cannot understand why they're so complicated... again the divide between microcontroller programming in C versus "sketches."  But it is a very big project -- was hoping to just press F7 and get it to build.  laugh

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Marlin is an Arduino project, there is no doubt about that. You should be able to import it into Studio as an Arduino project, although I have never tried. I build Marlin using Eclipse with the Jantje Arduino plugin.

 

If you build Marlin outside of Arduino IDE, you will need to provide the same compiler flags Arduino IDE does, as well as the various Arduino core include files.

Bob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob, thanks, the more I look at it the more I agree, no doubt it's an Arduino project.  I have never imported an Arduino project into Studio.  In the meantime, I just ordered an Arduino to hopefully at least compile to it and play with and test it on the scope.  Maybe I bit off too much of a task after a long time away from Atmel stuff in general.  I did have to add one compiler directive I think C++11 for a particular style of constructor.  That made a lot of errors go away.  The Arduino core #includes are the sticking point - they don't appear to be part of the Marlin project.  It's as though the developers of this project assume it's being built out of the Arduino environment and that they all are available.  I think I'll give that a try instead of insisting on building it in Studio.  Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't need an Arduino board in order to compile and use the code! There's plenty written on how to find the generated hex file that Arduino 'hides'. Then you use whatever tool you like to burn it into the chip.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have successfully imported Marlin into Atmel Studio 7 and also been able to use Atmel ICE programmer/debugger to walk through execution of the code and play with hardware, see registers, etc.  I have compiled and uploaded code for Arduino Mega/RAMPS 1.4 & Prusa i3.  I do have UM2E+ as well, which would only take a few configuration changes of the code to do that as well.

Last Edited: Thu. Oct 5, 2017 - 05:48 PM