Skip to content

Add SPL support for bluepill board #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions boards/bluepill_f103c8.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"core": "stm32",
"cpu": "cortex-m3",
"extra_flags": "-DSTM32F1 -DSTM32F103xB -DARDUINO_BLUEPILL_F103C8",
"extra_flags": "-DSTM32F1 -DSTM32F10X_MD -DSTM32F103xB -DARDUINO_BLUEPILL_F103C8",
"f_cpu": "72000000L",
"hwids": [
[
Expand Down Expand Up @@ -35,7 +35,8 @@
"mbed",
"cmsis",
"libopencm3",
"stm32cube"
"stm32cube",
"spl"
],
"name": "BluePill F103C8",
"upload": {
Expand Down
41 changes: 41 additions & 0 deletions boards/genericSTM32L053C8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"build": {
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32L053xx",
"f_cpu": "32000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32l053c8t6",
"variant": "STM_L053C8"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32L053C8",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32l0_dual_bank",
"svd_path": "STM32L053x.svd"
},
"frameworks": [
"arduino"
],
"name": "STM32L053C8",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 65536,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial",
"dfu"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32l053c8.html",
"vendor": "ST"
}
43 changes: 43 additions & 0 deletions boards/genericSTM32L082CZ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"build": {
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32L082xx",
"f_cpu": "32000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32l080cz",
"variant": "STM_L082CZ"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32L080CZ",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32l0_dual_bank",
"svd_path": "STM32L082x.svd"
},
"frameworks": [
"arduino",
"mbed",
"stm32cube"
],
"name": "STM32L082CZ",
"upload": {
"maximum_ram_size": 20480,
"maximum_size": 196608,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial",
"dfu"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32l082cz.html",
"vendor": "ST"
}
43 changes: 43 additions & 0 deletions boards/genericSTM32L082KZ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"build": {
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32L082xx",
"f_cpu": "32000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32l080kzt6",
"variant": "STM_L082KZ"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32L080KZ",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32l0_dual_bank",
"svd_path": "STM32L082x.svd"
},
"frameworks": [
"arduino",
"mbed",
"stm32cube"
],
"name": "STM32L082KZ",
"upload": {
"maximum_ram_size": 20480,
"maximum_size": 196608,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial",
"dfu"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32l082kz.html",
"vendor": "ST"
}
2 changes: 2 additions & 0 deletions examples/spl-bluepill-blink/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.pioenvs
.piolibdeps
67 changes: 67 additions & 0 deletions examples/spl-bluepill-blink/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < https://docs.platformio.org/page/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < https://docs.platformio.org/page/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
#
#
# Please choose one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#


#
# Template #1: General project. Test it using existing `platformio.ini`.
#

# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
# - platformio update
#
# script:
# - platformio run


#
# Template #2: The project is intended to be used as a library with examples.
#

# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
# - platformio update
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
38 changes: 38 additions & 0 deletions examples/spl-bluepill-blink/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.. Copyright 2014-present PlatformIO <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

How to build PlatformIO based project
=====================================

1. `Install PlatformIO Core <http://docs.platformio.org/page/core.html>`_
2. Download `development platform with examples <https://github.com/platformio/platform-ststm32/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:

.. code-block:: bash

# Change directory to example
> cd platform-ststm32/examples/spl-blink

# Build project
> platformio run

# Upload firmware
> platformio run --target upload

# Build specific environment
> platformio run -e bluepill_f103c8

# Upload firmware for the specific environment
> platformio run -e bluepill_f103c8 --target upload

# Clean build files
> platformio run --target clean
39 changes: 39 additions & 0 deletions examples/spl-bluepill-blink/include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
46 changes: 46 additions & 0 deletions examples/spl-bluepill-blink/lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.

The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").

For example, see a structure of the following two libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
13 changes: 13 additions & 0 deletions examples/spl-bluepill-blink/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = spl
Loading