a very long headline for this simple task, but it hits the spot! Former Atmel (now Microchip) provides a very powerful back end programmer, intended to be used within a production line, to automate the programming process, without having to use Atmel Studio.
What are the benefits of using a production file? Very simple, have the user signatures, eeprom, flash and fuses combined in a single file. Then write a little batch script to burn this elf image into multiple micro controllers.
1.) How to generate a production file?
Open your project with Atmel Studio, then enter the “Device Programming” dialog. There is a own tab called “production file”. Use the lower half of the dialog, below the “Save to ELF production file” line. Choose a valid hex file for the flash, optional a eeprom and user signitures file. Then choose which of the files should be stored from the check boxes. Note that it is also possible to store the fuses and lockbits. If checked, the fuses and lockbits of the currently connected micro controller will be stored, so make sure they are configured correctly. Click on the “Save” button to store the production file.
2.) How to flash a production file from Atmel Studio?
Test your production file by using the upper part of the dialog. Enter a filename into “Program device from ELF production file”. Next choose which part of the production file you want to flash, all none existing parts will be grayed out and are not select able! Click on “Program” to flash the whole device with a single mouse click, very handy 😉
3.) How to flash a production file from a batch scrip without Atmel Studio?
Create an empty text file and name it “start_flash.bat”. Copy the textfile provided below, alter your device and tool, then start flashing.
@echo off cd "C:Program Files (x86)AtmelStudio7.0atbackend" c: atprogram -t atmelice -i pdi -d atxmega32a4 program -c -fl -fs --verify -f "d:mytestfile.elf" pause
After execution will result in the following console output.
A little bit of explanation:
“@echo off” will silence the console directory output after each script command, when removed, the result will be much more unreadable
“cd” will change the directory to the atbackend path of the Atmel Studio installation folder, make sure this folder matches your installation path
“c:” is just here for the purpose if you start your batch script from a different drive then c:
“atprogram” is used to do the heavy lifting
“-t atmelice” means which tool i want to use, enter “atprogram list” to see all available tools, for example my output
simulator No serialnumber found
“-i pdi” means i want to use the pdi interface for programming
“-d atxmega32a4” is my target microcontroller
“program” means i want to flash the contents of a file
“-c” perform a chip erase
“-fl” write flash
“-fs” write fuses
“–verify” after programming, memory contents need to match the target file
“-f <filepath>” this is my production file
4.) I want additional information about the features of atprogram!
use the console commands
“atprogram help” to get a full list of features.
It is also possible to get additional information about a single command, for example
“atprogram help program” will give you detailed information about all command line parameters available for the “program” command.