Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rogerclarkmelbourne/Arduino_STM32
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: rogerclarkmelbourne/Arduino_STM32
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing 504 changed files with 26,708 additions and 11,699 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/TestCompile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# TestCompile.yml
# Github workflow script to test compile all examples of an Arduino core repository.
#
# Copyright (C) 2020 Armin Joachimsmeyer
# https://github.com/ArminJo/Github-Actions
#

# This is the name of the workflow, visible on GitHub UI.
name: TestCompile
on:
workflow_dispatch: # To run it manually
description: 'manual build check'
push: # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows#pull-request-event-pull_request
paths:
- '**.ino'
- '**.cpp'
- '**.h'
- '**TestCompile.yml'
pull_request:
jobs:
build:
name: Test compiling examples for Arduino_STM32
runs-on: ubuntu-latest
env:
# PLATFORM_DEFAULT_URL: http://dan.drown.org/stm32duino/package_STM32duino_index.json
# Comma separated list without double quotes around the list.
REQUIRED_LIBRARIES: SdFat,Streaming,Adafruit GFX Library,Adafruit SSD1306,Adafruit STMPE610,Adafruit TouchScreen,SD

strategy:
matrix:
# The matrix will produce one job for each configuration parameter of type `arduino-boards-fqbn`
# In the Arduino IDE, the fqbn is printed in the first line of the verbose output for compilation as parameter -fqbn=... for the "arduino-builder -dump-prefs" command
#
# Examples: arduino:avr:uno, arduino:avr:leonardo, arduino:avr:nano, arduino:avr:mega
# arduino:sam:arduino_due_x, arduino:samd:arduino_zero_native"
# ATTinyCore:avr:attinyx5:chip=85,clock=1internal, digistump:avr:digispark-tiny, digistump:avr:digispark-pro
# STM32:stm32:GenF1:pnum=BLUEPILL_F103C8
# esp8266:esp8266:huzzah:eesz=4M3M,xtal=80, esp32:esp32:featheresp32:FlashFreq=80
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
#############################################################################################################
arduino-boards-fqbn:
- stm32duino:STM32F1:genericSTM32F103C
#- stm32duino:STM32F1:nucleo_f103rb
#- stm32duino:STM32F1:mapleMini

# Specify parameters for each board.
# With sketches-exclude you may exclude specific examples for a board. Use a comma separated list.
#############################################################################################################
include:
- arduino-boards-fqbn: stm32duino:STM32F1:genericSTM32F103C
# errors: BOARD_BUTTON_PIN not defined, 'textsize' was not declared in this scope, 'A0' was not declared in this scope, 'BOARD_LED_PIN' was not declared in this scope, no matching function for call to 'SPIClass::transfer(uint8_t*&, size_t&)
sketches-exclude: Debounce,StateChangeDetection,Button,QASlave,InteractiveTest,WhileStatementConditional,HardwareTimerOnePulseMode,HardwareTimerPWMInput,StringEx_Parsing,hello_STM,MIDI_Classic_Mode,JeeUdp,multipacketSD,udpListener,etherNode,SingleChannelContinuousConversion,OLED_I2C_NumberFonts,OLED_I2C_TinyFont_View,OLED_I2C_Scrolling_Text,OLED_I2C_Bitmap,OLED_I2C_3D_Cube,OLED_I2C_ViewFont,OLED_I2C_Graph_Demo,OLED_I2C_Brightness,OLED_I2C_NumberFonts,OLED_I2C_TinyFont_View,coos_display_blink,rtos_blink,rtos_display_blink,Twitter_Serial_GW,XivelyClientString,XivelyClient,ssd1306_128x64_i2c_STM32,breakouttouchpaint,graphicstest,stm32_graphicstest,TFT_Rainbow_ILI9341,TFT_Clock_ILI9341,TFT_Clock_Digital_ILI9341,TFT_Show_Font_ILI9341,graphicstest,stm32_graphicstest,onoffbutton_breakout,onoffbutton_breakout,onoffbutton,spitftbitmap,ssd1306_128x64_spi,ssd1306_128x32_i2c,ssd1306_128x32_spi,sdreader

#- arduino-boards-fqbn: stm32duino:STM32F1:nucleo_f103rb
# Examples to exclude because of ...
#sketches-exclude: WiiClassicJoystick,BasicUsage,DigisparkOLED,SoftPwm13Pins,TinySoftPwmDemo,DigiUSB2LCD,DigisparkUSBDemo,ArduinoNunchukDemo,DigisparkJoystickDemo

# Do not cancel all jobs / architectures if one job fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@master

- name: Use this repo as Arduino core
run: |
mkdir --parents $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7 # dummy release number
# cannot move, since we want to compile the examples in the library subfolder :-)
ln -s $GITHUB_WORKSPACE/STM32F1/* $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7
#cp --recursive $GITHUB_WORKSPACE/STM32F1/* $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7/
#ls -l --dereference --recursive --all $HOME/.arduino15/packages/stm32duino/hardware/STM32F1/0.0.7/
- name: Compile all examples
uses: ArminJo/arduino-test-compile@master
with:
required-libraries: ${{ env.REQUIRED_LIBRARIES }}
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
arduino-platform: stm32duino:STM32F1,arduino:sam # we require the C compiler from it. See dependencies of package_STM32duino_index.json
#platform-default-url: ${{ env.PLATFORM_DEFAULT_URL }}
#platform-url: ${{ matrix.platform-url }}
sketches-exclude: ${{ matrix.sketches-exclude }}
build-properties: ${{ toJson(matrix.build-properties) }}
sketch-names: "*.ino"
sketch-names-find-start: STM32F1/libraries/*/examples/
#debug-install: true
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -11,23 +11,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
## Summary:
This repo contains the "Hardware" files to support STM32 based boards on Arduino version 1.8.x (some older versions may also work) including [LeafLabs Maple, and Maple mini](http://www.leaflabs.com/about-maple/), and other generic STM32F103 boards.

***PRIMARY SUPPORT FORUM: http://www.stm32duino.com/***

***We are also on Gitter https://gitter.im/stm32duino/Lobby/***
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/stm32duino/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Background & Support:
* Based on https://github.com/bobc/maple-asp, which is in turn based on LibMaple by Leaflabs
* **Please read the wiki (https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki) for full details**
* See also my blog: http://www.rogerclark.net/stm32f103-and-maple-maple-mini-with-arduino-1-5-x-ide/
* **NEW: Main support site for using STM32 boards with the Arduino IDE: http://www.stm32duino.com/**
* Original LeafLabs "Docs:" http://docs.leaflabs.com/docs.leaflabs.com/index.html

## Known issues
* Use of static variables inside functions greatly increase the code size becuase additional code is needed for thread-safe handling of these statics.
If this is a problem for your application, please edit platform.txt and add -fno-threadsafe-statics the compiler.cpp.flags

**YouTube Videos:**
* 20141116: [Arduino 1.5.8 IDE with STM32 board](https://www.youtube.com/watch?v=-zwGnytGT8M)
* 20150413: [STM32 for Arduino 1.6.2 or newer (update)](https://www.youtube.com/watch?v=TePglhSkghg)
* 20150419: [Uploading via USB to Serial to STM32F103 boards](https://www.youtube.com/watch?v=G_RF0a0hrak)

## Additional Links & Info:
* https://www.hackster.io/rayburne/4-dollar-90-mips-32-bit-72-mhz-arm-arduino
105 changes: 105 additions & 0 deletions STM32F1/boards.txt
Original file line number Diff line number Diff line change
@@ -396,6 +396,15 @@ genericSTM32F103C.menu.upload_method.HIDUploadMethod.build.vect=VECT_TAB_ADDR=0x
genericSTM32F103C.menu.upload_method.HIDUploadMethod.build.ldscript=ld/hid_bootloader.ld

#-- CPU Clock frequency

genericSTM32F103C.menu.cpu_speed.speed_hsi_64mhz=64Mhz (HSI)
genericSTM32F103C.menu.cpu_speed.speed_hsi_64mhz.build.f_cpu=64000000L
genericSTM32F103C.menu.cpu_speed.speed_hsi_64mhz.build.hs_flag=-DUSE_HSI_CLOCK

genericSTM32F103C.menu.cpu_speed.speed_hsi_48mhz=48Mhz (HSI- USB)
genericSTM32F103C.menu.cpu_speed.speed_hsi_48mhz.build.f_cpu=48000000L
genericSTM32F103C.menu.cpu_speed.speed_hsi_48mhz.build.hs_flag=-DUSE_HSI_CLOCK -DHSI_USB_SPEED

genericSTM32F103C.menu.cpu_speed.speed_72mhz=72Mhz (Normal)
genericSTM32F103C.menu.cpu_speed.speed_72mhz.build.f_cpu=72000000L

@@ -432,6 +441,102 @@ genericSTM32F103C.menu.opt.ogstd=Debug (-g)
genericSTM32F103C.menu.opt.ogstd.build.flags.optimize=-Og
genericSTM32F103C.menu.opt.ogstd.build.flags.ldspecs=

###################### Generic STM32F103C6 ########################################

genericSTM32F103C6.name=Generic STM32F103C6/fake STM32F103C8
genericSTM32F103C6.vid.0=0x1EAF
genericSTM32F103C6.pid.0=0x0004
genericSTM32F103C6.build.variant=generic_stm32f103c
genericSTM32F103C6.build.vect=VECT_TAB_ADDR=0x8000000
genericSTM32F103C6.build.core=maple
genericSTM32F103C6.build.board=GENERIC_STM32F103C
genericSTM32F103C6.build.error_led_port=GPIOC
genericSTM32F103C6.build.error_led_pin=13
genericSTM32F103C6.upload.use_1200bps_touch=false
genericSTM32F103C6.upload.file_type=bin
genericSTM32F103C6.upload.auto_reset=true
genericSTM32F103C6.upload.tool=maple_upload
genericSTM32F103C6.upload.protocol=maple_dfu
genericSTM32F103C6.build.cpu_flags=-DMCU_STM32F103C6
genericSTM32F103C6.build.ldscript=ld/jtag_c6.ld
genericSTM32F103C6.upload.maximum_size=32768
genericSTM32F103C6.upload.maximum_data_size=10240

#---------------------------- UPLOAD METHODS ---------------------------

genericSTM32F103C6.menu.upload_method.DFUUploadMethod=STM32duino bootloader
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.upload.protocol=maple_dfu
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.upload.tool=maple_upload
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.build.vect=VECT_TAB_ADDR=0x8002000
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.build.ldscript=ld/bootloader_20_c6.ld
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.upload.usbID=1EAF:0003
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.upload.altID=2
genericSTM32F103C6.menu.upload_method.DFUUploadMethod.upload.maximum_size=24576

genericSTM32F103C6.menu.upload_method.serialMethod=Serial
genericSTM32F103C6.menu.upload_method.serialMethod.upload.protocol=maple_serial
genericSTM32F103C6.menu.upload_method.serialMethod.upload.tool=serial_upload
genericSTM32F103C6.menu.upload_method.serialMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG

genericSTM32F103C6.menu.upload_method.STLinkMethod=STLink
genericSTM32F103C6.menu.upload_method.STLinkMethod.upload.protocol=STLink
genericSTM32F103C6.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
genericSTM32F103C6.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER

genericSTM32F103C6.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
genericSTM32F103C6.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
genericSTM32F103C6.menu.upload_method.BMPMethod.upload.tool=bmp_upload
genericSTM32F103C6.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG

genericSTM32F103C6.menu.upload_method.jlinkMethod=JLink
genericSTM32F103C6.menu.upload_method.jlinkMethod.upload.protocol=jlink
genericSTM32F103C6.menu.upload_method.jlinkMethod.upload.tool=jlink_upload
genericSTM32F103C6.menu.upload_method.jlinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER

#genericSTM32F103C6.menu.upload_method.HIDUploadMethod=HID bootloader 2.0
#genericSTM32F103C6.menu.upload_method.HIDUploadMethod.upload.tool=hid_upload
#genericSTM32F103C6.menu.upload_method.HIDUploadMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER
#genericSTM32F103C6.menu.upload_method.HIDUploadMethod.build.vect=VECT_TAB_ADDR=0x8001000
#genericSTM32F103C6.menu.upload_method.HIDUploadMethod.build.ldscript=ld/hid_bootloader_c6.ld

#-- CPU Clock frequency
genericSTM32F103C6.menu.cpu_speed.speed_72mhz=72Mhz (Normal)
genericSTM32F103C6.menu.cpu_speed.speed_72mhz.build.f_cpu=72000000L

genericSTM32F103C6.menu.cpu_speed.speed_48mhz=48Mhz (Slow - with USB)
genericSTM32F103C6.menu.cpu_speed.speed_48mhz.build.f_cpu=48000000L

genericSTM32F103C6.menu.cpu_speed.speed_128mhz=Overclocked 128Mhz NO USB SERIAL. MANUAL RESET NEEDED TO UPLOAD
genericSTM32F103C6.menu.cpu_speed.speed_128mhz.build.f_cpu=128000000L

#-- Optimizations
genericSTM32F103C6.menu.opt.osstd=Smallest (default)
#genericSTM32F103C6.menu.opt.oslto=Smallest Code with LTO
#genericSTM32F103C6.menu.opt.oslto.build.flags.optimize=-Os -flto
#genericSTM32F103C6.menu.opt.oslto.build.flags.ldspecs=-flto
genericSTM32F103C6.menu.opt.o1std=Fast (-O1)
genericSTM32F103C6.menu.opt.o1std.build.flags.optimize=-O1
genericSTM32F103C6.menu.opt.o1std.build.flags.ldspecs=
#genericSTM32F103C6.menu.opt.o1lto=Fast (-O1) with LTO
#genericSTM32F103C6.menu.opt.o1lto.build.flags.optimize=-O1 -flto
#genericSTM32F103C6.menu.opt.o1lto.build.flags.ldspecs=-flto
genericSTM32F103C6.menu.opt.o2std=Faster (-O2)
genericSTM32F103C6.menu.opt.o2std.build.flags.optimize=-O2
genericSTM32F103C6.menu.opt.o2std.build.flags.ldspecs=
#genericSTM32F103C6.menu.opt.o2lto=Faster (-O2) with LTO
#genericSTM32F103C6.menu.opt.o2lto.build.flags.optimize=-O2 -flto
#genericSTM32F103C6.menu.opt.o2lto.build.flags.ldspecs=-flto
genericSTM32F103C6.menu.opt.o3std=Fastest (-O3)
genericSTM32F103C6.menu.opt.o3std.build.flags.optimize=-O3
genericSTM32F103C6.menu.opt.o3std.build.flags.ldspecs=
#genericSTM32F103C6.menu.opt.o3lto=Fastest (-O3) with LTO
#genericSTM32F103C6.menu.opt.o3lto.build.flags.optimize=-O3 -flto
#genericSTM32F103C6.menu.opt.o3lto.build.flags.ldspecs=-flto
genericSTM32F103C6.menu.opt.ogstd=Debug (-g)
genericSTM32F103C6.menu.opt.ogstd.build.flags.optimize=-Og
genericSTM32F103C6.menu.opt.ogstd.build.flags.ldspecs=

########################### Generic STM32F103R ###########################

genericSTM32F103R.name=Generic STM32F103R series
59 changes: 21 additions & 38 deletions STM32F1/cores/maple/HardwareSerial.h
Original file line number Diff line number Diff line change
@@ -181,44 +181,27 @@ class HardwareSerial : public Stream {
#endif
};

#ifdef SERIAL_USB
#if BOARD_HAVE_USART1
extern HardwareSerial Serial1;
#endif
#if BOARD_HAVE_USART2
extern HardwareSerial Serial2;
#endif
#if BOARD_HAVE_USART3
extern HardwareSerial Serial3;
#endif
#if BOARD_HAVE_UART4
extern HardwareSerial Serial4;
#endif
#if BOARD_HAVE_UART5
extern HardwareSerial Serial5;
#endif
#if BOARD_HAVE_USART6
extern HardwareSerial Serial6;
#endif
#else
#if BOARD_HAVE_USART1
extern HardwareSerial Serial;
#endif
#if BOARD_HAVE_USART2
extern HardwareSerial Serial1;
#endif
#if BOARD_HAVE_USART3
extern HardwareSerial Serial2;
#endif
#if BOARD_HAVE_UART4
extern HardwareSerial Serial3;
#endif
#if BOARD_HAVE_UART5
extern HardwareSerial Serial4;
#endif
#if BOARD_HAVE_USART6
extern HardwareSerial Serial5;
#endif
#ifndef SERIAL_USB
#define Serial Serial1
#endif

#if BOARD_HAVE_USART1
extern HardwareSerial Serial1;
#endif
#if BOARD_HAVE_USART2
extern HardwareSerial Serial2;
#endif
#if BOARD_HAVE_USART3
extern HardwareSerial Serial3;
#endif
#if BOARD_HAVE_UART4
extern HardwareSerial Serial4;
#endif
#if BOARD_HAVE_UART5
extern HardwareSerial Serial5;
#endif
#if BOARD_HAVE_USART6
extern HardwareSerial Serial6;
#endif

#endif //_WIRISH_HARDWARESERIAL_H_
1 change: 1 addition & 0 deletions STM32F1/cores/maple/HardwareTimer.h
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ class HardwareTimer {
*/
HardwareTimer(uint8 timerNum);

void init(void) { timer_init(this->dev); timer_pause(this->dev); }
/**
* @brief Stop the counter, without affecting its configuration.
*
4 changes: 2 additions & 2 deletions STM32F1/cores/maple/Stream.cpp
Original file line number Diff line number Diff line change
@@ -177,7 +177,7 @@ float Stream::parseFloat(char skipChar){
boolean isFraction = false;
long value = 0;
int c;
float fraction = 1.0;
float fraction = 1.0f;

c = peekNextDigit();
// ignore non numeric leading characters
@@ -194,7 +194,7 @@ float Stream::parseFloat(char skipChar){
else if(c >= '0' && c <= '9') { // is c a digit?
value = value * 10 + c - '0';
if(isFraction)
fraction *= 0.1;
fraction *= 0.1f;
}
read(); // consume the character we got with peek
c = timedPeek();
Loading