This project provides a portable environment for compiling and uploading AVR assembly code using batch scripts. All necessary tools are included within the project folder, making it fully portable and usable from any location — including USB sticks.
This setup simplifies AVR assembly development by bundling the assembler (avra) and uploader (avrdude) tools alongside scripts that automate compiling and flashing your code. You only need to provide the source or hex filename; all configurations and paths are handled internally.
This project is released under the MIT License.
Included tools (avra, avrdude) are third-party software and distributed under their respective GPL licenses. Please refer to their documentation for more information.
compile.bat filename.asm
- Run the compile script with the assembly filename as parameter:
- This calls
avrafrom the projectToolsfolder and uses the localincludesdirectory for include files. - The output hex file will be generated in the same folder.
upload.bat filename.hex
- Programmer (default:
avrispmkii) - Chip type (default:
attiny85) - Port (default:
usb) - Baud rate (default:
57600)
upload.bat filename.hex [programmer] [chip] [port] [baud]
| usbasp
| usbtiny
| avrisp
| avrispmkii
| stk500
| jtag2
| dragon_isp |
| attiny13
| attiny85
| atmega8
| atmega328p
| atxmega128a1 |
- Portable: All tools reside inside the project folder; no external installs needed.
- Configurable: Upload script supports override of programmer, chip, port, and baudrate.
- Error Detection: Both scripts detect and report errors in compilation or upload.
- Include Support:
compile.batautomatically includes files from the localincludesdirectory. - Environment Isolation: Uses
setlocalin batch scripts to avoid environment pollution.
- Make sure your programmer is connected and the correct port is selected before uploading.
- Keep your source
.asmfiles and includes organized inside the project folder. - Use relative paths only to maintain portability.
- You can run the entire setup from a USB drive without changing configurations.
This setup provides a complete AVR assembly development environment with zero installation needed. It’s especially useful for learning, teaching, or quick prototyping — even offline.
💬 "I created this because I remember how hard it was to get started when everything was poorly explained. Now it's simple, self-contained, and just works."
avra -Options
avra main.asm segm1.asm -I includes/ -o output.hex -f ihex
-
-l: Creates a listing file with the extension .lst, containing the assembler code, its addresses, and the generated machine instructions. -
-m: Creates a file with macro definitions and references. -
-e: Creates a file with the symbol table. -
-P: Allows setting the processor used. For example, -P attiny85 for the ATtiny85. -
-d: Enables debug mode. -
-f: Allows setting the output format, such as Intel Hex or raw binary. -
-O: Optimizes the assembler output. -
-D: Defines macros before starting the assembler. -
-I: Adds a directory to the search path for include files. -
-N: Suppresses warnings. -
-o: Sets the name of the output file. -
-H: Enables the use of hexadecimal numbers in the source code. -
-x: Enables support for Atmel XMEGA processors. -
-V: Displays the assembler version. -
-h: Displays a help message explaining available options and their usage.
avrdude -Options
-
avrdude: The main command to run Avrdude.
-
-c avrispmkii: Selects the programmer used for communication with the AVR chip. In this case, "avrispmkii," a common AVR programmer. arduinoavrdude -c ? \\to list all supported programmer devices. -
-B16: Sets the bit rate for serial communication with the AVR chip to 16. The B stands for "baud rate." -
-pattiny85: Selects the specific AVR chip to be accessed. In this case, the ATtiny85.avrdude -p ? \\to list all supported devices. -
-U flash:w:"%hex":a: The main command to write firmware (hex file) to the AVR chip. flash:w: means writing to the chip’s flash memory. %hex is the path to the hex file. The :a at the end means the file is transferred in ASCII mode. -
-B %clk: Dynamically adjusts the serial communication bit rate according to the chip clock frequency. %clk stands for the chip clock. -
-C Tools\avrdude\avrdude.conf: Specifies the configuration file for Avrdude. This file contains various settings and configurations. -
-P usb: Specifies the communication port for the programmer. Here, it is the USB port.avrdude -P ? \\lists all available ports, such as USB, COM, or serial interfaces.