Development

Introduction

For many years all my MCU projects using Atmel MCUs I have used the IDE provided by Atmel or now Microchip. First I started using AVR Studio up to version 4.19 and then switched to Atmel Studio 7.0. Is I’m using a MacIntosh I had to run Windows in a virtual machine. Recently Microchip has started to support Atmel MCUs in their MPLAB X IDE development environment which is also supported on macOS natively. However I was very disappointed when I found out that the assembler for Atmel MCUs has not bee converted to macOS and therefore it did not support assembler projects. However I almost exclusively develop my applications for Atmel MCUs in assembler.

Invoke avrasm2 directly

Therefore I had a closer look at Atmel Studio 7.0 and how it was invoking the AVR assembler avrasm2. Soon I found out that it just executes a single simple command line. And at the end it was obvious that you do not need any of the additional features of Atmel Studio when the only thing you are using is the assembler.

I still use a virtual machine to run Windows 10 but then I just open a “Command Prompt” and change to the appropriate directory where my project is located. Typically Z: is mapped to the home directory of my macOS account and then I just invoke the assembler.

z:\AVR-Projects\RLV12Emu>cd
z:\AVR-Projects\RLV12Emu

z:\AVR-Projects\RLV12Emu>
z:\AVR-Projects\RLV12Emu>"c:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\avrasm2.exe"  -fI -o "Qbridge11-v2.hex"  -m "Qbridge11-v2.map"  -l "Qbridge11-v2.lss"  -S "Qbridge11-v2.tmp"  -W+ie -I"..\include"  -d "Qbridge11-v2.obj"  "Qbridge11-v2.asm"  -I "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include"

It is a rather lengthy command line but once you can also prepare it in a text editor and then paste it into the “Command Prompt”

z:\AVR-Projects\RLV12Emu>"c:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\avrasm2.exe"  -fI -o "Qbridge11-v2.hex"  -m "Qbridge11-v2.map"  -l "Qbridge11-v2.lss"  -S "Qbridge11-v2.tmp"  -W+ie -I"..\include"  -d "Qbridge11-v2.obj"  "Qbridge11-v2.asm"  -I "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\Include"
AVRASM: AVR macro assembler 2.2.7 (build 69 Jul 26 2017 16:25:06)
Copyright (C) 1995-2017 ATMEL Corporation

Qbridge11-v2.asm(1): Including file 'C:\Program Files (x86)\Atmel\AVR Tools\AvrAssembler2\Appnotes\m1284Pdef.inc'
Qbridge11-v2.asm(98): Including file '../include/macro-library-v1-0.asm'
Qbridge11-v2.asm(99): Including file '../include/FAT/fat-defs.asm'
Qbridge11-v2.asm(336): Including file 'Qbridge11-rlv12-defs-v2.asm'
Qbridge11-v2.asm(1130): Including file 'Qbridge11-rlv12-csr-v2.asm'
Qbridge11-v2.asm(1336): Including file '../include/monitor-chartbl-v1-3.asm'
Qbridge11-v2.asm(1363): Including file '../include/monitor-subtbl-v1-3.asm'
Qbridge11-v2.asm(1690): Including file '../include/monitor-v1-6.asm'
Qbridge11-v2.asm(1695): Including file '../include/print-v1-2.asm'
Qbridge11-v2.asm(1700): Including file '../include/tparse-v1-2.asm'
Qbridge11-v2.asm(1705): Including file '../include/malloc-v1-0.asm'
Qbridge11-v2.asm(1710): Including file '../include/SD-Card-IO-v2-0.asm'
Qbridge11-v2.asm(1715): Including file 'Qbridge11-rlv12-v2.asm'
Qbridge11-v2.asm(1721): Including file 'Qbridge11-monitor.asm'
Qbridge11-v2.asm(1724): Including file 'Qbridge11-cli.asm'
Qbridge11-v2.asm(1726): Including file 'fdisk.asm'
Qbridge11-v2.asm(1728): Including file 'FAT-library-v1-3.asm'
Qbridge11-v2.asm(1730): Including file 'Qbridge11-mountvolume-v1-0.asm'
Qbridge11-v2.asm(1897): Including file 'Qbridge11-monitor-pdp11.asm'
Qbridge11-v2.asm(1901): Including file 'crashdump.asm'
Qbridge11-v2.asm(1): Including file 'C:\Program Files (x86)\Atmel\AVR Tools\AvrAssembler2\Appnotes\m1284Pdef.inc'
Qbridge11-v2.asm(98): Including file '../include/macro-library-v1-0.asm'
Qbridge11-v2.asm(99): Including file '../include/FAT/fat-defs.asm'
Qbridge11-v2.asm(336): Including file 'Qbridge11-rlv12-defs-v2.asm'
Qbridge11-v2.asm(1130): Including file 'Qbridge11-rlv12-csr-v2.asm'
Qbridge11-v2.asm(1336): Including file '../include/monitor-chartbl-v1-3.asm'
Qbridge11-v2.asm(1363): Including file '../include/monitor-subtbl-v1-3.asm'
Qbridge11-v2.asm(1690): Including file '../include/monitor-v1-6.asm'
Qbridge11-v2.asm(1695): Including file '../include/print-v1-2.asm'
Qbridge11-v2.asm(1700): Including file '../include/tparse-v1-2.asm'
Qbridge11-v2.asm(1705): Including file '../include/malloc-v1-0.asm'
Qbridge11-v2.asm(1710): Including file '../include/SD-Card-IO-v2-0.asm'
Qbridge11-v2.asm(1715): Including file 'Qbridge11-rlv12-v2.asm'
Qbridge11-v2.asm(1721): Including file 'Qbridge11-monitor.asm'
Qbridge11-v2.asm(1724): Including file 'Qbridge11-cli.asm'
Qbridge11-v2.asm(1726): Including file 'fdisk.asm'
Qbridge11-v2.asm(1728): Including file 'FAT-library-v1-3.asm'
Qbridge11-v2.asm(1730): Including file 'Qbridge11-mountvolume-v1-0.asm'
Qbridge11-v2.asm(1897): Including file 'Qbridge11-monitor-pdp11.asm'
Qbridge11-v2.asm(1901): Including file 'crashdump.asm'

"ATmega1284P" memory use summary [bytes]:
Segment   Begin    End      Code   Data   Used    Size   Use%
---------------------------------------------------------------
[.cseg] 0x000000 0x00922a  20130  16562  36692  131072  28.0%
[.dseg] 0x000100 0x000f7a      0   3691   3691   16384  22.5%
[.eseg] 0x000000 0x000000      0      0      0    4096   0.0%

Assembly complete, 0 errors. 0 warnings

z:\AVR-Projects\RLV12Emu>

You can use the -h switch to display all command line options of the avrasm2.

z:\AVR-Projects\RLV12Emu>"c:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avrassembler\avrasm2.exe" -h
AVRASM: AVR macro assembler 2.2.7 (build 69 Jul 26 2017 16:25:06)
Copyright (C) 1995-2017 ATMEL Corporation

usage: avrasm2.exe [options] file.asm

 Options:
    -f O|M|I|G -  output file format:
        -fO Debug info for simulation in AVR Studio (default)
            -fO1 | -fO2 - force format version 1 or 2 (default: auto)
        -fM Motorola hex
        -fI Intel hex
        -fG Generic hex format
        -f- No output file
    -o ofile   Put output in 'ofile'.
    -d dfile   Generate debug info for simulation in AVR Studio in 'dfile'.
               Can only be used with the -f [M|I|G] option.
    -l lfile   Generate listing in 'lfile'
    -m mfile   Generate map in 'mfile'
    -e efile   Place EEPROM contents in 'efile'
    -w         Relative jumps are allowed to wrap for program ROM
               up to 4k words in size
    -C ver     Specify AVR core version
    -c         Case sensitive
    -1/-2      Turn on/off AVR Assembler version 1 compatibility.
    -p1|0      Set/unset AVRASM1 implicit .device include (also set by -1)
    -I dir     Preprocessor: Add 'dir' to include search path
    -i file    Preprocessor: Explicitly pre-include file
    -D name[=value] Preprocessor: Define symbol. If =value is
               omitted, it is set to 1.
    -U name    Preprocessor: Undefine symbol.
    -S file    Produce include/label info file for AVR Studio
    -v verbosity [0-9][s]:
        -vs Include target resource usage statistics
        -vl Output low-level assembly code to stdout
        -vk Keep output files if source file empty
        -v0 Silent, only error messages printed
        -v1 Error and warning messages printed
        -v2 Error, warning, and  info messages printed (default)
        -v3-v9 Unspecified, increasing amounts of assembler internal dumps.
    -V         Format map and list files for Verilog.
    -8 -|+     Force Disable/Ebable 8kB check for JMP/CALL
    -O i|w|e   Overlap report: ignore|warning|error [error]
    -W-b|+bo|+bi Byte operand out of range warning disable|overflow|integer
    -W+ie|+iw  Unsupported instruction error | warning
    -W+fw      Label slip caused by forward ref accepted (DANGEROUS)
    -FD|Tfmt   __DATE__ | __TIME__ format, using strftime(3) format string
    -h         this help


z:\AVR-Projects\RLV12Emu>

Then to load the binary files into the MCU I now no longer use Atmel Studio but instead use avrdude as a native macOS command line tool

/usr/local/bin/avrdude -P usb -c avrispmkII -p ATmega1284P -s -B 1MHz -U flash:w:Qbridge11-v2.hex

Additional thoughts

So what will be the next step, most likely I will get the GNU toolchain or something equivalent on Windows 10 and install as well avrdude in my virtual machine and start using make files to assemble the code and load the hexfile to Atmel MCUs.