Minimal GNU for Windows 32bit is a C/C++ programming environment that you can download to your Windows computer. Once installed, you can compile GCC programs and build with make just like on Linux.
For this project you will need to setup mingw32 on your computer. In project Windows and DOS C program with MinGW GCC Compiler we compile and run a Hello World program on your PC. Select mingw32-base package and all the necessary programs install.
For Windows to know where these new programs are located you need to edit the PATH environmental variable. A computer restart and your PC will have the updated PATH.
Open a CMD window and type PATH. Do you see C:\MinGW\bin on the list? Look in the folder and see the new commands.
Check your installation and try the where gcc and make -version commands.
AVRA Assembler ProgramAVRA is a compiler that converts AVR assembly language into hex files that run on ATmega and ATtiny processors. We are going to download the source files for AVRA and compile a windows executable avra.exe.
MinGW32 is one software environment that does this. This project is a very simple build with only a few files. The Makefile script is also quite basic.
Copy AVRA RepositoryGo to the avra repository on github and download avra-master. The easiest way is Click on the Green Code box and choose Download ZIP.
Unzip the avra-master download and locate a directory named src containing source files. These are the files with a .c or .h extension.
Create a new directory folder named AVRA and copy all of the source files into the folder. Download and add the Makefile attached to this project. You can edit a Makefile with notepad but be careful that it have no extension to the filename.
Quite simple. We can build our final program module by module from the terminal screen by hand. Make is a GCC related application where a text script is executed. Automation is quicker and fewer mistakes.
Your computer will take each of the the source files and build an object file with a .o extension. On a final pass the objects are assembled into an executable with.exe extension. Our final avra.exe will run on a Windows PC.
CC = gcc
CFLAGS ?= -Wall -O3
CFLAGS += $(CDEFS)
LDFLAGS ?= -s -static
SOURCES = avra.c \
device.c \
parser.c \
expr.c \
mnemonic.c \
directiv.c \
macro.c \
file.c \
map.c \
coff.c \
args.c \
stdextra.c
OBJECTS = $(SOURCES:.c=.o)
avra: $(OBJECTS)
$(CC) -o avra.exe $(OBJECTS) $(LDFLAGS)
clean:
rm -f avra.exe *.o *.p *~
Open TerminalOn PC keyboard press the Windows key and type cmd. A black window opens up and you cd change directory until you are in the AVRA folder.
Spelling is important. Make is a GCC related application where a text script is executed. You could type the same commands in, by hand, but automation is quicker and fewer mistakes.
Your computer has taken each of the the source files and built an object file with a .o extension. On a final pass the objects are assembled into an executable with.exe extension.
Copy avra.exeLet's make sure that we can compile an AVR assembly program. Let's do the project Assembly program Arduino on Linux with AVRA. Copy avra.exe into the same folder as count.asm and m328Pdef.inc.
The zip file we downloaded contains definitions files for 78 AVR processors. The ATmega328p is the processor used in the Arduino Uno board.
Open a terminal in the directory with the files and enter avra count.asm.
It generates a valid hex file that uploads to an Arduino board.
In the AVRA directory where we built our executable, we can run make clean and see all of our generated files erased.
Comments