
In the same folder, create a file named “Makefile” with the following contents:
PORT=\\\\.\\USBSER000
MCU=atmega32u4
CFLAGS=-g -Wall -mcall-prologues -mmcu=$(MCU) -Os
LDFLAGS=-Wl,-gc-sections -Wl,-relax
CC=avr-gcc
TARGET=main
OBJECT_FILES=main.o
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 device’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 device, you will need to get it into bootloader mode first. One way to do this is to reset
the AVR twice within 750 ms. Most A-Stars and the Zumo 32U4 have a reset button that can be used to reset the
board. On any A-Star 32U4 or Zumo 32U4, 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 device is in bootloader mode, quickly run the command
make program
to program it. 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 Zumo 32U4 Robot User’s Guide
© 2001–2015 Pololu Corporation
5. Programming the Zumo 32U4
Page 66 of 76
Содержание Zumo 32U4
Страница 6: ...Pololu Zumo 32U4 Robot User s Guide 2001 2015 Pololu Corporation 1 Overview Page 6 of 76 ...
Страница 7: ...Pololu Zumo 32U4 Robot User s Guide 2001 2015 Pololu Corporation 1 Overview Page 7 of 76 ...
Страница 42: ...Pololu Zumo 32U4 Robot User s Guide 2001 2015 Pololu Corporation 4 Assembling the Zumo 32U4 kit Page 42 of 76 ...
Страница 58: ...Pololu Zumo 32U4 Robot User s Guide 2001 2015 Pololu Corporation 4 Assembling the Zumo 32U4 kit Page 58 of 76 ...