Koduino
Porting

This guide is a work in progress


The steps below are cumulative. For example, if you need to do a type 3 port, you would also need to do steps 1-2. Consequently, it is the easiest to do port to a different package for an existing chip.

Identifying your chip

The STM32 chip part numbers are of the form:

STM32|<CHIP_ID>|<PACKAGE>|<FLASH_SIZE>

For example, for STM32F405RG: CHIP_ID = F405, PACKAGE = R, FLASH_SIZE = G

In the language of the Koduino libraries (and the Arduino 1.5+ hardware spec) there are only "variants". Some variants and (a non-exclusive list of) chips that fall under it are listed below:

Variant (in Koduino libraries) Series MCU Chip IDs
f301 STM32F30x STM32F302x8 F301, F302
f303v STM32F30x STM32F303xC F303V
f37x STM32F37x STM32F37x F373, F378
f446 STM32F4xx STM32F446xx F446V
f40_41x STM32F4xx STM32F40_41xxx F405, F407, F417
f10x (not working yet) - -
f411 (not working yet) STM32F4xx STM32F411xE F411
f429_439 (not working yet) STM32F4xx STM32F429_439xx F429, F439

Choose:

1. New package

2. New variant

A variant corresponds to a subdirectory of koduino/variants. You need a new variant in the following cases:

2.1 Generating variant.cpp

Unfortunately, which pins are able use analogRead, which timers need to be activated for analogWrite needs to be manually set up for a new chip.

I find that this process is made easier with spreadsheets, examples of which are in the table below:

Variant Pin map Timer map
f37x (done manually) - -
f40_41x f40_41x_PIN_MAP f40_41x_TIMER_MAP
f411 (needs to be checked) f411_PIN_MAP f411_TIMER_MAP
f10x (in progress) f10x_PIN_MAP f10x_TIMER_MAP

Follow these steps:

3. New memory size for existing chip

Need new startup .S file

4. New chip in existing series

5. New series