A-Star 32U4 Prime and AVR GCC

I am running a Debian Linux based distro and use avr-gcc, avrdude, etc. directly with Atmega328 based arduino boards. I do not use the Arduino IDE or libraries. I would like to program the A-Star 32U4 the same way.

Do you have any examples using avr-gcc to directly program the A-Star controllers?

Also, do you have any example code using a virtual serial port where stdio/printf are setup to write to the USB?

I assume you would use LUFA, but I have not worked with it yet so I am looking for good examples.

Thank you.


I recommend reading the “Programming using avr-gcc and AVRDUDE” section of the A-Star 32U4 User’s Guide, which will help you compile a basic program that blinks an LED and load it onto your A-Star 32U4. It’s a good idea to do this before attempting to compile and load more complicated programs.

LUFA comes with several example programs showing how to use a virtual serial port, and you can probably get them to work on the A-Star 32U4, but I have not tried.

Also, LUFA comes with example code for an AVR109 bootloader with a virtual serial port, which is the basis of the Arduino Leonardo bootloader (Caterina), which is the basis of the A-Star 32U4 bootloader. If none of the examples in the latest version of LUFA work for you, you might try compiling the A-Star 32U4 bootloader, which depends on an older version of LUFA (LUFA-111009). Since the bootloader works on the A-Star 32U4 and has a virtual COM port, it might be a good starting point for your application.

To make printf behave the way you want it to, you would have to write your own implementation of putchar and then tell avr-libc to use it by calling fdevopen. We have some example code that does that in OrangutanLCD.cpp from the Pololu AVR C/C++ Library.