Programming – Pololu A-Star 32U4 User Manual
Page 21

all: $(TARGET).hex
clean:
rm -f *.o *.hex *.obj *.hex
%.hex: %.obj
avr-objcopy -R .eeprom -O ihex $< $@
%.obj: $(OBJECT_FILES)
$(CC) $(CFLAGS) $(OBJECT_FILES) $(LDFLAGS) -o $@
program: $(TARGET).hex
avrdude -p $(MCU) -c avr109 -P $(PORT) -U flash:w:$(TARGET).hex
Make sure that the PORT variable in the Makefile is set to the name of the A-Star’s virtual serial port. In Windows,
\\\\.\\USBSER000
should work if the A-Star is the only USB device connected that is using the usbser.sys driver, but
you can change it to be the actual name of the COM port (e.g.
COM13
).
In a command prompt, navigate to the directory with the Makefile and main.c. If you run the command
make
, the code
should get compiled and produce a file named “main.hex”.
Programming
To program the A-Star, you will need to get it into bootloader mode first. One way to do this is to reset the AVR twice
within 750 ms. The A-Star 32U4 Mini boards have a reset button that can be used to reset the board. On any A-Star
board, a pushbutton can be connected between the GND and RST pins to serve as a reset button, or you can use a
wire. Once the A-Star is in bootloader mode, quickly run the command
make program
to program the A-Star. If you
wait longer than 8 seconds, the A-Star bootloader will exit and the AVR will go back to running the user program.
Pololu A-Star 32U4 User’s Guide
© 2001–2014 Pololu Corporation
5. Getting started
Page 21 of 30