Hello!
I’m making a quick post here (that will be updated for at least the duration of the term) for programming the SM32U4 micro-controller with the Linux toolkit targeted at the Benny Boards. It works for me on Nixos, but ymmv, especially on older distros such as Ubuntu.
Required Tools
Install these for your required distro before continuing.
In addition, please download the m32U4def.ico file and place it in your current working directory.
Assembling a Program
Download (or make) an assembly program for your device and place it in the working directory.
You can assemble it using AVRA:
avra file.asm
Which outputs:
|
|
Which should produce a number of files, one being a hex file.
This works because I commented line 47 in the inc file that was broken on the AVRA version I used. If you use the file that the lab guide links to, it Will Not Work
Flashing a Program
For the Benny Board, you can use avrdude to flash hex files to your Benny Board.
To Flash, make sure that your usb port is plugged to the USB next to the 2-pin white connector on the left side of the board. In addition, the board does not show up as a serial device until the rst
button is pressed and the board is in flashing mode. Just make sure to press the rst
button and then run the flashing command, it should work.
sudo avrdude -c avr109 -p m32u4 -P /dev/ttyACM0 -U flash:w:file.hex
Which outputs:
|
|
If that does not work, it is possible that you either did not properly flash after pushing the rst
button or perhaps the serial device your board is connected to is different than the default one. You could try searching for a different serial device (which is located in /dev/ttyACM
or /dev/ttyUSB
in general.
Epilogue
Hopefully with that, one should be able to assemble and flash your assembly files to your microcontroller. I believe there is a requirement to use a specific simulator later in the term; I will add instructions for that once we get to that point.