0
\$\begingroup\$

This question already has an answer here:

A few days ago I discovered a ATMEL ATMEGA8A-PU microcontroller and I wanted to write code on it . But I don't know what software to use in Ubuntu 18.04 for the microcontroller.

Can I use the Arduino IDE for writing code for it ?? How do I burn the code into the microcontroller ?? Do I need additional drivers for it ?? & If yes then what are those drivers ??

Please help me , I am a beginner for AVR microcontrollers.

Note :- I use Ubuntu 18.04 as OS & I am looking for the software suite for writing and burning code into my microcontroller.

\$\endgroup\$

marked as duplicate by Blup1980, RoyC, Warren Hill, laptop2d, Edgar Brown Jan 14 at 19:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \$\begingroup\$ gcc-avr as a free C compiler is available trough the standard package manager in Ubuntu, as is avrdude for uploading a HEX file to the AVR (requires external programmer device). Additionally, since Microchip aquired Atmel a while ago, it's possible they have started to build AVR support into MPLAB X, which is available for linux. \$\endgroup\$ – Unimportant Jan 1 at 11:29
  • \$\begingroup\$ The Arduino boards combine a microcontroller with programming hardware. A naked microcontroller cannot be connected to a PC (except for some USB models). \$\endgroup\$ – CL. Jan 1 at 13:06
  • \$\begingroup\$ Indeed, you'd be better off with an Arduino like board, for which you can write traditional C programs as well as Arduino "sketches". If you want that can also be used as a programmer for this related but more limited chip, but it's probably not worth the bother unless you have many of them and a suitable application... \$\endgroup\$ – Chris Stratton Jan 1 at 16:44
  • \$\begingroup\$ This question has been asked before, have a look at these questions: Linux / Mac AVR Programming Suite?, and AVR - How to program an AVR chip in Linux, and Firsthand experience with Linux AVR IDE. \$\endgroup\$ – marcelm Jan 1 at 23:32
4
\$\begingroup\$

To run the Arduino IDE on Linux reference the Arduino.cc site. Full instructions are contained here.

Note: You should have been able to do a simple search to find this documentation, there is simply no excuse for not being able to find this information yourself.

To program the ATMega8 readily from the Arduino IDE requires two things:

  1. Support for the ATMega8. This is a minimal MCU but libraries (such as this) are available to enable sketch development in the IDE.

  2. You need to be able to transfer the developed sketch to the ATMega8, and for this you can use one of two methods:

    (A) When you have a programmed bootloader in the MCU you can use serial or serial over USB configurations. The bootloader takes significant space (about 512 bytes) and limits the size of sketches in minimal MCU's, but is extremely convenient.

    (B) You can use an Arduino as an ISP to program the MCU directly. This is most useful where you want to program the bare chip that may have no serial protocol Bootloader or you need to program the bootloader into the MCU. While this requires you have an Arduino (typically a UNO or NANO) it lets you use larger sketches since there is no bootloader in the MCU.

Again, all this information is readily available on the Arduino website. I suggest you start here and here.

\$\endgroup\$
  • \$\begingroup\$ This is a better answer than mine! Plus you can get a hex file from Arduino IDE as well that can be flashed using usbasp and avrdude. File generates somewhere in the tmp folder. \$\endgroup\$ – MaNyYaCk Jan 2 at 6:17
0
\$\begingroup\$

There are two things you could do :

1) Use Arduino IDE for writing, cross compiling and uploading the hex file. Will work fine but the only downside would be overhead memory size.

2) Get avr-gcc and avrdude (or avr-dude) using sudo install command.

Get Eclipse or Netbeans as an IDE and put you commands to cross compile and flash in their build process.

Plus points if your are able to use vim as text editor and make tool for cross compiling and flashing.

Have fun !

Btw here is a small video I once made to document to install avr-gcc and avrdude. Stupid video to be honest, start at 1:31 to skip nonsense.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.