Опубликовано 2015-02-16 17:05:42 автором Genya

How fast start programming AVR to Eclipse in Linux (Ubuntu)


Here is the matrix of the steel article . In which everything is explained in more detail, but do not specify the error and how to solve them, that you risk encounter. Therefore, in this paper, as a step by step guide, we explain how to do everything (as I did at home). And that can be found for a clear and complete understanding. Let's go!


All the operations were carried out at Ubuntu 14.04 .

Install Eclipse

sudo apt-get install eclipse eclipse-cdt


Set the AVR & quot; prichandaly & quot;

sudo apt-get install gcc-avr binutils-avr avr-libc gdb-avr uisp avrdude avarice


Set the AVR Eclipse Plugin.


1. Open dialogue software updates ("FAQ & gt; Install New Software»).

2. Click «Add ...», to the right, and enter the address of the update site: http://avr-eclipse.sourceforge.net/updatesite/ (EN)

3. Then click OK. Now the address of this site will be visible in the list of update sites. Select «AVR Eclipse Plugin» and press «Install ...» in the upper right corner.

Then all agree and acknowledge that you will ask, do not be afraid of these windows (Fig. below), although it may think - the computer and still your risk:)

At the end you have to ask for permission to restart Eclipse.

___________

If you have any problems with the current version (and I and it was), it can save you install a newer version from the project page , eg версии 2.4.2 . To do this, go to the already familiar path («Help & gt; Install New Software & gt; Add ...») and using the "Archive ..." indicate our download a file with a newer version. Well, after all as you already know;)

___________

Create AVR-project

In order to create a new AVR-project, you must do the following steps: Click «File-> New-> Project ...» («File-> New-> Project»).

In the window that appears, select which project you want to create. For example, "C ++ Project» and click «Next>» («Next>»).

This will open a window for selecting the type of project. AVR Plugin offers two options:
«AVR Cross Target Application» - to create an application that can be downloaded to the AVR-processor;
«AVR Cross Target Static Library» - to create a library of frequently used functions, which can then be linked with the program.

Select «AVR Cross Target Application> Empty Project» and enter the name of the project. Click «Next>» («Next>»)

This window we do not care, so easy to skip it by pressing the «Next>» («Next>»).

And now the climax. If you're unlucky and your window is different from the screenshot below (no choice microcontroller tab «MCU Type») I suggest you scroll through the article above, the moment you install a newer version of the plug, and do this very important operation.

So, we now have a project, but no code. Let's create something and check if it will work at all.
To create a new file, follow these steps:
In the preview window, select your project (aka you until one?), Press the right mouse button and select from the drop down menu «New-> Source File»

In the «Source File» write the name of the file "main.cpp" and click "Finish».

Compiling project

Now you can write a text program such as this:

 int main (void)
{
const int some_size = 1000;

while (true)
{
for (int i = 0; i & lt; some_size; i ++)
int a = 3; // Some action
}

return 0; // Never gets here
}  
And try to collect their first project. Do not forget to save your changes before assembly (Ctrl + S) or set it to save, before assembly, automatically. 

A small opening (picture below):
1. icon hammer - Compile (build) project, two standard debug mode and release.
2. Fill the project to the device.

If you build you do not see the red Error'ov, that is good reason to believe that it was a success :). Below are examples of successful and unsuccessful assembly. Warning'i can be ignored, but it is better to try that would have them or reduce them to a minimum.

Fill ready firmware

Those who are impatient or lazy to read the instructions immediately get an error (picture below). Bear with another, not much left, proceed to the final part of our torment Settings Eclipse.

In the settings «Project-> Properties-> AVR-> AVRDude» have the opportunity to select the type of programming and its mode of operation.

When you first come to this tab, the selection list, you will be nothing. Use the «New ...»

Next, choose your type of programming. In the picture below, the example of the Set USBasp .

If you now try to flash your device, you probably get this error.


To fix this, simply assign avrdude suid-bit follows

sudo chmod u + s / usr / bin / avrdude

And, probably, the last pitfall, which could break your enthusiasm in the development of Eclipse. When you try to fill the firmware to the device may receive the following message.

Do not rush to wonder from the text «Maybe the project needs to be build first» (because you have already collected the project before attempting to fill?), you're likely to build the project in debug mode, we quickly fix it now, get only the arrow near hammer icon and switch to «Release».

And the natural result of our labors.


Voila! It's done. This concludes our statement ends, but not your adventures ...


P.S. If in the process you screwed up somewhere: something created, then removed, and then re-created, changed, and then reattached, etc. and now does not work, even what worked before and pop some very strange errors. Do not rush to remove all and throw your computer. You might save a simple tool called Clean project. No project files is not removed, but only to clean the Temp folder. What would perform click «Project-> Clean ...»

Комментарии - (0)

Добавить комментарий

Для отправки комментария вы должны авторизоваться.