Skip to content

AVR: Compiling

Paciente8159 edited this page Jul 27, 2020 · 9 revisions

µCNC for AVR can be built in a couple of ways

Method one - Arduino IDE

  1. Download µCNC souce code and unzip-it.
  2. Go to the uCNC folder source code directory and prepare all files:
    • copy (not move) all the content inside the directory uCNC/mcus/avr and paste it inside the uCNC folder.
  3. Open uCNC Arduino sketch file
  4. Edit the board config.h file if you need to select a different AVR board. µCNC is configured by default to mimic Grbl pin configuration in the Arduino UNO board.
  5. Compile and upload µCNC to your board.

Method two - Using the makefile

  1. Download and install GCC tools for AVR inside your PC. You can download the latest version of GCC tool for AVR from Microchip from here.
    • If your are compiling with this method on a Windows machine you will also need to install Make. You can download Make for Windows from here.
  2. Go to the uCNC folder and edit the board config.h file if you need to select a different AVR board. µCNC is configured by default to mimic Grbl pin configuration in the Arduino UNO board.
  3. Go to the uCNC/mcus/avr folder.
    • The makefile is configured by default to compile the code for the MCU (atmega328p) and working frequency (16Mhz) in Arduino UNO board. If the chosen board has a different MCU/working frequency the makefile must be adjusted by modifying MCU = atmega328p and F_CPU = 16000000UL
  4. Open a command console inside uCNC/mcus/avr folder and run make clean all
  5. If everything went well you should have a hex file inside uCNC/mcus/avr/build folder
  6. Now just upload µCNC to your board using an appropriate tool. xLoader for AVR is an easy tool to use.