4

My question is how would I go about making files in avr - c then compiling them to the avr mkii isp.

Would I just simply create a c file, put my avr - c code in it, then type a command in the terminal to export it to the isp or is there a more complicated process?

P.S I am a complete newbie when it comes to arch linux

5
  • 1
    Did you try installing avr-gcc? Commented Apr 10, 2015 at 5:02
  • well I have all the necessary libraries installed and everything it is what to do right after that I don't completely understand Commented Apr 10, 2015 at 5:03
  • how to get the code in AVR-C from a file in arch linux to the avr mkii isp, because in windows I would just use atmel studio, in arch I am not sure Commented Apr 10, 2015 at 5:04
  • Have you built the ELF yet? Commented Apr 10, 2015 at 5:16
  • nope, how would I go about building the ELF Commented Apr 10, 2015 at 18:36

1 Answer 1

6

I don't know specifically how to do it on arch linux, but it should not be much different from how you do on the other distros. Avr-gcc is usually used to refer to the entire toolchain. But really avr-gcc is just the compiler. You also need avr-binutils(assembler, linker, object file handling) and avr-libc(libs needed). Try following this tutorial: http://www.ladyada.net/learn/avr/setup-unix.html It shows how to download and set all tools needed. It's specifically for Ubuntu which uses 'apt' as package manager. Learn how pacman works(package manager for arch linux).

When you have installed everything correctly, find a simple example program like flashing a led or similar. Compile the program in terminal, something like:

sudo avr-gcc -mmcu=(microcontroller device) flash_LED_example.c -o flash_LED_bin

This will generate a binary file, which you will need to upload to your microcontroller. Use avrdude for uploading. You need to upload via a ISP programmer, or via USB. For example in terminal(using usbasp programmer):

sudo avrdude -c usbasp -p m328p -U flash:w:flash_LED_bin

With -c you choose the programmer, -p the microcontroller device, and -U chooses what memory to target, like flash, eeprom or fuse. If to write, read or read and verify, w,r or v. And lastly the binary or hex file to upload, flash_LED_bin.

Sign up to request clarification or add additional context in comments.

2 Comments

I don't know why you are using arch, but if you are a beginner linux user, i suggest not starting with arch, use something more beginner friendly, read this, distrowatch.com/dwres.php?resource=major.
You can probably drop the sudo calls by adding your user to the group uucp (and lock if you are planning to use the Arduino IDE). See documentation on archlinux.org about accessing serial devices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.