AVRDudeR - embed avrdude in the IDE


    Arduino is a good homemade platform like me.
    Comfortable, everything is already in it.

    What is the problem?

    Not everyone likes the software part. The Arduino IDE is especially terrible. Each file opens in a new window, leaving an empty running IDE window. And other minor nonsense, which are accustomed to the convenience of Visual Studio, Borland / Embarcadero RAD IDE upset and cause displeasure.
    Fortunately, we can use any IDE we like. For ready-made projects that can only be compiled and flashed or your own trial crafts, the Wiring stub compiled by the Arduino IDE is quite suitable.
    For convenience, I use Visual Micro Arduino - the convenience of Visual Studio, fast compilation, firmware by standard means.

    Arduino without Arduino IDE

    Direct operation with a microcontroller is a step above, then you are free to do whatever you want. Often this is more convenient than understanding the stuffing of Arduino libraries. But you have to use either AVR Studio or a third-party IDE and a compiler from Atmel (fortunately, it is completely free and is included in AVR Tools).
    Everything would be fine, but they don’t know anything about Arduino and cannot flash it. And here the inconvenience begins.

    If you are not interested in the details, go straight to the point, download and configure .

    AVR Studio is a good environment, though version 4 is rather primitive, and 5th is heavy. Neither one but the firmware programmer knows how to flash. Ambush.
    I took a bootloader project that is compatible with AVR Studio, pretending to be an AVRISP programmer. The interface with it in AVR Studio was far from the most successful.

    What to do?

    There is AVRDUDE - a free flasher that works with almost all programmers for ATMEL microcontrollers. But he is console. It seems to be not a problem, wrote a cmd or bat file and all things, run it after compilation and the whole business. But I, like probably many, have more than one board. And each Arduino board is seen in the system as a separate COM port. Every programmer too. The boards have different microcontrollers (Atmega168P, Atmega328P). Apart from home-made Arduino-compatible motherboards or even with a bare microcontroller and harness.
    Each time I climb into the bat file and edit the settings for different boards or switch to another application to run it for firmware, to check if I changed a couple of bytes in the code, I personally get bored, and there are a lot of errors, so I don’t kill the controller for long. Worse, only a separate version of avrdude works with the FTBB programmer, patched for it and not knowing anything about arduino. So, if we flash through it, then we need to keep another bat file.
    In the Code :: Blocks IDE, which I liked more in terms of formatting capabilities and the convenience of working with code, the situation is slightly better, unless you can pass parameters to an external utility.

    Automation start avrdude with the necessary parameters


    I got tired of this situation and I wrote a small program that receives 2 parameters on the command line:
    - the name of the configuration file
    - the name of the firmware file.

    The utility launches avrdude with the parameters specified in the configuration file (just a file with ready settings for flashing), waits for the firmware and closes. This allows you to flash the project into any existing microcontroller during debugging in 2 clicks directly from Code :: Blocks.
    If you start with one parameter, it will read the corresponding configuration file, if with two, it will try to automatically fill in the firmware from the second parameter.

    If you are interested, download AVRDudeR It

    is very easy to integrate into the IDE (talk longer than do):
    We add two menu items to the Tools menu - to change the settings and for firmware.

    To change the settings, write:

    For the firmware:

    In fact, the settings are: the first parameter is the avrdude.ini file, which we save when setting up in the project folder, the second parameter is the file name firmware.

    The setup process looks like this:
    • We connect the programmer or Arduino board with which we will work so that the desired COM port appears in the system.
    • Run Tools-> R AVRduder: Setup, select the settings and save the settings file in the directory of your project under the name avrduder.ini (or the one specified in the settings). Close the utility


    Now, having compiled the project, select in the menu Tools-> R AVRDudeR: Flash and you're done.

    Both versions of avrdude are already in the archive, you do not need to configure or register anything in AVRDudeR.

    A little about the settings:


    MCU - microcontroller (the friendly name and code for the command line avrdude program takes from mcu.lst)
    Programmer - programmer. FTBB, Arduino with appropriate firmware as an ISP programmer (ArduinoISP), or directly connected Arduino. (The text of the menu items and codes for the programmer line in the programmers.lst file)
    Port : well, actually the COM port of the programmer or Arduino (therefore, the board must be connected during configuration).
    Baud rate : port speed. For Arduino up to UNO - 57600, UNO - 115200. In your bootloader you know which one you configured, but for FTBB mode this parameter is ignored.
    Dude type : just here and choose which avrdude - normal or for FTBB programmer to use.
    JackdawShow Result - open a window with firmware that shows the firmware process, if you are not interested and you are sure that everything is working correctly, do not put it, the program will simply display a message when avrdude finishes work and closes itself.


    The program itself can be used to upload firmware directly, without embedding.
    just double-click in the Firmware field, select the firmware file (or just insert the path to the file with your hands) and click Flash Firmware. The configuration file also works in this case.

    If the controller is changed or connected to another port, through another programmer, just select Tools-> R AVRDuder: Setup and a file with the settings for this project (or the default settings if there is no avrduder.ini in the project folder) opens. We change the port or programmer, controller, or what has changed there and save avrduder.ini back to the project folder. All.

    Yes, avrdude.ini can simply be dragged from project to project if you work with the same boards / programmers. Just copy it to the folder of the new project and you can not configure anything at all.
    Oh yeah, I forgot a bit, in Code: Blocks I selected the GNU AVR GCC Compiler and only specified the folder for AVR Tools. And the project was set up like this:

    Then the compiler creates the .elf.hex file, which we are flashing. If it is different with you, change the second parameter passed to AVRDudeR so that it transfers the name of the firmware file.

    I hope that this will save someone’s nerves, increase productivity and allow you to focus on the actual work on the idea, rather than tinker with a bunch of stray ones every time you compile and fill the project.
    If the utility proves useful, use it on your health.
    UPD Utility is still useful .
    New version available on google code

    Also popular now: