Koduino
Makefile Setup

1. Get the code

2. Toolchain setup

If you have the Arduino IDE 1.6.1

...otherwise,

In either case, test that it worked by running

1 arm-none-eabi-gcc --version

from a new terminal window.

3. Write your first program

Makefile template

In a new directory, create a file called Makefile with the following contents.

1 VARIANT = f37x
2 HSE_VALUE = 16000000UL
3 UPLOAD_METHOD = SERIAL
4 UPLOAD_BAUD = 230400
5 # Put libraries you want to use here
6 LIBRARIES = SPI Wire
7 
8 include $(KODUINO_DIR)/project.mk

Sketch template

Create another file called Blink.cpp with the following contents. (This is the Blink example from the Digital output section.)

#include <Arduino.h>
// Change to whatever pin an LED is connected to
const int led = PC13;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, TOGGLE);
delay(1000);
}

4. Upload the code

Run make in this directory. Hint: Sublime Text 3 with the "Make" build system is very convenient for this.