Merge branch 'release/v12.1.0'
This commit is contained in:
2
.github/workflows/examples.yml
vendored
2
.github/workflows/examples.yml
vendored
@@ -13,6 +13,8 @@ jobs:
|
||||
- "examples/arduino-blink"
|
||||
- "examples/arduino-external-libs"
|
||||
- "examples/arduino-internal-libs"
|
||||
- "examples/arduino-mbed-doom"
|
||||
- "examples/arduino-mbed-rpc"
|
||||
- "examples/arduino-mxchip-azureiot"
|
||||
- "examples/arduino-mxchip-filesystem"
|
||||
- "examples/arduino-mxchip-sensors"
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
||||
[submodule "builder/frameworks/libopencm3"]
|
||||
path = builder/frameworks/libopencm3
|
||||
url = https://github.com/platformio/builder-framework-libopencm3.git
|
||||
[submodule "builder/frameworks/arduino/mbed-core"]
|
||||
path = builder/frameworks/arduino/mbed-core
|
||||
url = https://github.com/platformio/builder-framework-arduino-core-mbed.git
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
"stm32cube",
|
||||
"libopencm3"
|
||||
],
|
||||
"name": "STM32F407VG (192k RAM. 1024k Flash)",
|
||||
"name": "STM32F407VG (128k RAM. 1024k Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 196608,
|
||||
"maximum_ram_size": 131072,
|
||||
"maximum_size": 1048576,
|
||||
"protocol": "stlink",
|
||||
"protocols": [
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
],
|
||||
"openocd_board": "st_nucleo_f4",
|
||||
"openocd_target": "stm32f4x",
|
||||
"svd_path": "STM32F41x.svd"
|
||||
"svd_path": "STM32F413.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"cmsis",
|
||||
|
||||
@@ -12,7 +12,13 @@
|
||||
"variant": "NUCLEO_G071RB"
|
||||
},
|
||||
"debug": {
|
||||
"default_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"jlink_device": "STM32G071RB",
|
||||
"onboard_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"openocd_target": "stm32g0x",
|
||||
"svd_path": "STM32G071.svd"
|
||||
},
|
||||
@@ -27,8 +33,9 @@
|
||||
"upload": {
|
||||
"maximum_ram_size": 36864,
|
||||
"maximum_size": 131072,
|
||||
"protocol": "mbed",
|
||||
"protocol": "stlink",
|
||||
"protocols": [
|
||||
"stlink",
|
||||
"jlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic",
|
||||
|
||||
@@ -12,7 +12,13 @@
|
||||
"can"
|
||||
],
|
||||
"debug": {
|
||||
"default_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"jlink_device": "STM32G431KB",
|
||||
"onboard_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"openocd_target": "stm32g4x",
|
||||
"svd_path": "STM32G431xx.svd"
|
||||
},
|
||||
@@ -26,8 +32,9 @@
|
||||
"upload": {
|
||||
"maximum_ram_size": 32768,
|
||||
"maximum_size": 131072,
|
||||
"protocol": "mbed",
|
||||
"protocol": "stlink",
|
||||
"protocols": [
|
||||
"stlink",
|
||||
"jlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic",
|
||||
|
||||
@@ -12,7 +12,13 @@
|
||||
"can"
|
||||
],
|
||||
"debug": {
|
||||
"default_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"jlink_device": "STM32G431RB",
|
||||
"onboard_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"openocd_target": "stm32g4x",
|
||||
"svd_path": "STM32G431xx.svd"
|
||||
},
|
||||
@@ -27,8 +33,9 @@
|
||||
"upload": {
|
||||
"maximum_ram_size": 32768,
|
||||
"maximum_size": 131072,
|
||||
"protocol": "mbed",
|
||||
"protocol": "stlink",
|
||||
"protocols": [
|
||||
"stlink",
|
||||
"jlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic",
|
||||
|
||||
@@ -12,7 +12,13 @@
|
||||
"can"
|
||||
],
|
||||
"debug": {
|
||||
"default_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"jlink_device": "STM32G474RE",
|
||||
"onboard_tools": [
|
||||
"stlink"
|
||||
],
|
||||
"openocd_target": "stm32g4x",
|
||||
"svd_path": "STM32G474xx.svd"
|
||||
},
|
||||
@@ -28,8 +34,9 @@
|
||||
"upload": {
|
||||
"maximum_ram_size": 131072,
|
||||
"maximum_size": 524288,
|
||||
"protocol": "mbed",
|
||||
"protocol": "stlink",
|
||||
"protocols": [
|
||||
"stlink",
|
||||
"jlink",
|
||||
"cmsis-dap",
|
||||
"blackmagic",
|
||||
|
||||
58
boards/portenta_h7_m4.json
Normal file
58
boards/portenta_h7_m4.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"ldscript": "linker_script.ld"
|
||||
},
|
||||
"extra_flags": "-DARDUINO_PORTENTA_H7_M4",
|
||||
"core": "arduino",
|
||||
"cpu": "cortex-m4",
|
||||
"f_cpu": "480000000L",
|
||||
"mcu": "stm32h747xih6",
|
||||
"variant": "PORTENTA_H7_M4",
|
||||
"product_line": "STM32H747xx",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2341",
|
||||
"0x035b"
|
||||
],
|
||||
[
|
||||
"0x2341",
|
||||
"0x025b"
|
||||
],
|
||||
[
|
||||
"0x2341",
|
||||
"0x045b"
|
||||
]
|
||||
]
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth",
|
||||
"wifi"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "STM32H747XI_M4",
|
||||
"openocd_target": "stm32h7x_dual_bank"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Arduino Portenta H7 (M4 core)",
|
||||
"upload": {
|
||||
"maximum_ram_size": 294248,
|
||||
"maximum_size": 1048576,
|
||||
"protocol": "dfu",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"dfu",
|
||||
"jlink",
|
||||
"stlink",
|
||||
"mbed"
|
||||
],
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": true,
|
||||
"offset_address": "0x08100000"
|
||||
},
|
||||
"url": "https://www.arduino.cc/pro/hardware/product/portenta-h7",
|
||||
"vendor": "Arduino"
|
||||
}
|
||||
58
boards/portenta_h7_m7.json
Normal file
58
boards/portenta_h7_m7.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"ldscript": "linker_script.ld"
|
||||
},
|
||||
"extra_flags": "-DARDUINO_PORTENTA_H7_M7",
|
||||
"core": "arduino",
|
||||
"cpu": "cortex-m7",
|
||||
"f_cpu": "480000000L",
|
||||
"mcu": "stm32h747xih6",
|
||||
"variant": "PORTENTA_H7_M7",
|
||||
"product_line": "STM32H747xx",
|
||||
"hwids": [
|
||||
[
|
||||
"0x2341",
|
||||
"0x035b"
|
||||
],
|
||||
[
|
||||
"0x2341",
|
||||
"0x025b"
|
||||
],
|
||||
[
|
||||
"0x2341",
|
||||
"0x045b"
|
||||
]
|
||||
]
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth",
|
||||
"wifi"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "STM32H747XI_M7",
|
||||
"openocd_target": "stm32h7x_dual_bank"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Arduino Portenta H7 (M7 core)",
|
||||
"upload": {
|
||||
"maximum_ram_size": 523624,
|
||||
"maximum_size": 786432,
|
||||
"protocol": "dfu",
|
||||
"protocols": [
|
||||
"cmsis-dap",
|
||||
"dfu",
|
||||
"jlink",
|
||||
"stlink",
|
||||
"mbed"
|
||||
],
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": true,
|
||||
"wait_for_upload_port": true,
|
||||
"offset_address": "0x08040000"
|
||||
},
|
||||
"url": "https://www.arduino.cc/pro/hardware/product/portenta-h7",
|
||||
"vendor": "Arduino"
|
||||
}
|
||||
1
builder/frameworks/arduino/mbed-core
Submodule
1
builder/frameworks/arduino/mbed-core
Submodule
Submodule builder/frameworks/arduino/mbed-core added at 67dcd5855a
@@ -125,21 +125,23 @@ def generate_hal_config_file():
|
||||
"Inc",
|
||||
)
|
||||
|
||||
if os.path.isfile(os.path.join(config_path, MCU_FAMILY + "xx_hal_conf.h")):
|
||||
return
|
||||
conf_h_path = os.path.join(config_path, MCU_FAMILY + "xx_hal_conf.h")
|
||||
template_h_path = os.path.join(config_path, MCU_FAMILY + "xx_hal_conf_template.h")
|
||||
|
||||
if not os.path.isfile(
|
||||
os.path.join(config_path, MCU_FAMILY + "xx_hal_conf_template.h")
|
||||
):
|
||||
sys.stderr.write(
|
||||
"Error: Cannot find peripheral template file to configure framework!\n"
|
||||
)
|
||||
env.Exit(1)
|
||||
if board.get("build.stm32cube.custom_config_header", "no") == "yes":
|
||||
if os.path.isfile(conf_h_path):
|
||||
os.remove(conf_h_path)
|
||||
else:
|
||||
if os.path.isfile(conf_h_path):
|
||||
return
|
||||
|
||||
shutil.copy(
|
||||
os.path.join(config_path, MCU_FAMILY + "xx_hal_conf_template.h"),
|
||||
os.path.join(config_path, MCU_FAMILY + "xx_hal_conf.h"),
|
||||
)
|
||||
if not os.path.isfile(template_h_path):
|
||||
sys.stderr.write(
|
||||
"Error: Cannot find peripheral template file to configure framework!\n"
|
||||
)
|
||||
env.Exit(1)
|
||||
|
||||
shutil.copy(template_h_path, conf_h_path)
|
||||
|
||||
|
||||
def build_custom_lib(lib_path, lib_manifest=None):
|
||||
@@ -316,8 +318,7 @@ if "build.stm32cube.variant" in board:
|
||||
#
|
||||
|
||||
# Generate a default stm32xxx_hal_conf.h
|
||||
if board.get("build.stm32cube.custom_config_header", "no") == "no":
|
||||
generate_hal_config_file()
|
||||
generate_hal_config_file()
|
||||
|
||||
env.BuildSources(
|
||||
os.path.join("$BUILD_DIR", "FrameworkHALDriver"),
|
||||
|
||||
@@ -20,6 +20,27 @@ from os.path import basename, isdir, join
|
||||
from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild,
|
||||
Builder, Default, DefaultEnvironment)
|
||||
|
||||
from platformio.util import get_serial_ports
|
||||
|
||||
|
||||
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||
env.AutodetectUploadPort()
|
||||
|
||||
upload_options = {}
|
||||
if "BOARD" in env:
|
||||
upload_options = env.BoardConfig().get("upload", {})
|
||||
|
||||
if not bool(upload_options.get("disable_flushing", False)):
|
||||
env.FlushSerialBuffer("$UPLOAD_PORT")
|
||||
|
||||
before_ports = get_serial_ports()
|
||||
|
||||
if bool(upload_options.get("use_1200bps_touch", False)):
|
||||
env.TouchSerialPort("$UPLOAD_PORT", 1200)
|
||||
|
||||
if bool(upload_options.get("wait_for_upload_port", False)):
|
||||
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
env.SConscript("compat.py", exports="env")
|
||||
@@ -98,6 +119,7 @@ if "nobuild" in COMMAND_LINE_TARGETS:
|
||||
else:
|
||||
target_elf = env.BuildProgram()
|
||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf)
|
||||
env.Depends(target_firm, "checkprogsize")
|
||||
|
||||
AlwaysBuild(env.Alias("nobuild", target_firm))
|
||||
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
|
||||
@@ -197,25 +219,32 @@ elif upload_protocol == "dfu":
|
||||
|
||||
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]
|
||||
|
||||
if board.get("build.mcu").startswith("stm32f103") and "arduino" in env.get(
|
||||
"PIOFRAMEWORK"):
|
||||
# F103 series doesn't have embedded DFU over USB
|
||||
# stm32duino bootloader (v1, v2) is used instead
|
||||
def __configure_upload_port(env):
|
||||
return basename(env.subst("$UPLOAD_PORT"))
|
||||
if "arduino" in env.get("PIOFRAMEWORK"):
|
||||
if env.subst("$BOARD").startswith("portenta"):
|
||||
upload_actions.insert(
|
||||
0,
|
||||
env.VerboseAction(
|
||||
env.AutodetectUploadPort, "Looking for upload port..."
|
||||
),
|
||||
)
|
||||
elif board.get("build.mcu").startswith("stm32f103"):
|
||||
# F103 series doesn't have embedded DFU over USB
|
||||
# stm32duino bootloader (v1, v2) is used instead
|
||||
def __configure_upload_port(env):
|
||||
return basename(env.subst("$UPLOAD_PORT"))
|
||||
|
||||
_upload_tool = "maple_upload"
|
||||
_upload_flags = [
|
||||
"${__configure_upload_port(__env__)}",
|
||||
board.get("upload.boot_version", 2),
|
||||
"%s:%s" % (vid[2:], pid[2:])
|
||||
]
|
||||
_upload_tool = "maple_upload"
|
||||
_upload_flags = [
|
||||
"${__configure_upload_port(__env__)}",
|
||||
board.get("upload.boot_version", 2),
|
||||
"%s:%s" % (vid[2:], pid[2:])
|
||||
]
|
||||
|
||||
env.Replace(__configure_upload_port=__configure_upload_port)
|
||||
env.Replace(__configure_upload_port=__configure_upload_port)
|
||||
|
||||
upload_actions.insert(
|
||||
0, env.VerboseAction(env.AutodetectUploadPort,
|
||||
"Looking for upload port..."))
|
||||
upload_actions.insert(
|
||||
0, env.VerboseAction(env.AutodetectUploadPort,
|
||||
"Looking for upload port..."))
|
||||
|
||||
if "dfu-util" in _upload_tool:
|
||||
# Add special DFU header to the binary image
|
||||
|
||||
1
examples/arduino-mbed-doom/.gitignore
vendored
Normal file
1
examples/arduino-mbed-doom/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.pio
|
||||
67
examples/arduino-mbed-doom/.travis.yml
Normal file
67
examples/arduino-mbed-doom/.travis.yml
Normal file
@@ -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
|
||||
32
examples/arduino-mbed-doom/README.rst
Normal file
32
examples/arduino-mbed-doom/README.rst
Normal file
@@ -0,0 +1,32 @@
|
||||
.. Copyright 2014-present PlatformIO <contact@platformio.org>
|
||||
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-nordicnrf52/archive/develop.zip>`_
|
||||
3. Extract ZIP archive
|
||||
4. Run these commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Change directory to example
|
||||
> cd platform-nordicnrf52/examples/arduino-mbed-doom
|
||||
|
||||
# Build project
|
||||
> platformio run
|
||||
|
||||
# Upload firmware
|
||||
> platformio run --target upload
|
||||
|
||||
# Clean build files
|
||||
> platformio run --target clean
|
||||
39
examples/arduino-mbed-doom/include/README
Normal file
39
examples/arduino-mbed-doom/include/README
Normal file
@@ -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
examples/arduino-mbed-doom/lib/README
Normal file
46
examples/arduino-mbed-doom/lib/README
Normal file
@@ -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
|
||||
15
examples/arduino-mbed-doom/platformio.ini
Normal file
15
examples/arduino-mbed-doom/platformio.ini
Normal file
@@ -0,0 +1,15 @@
|
||||
; 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:portenta_h7_m7]
|
||||
platform = ststm32
|
||||
framework = arduino
|
||||
board = portenta_h7_m7
|
||||
lib_deps =
|
||||
Portenta_Video
|
||||
57
examples/arduino-mbed-doom/src/Doom.cpp
Normal file
57
examples/arduino-mbed-doom/src/Doom.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/* Arduino wrapper for DoomGeneric
|
||||
* Mouse and keyboard controls are not implemented at the moment;
|
||||
* to use the internal QSPI flash as storage, force the board in bootloader mode
|
||||
* by double clicking the reset button and upload doom.fat.dump (from doom/utils folder)
|
||||
* with this command
|
||||
*
|
||||
* dfu-util -a1 --device 0x2341:0x035b -D doom.fat.dump --dfuse-address=0x90000000
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "QSPIFBlockDevice.h"
|
||||
#include "FATFileSystem.h"
|
||||
#include "doomgeneric.h"
|
||||
|
||||
QSPIFBlockDevice block_device(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
|
||||
// Comment previous line and uncomment these two if you want to store DOOM.WAD in an external SD card (FAT32 formatted)
|
||||
// #include "SDMMCBlockDevice.h"
|
||||
// SDMMCBlockDevice block_device;
|
||||
|
||||
mbed::FATFileSystem fs("fs");
|
||||
|
||||
extern "C" int main_wrapper(int argc, char **argv);
|
||||
char*argv[] = {"/fs/doom", "-iwad", "/fs/DOOM1.WAD"};
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
delay(2000);
|
||||
int err = fs.mount(&block_device);
|
||||
|
||||
if (err) {
|
||||
// Reformat if we can't mount the filesystem
|
||||
// this should only happen on the first boot
|
||||
printf("No filesystem found, formatting... ");
|
||||
fflush(stdout);
|
||||
err = fs.reformat(&block_device);
|
||||
}
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
printf("try to open dir\n");
|
||||
if ((dir = opendir("/fs")) != NULL) {
|
||||
/* print all the files and directories within directory */
|
||||
while ((ent = readdir (dir)) != NULL) {
|
||||
printf ("%s\n", ent->d_name);
|
||||
}
|
||||
closedir (dir);
|
||||
} else {
|
||||
/* could not open directory */
|
||||
printf ("error\n");
|
||||
}
|
||||
main_wrapper(3, argv);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
}
|
||||
11
examples/arduino-mbed-doom/test/README
Normal file
11
examples/arduino-mbed-doom/test/README
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
||||
1
examples/arduino-mbed-rpc/.gitignore
vendored
Normal file
1
examples/arduino-mbed-rpc/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.pio
|
||||
67
examples/arduino-mbed-rpc/.travis.yml
Normal file
67
examples/arduino-mbed-rpc/.travis.yml
Normal file
@@ -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
|
||||
32
examples/arduino-mbed-rpc/README.rst
Normal file
32
examples/arduino-mbed-rpc/README.rst
Normal file
@@ -0,0 +1,32 @@
|
||||
.. Copyright 2014-present PlatformIO <contact@platformio.org>
|
||||
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-nordicnrf52/archive/develop.zip>`_
|
||||
3. Extract ZIP archive
|
||||
4. Run these commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Change directory to example
|
||||
> cd platform-nordicnrf52/examples/arduino-mbed-rpc
|
||||
|
||||
# Build project
|
||||
> platformio run
|
||||
|
||||
# Upload firmware
|
||||
> platformio run --target upload
|
||||
|
||||
# Clean build files
|
||||
> platformio run --target clean
|
||||
39
examples/arduino-mbed-rpc/include/README
Normal file
39
examples/arduino-mbed-rpc/include/README
Normal file
@@ -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
examples/arduino-mbed-rpc/lib/README
Normal file
46
examples/arduino-mbed-rpc/lib/README
Normal file
@@ -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
|
||||
14
examples/arduino-mbed-rpc/platformio.ini
Normal file
14
examples/arduino-mbed-rpc/platformio.ini
Normal file
@@ -0,0 +1,14 @@
|
||||
; 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:portenta_h7_m4]
|
||||
platform = ststm32
|
||||
framework = arduino
|
||||
board = portenta_h7_m4
|
||||
lib_compat_mode = off
|
||||
36
examples/arduino-mbed-rpc/src/TestSDCARD.ino
Normal file
36
examples/arduino-mbed-rpc/src/TestSDCARD.ino
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "SDMMCBlockDevice.h"
|
||||
#include "FATFileSystem.h"
|
||||
|
||||
SDMMCBlockDevice block_device;
|
||||
mbed::FATFileSystem fs("fs");
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
delay(2000);
|
||||
int err = fs.mount(&block_device);
|
||||
if (err) {
|
||||
// Reformat if we can't mount the filesystem
|
||||
// this should only happen on the first boot
|
||||
printf("No filesystem found, formatting... ");
|
||||
fflush(stdout);
|
||||
err = fs.reformat(&block_device);
|
||||
}
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
printf("try to open dir\n");
|
||||
if ((dir = opendir("/fs")) != NULL) {
|
||||
/* print all the files and directories within directory */
|
||||
while ((ent = readdir (dir)) != NULL) {
|
||||
printf ("%s\n", ent->d_name);
|
||||
}
|
||||
closedir (dir);
|
||||
} else {
|
||||
/* could not open directory */
|
||||
printf ("error\n");
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
}
|
||||
11
examples/arduino-mbed-rpc/test/README
Normal file
11
examples/arduino-mbed-rpc/test/README
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
||||
@@ -18,7 +18,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/platformio/platform-ststm32.git"
|
||||
},
|
||||
"version": "12.0.0",
|
||||
"version": "12.1.0",
|
||||
"frameworks": {
|
||||
"mbed": {
|
||||
"package": "framework-mbed",
|
||||
@@ -84,7 +84,7 @@
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "platformio",
|
||||
"version": "~6.60600.0",
|
||||
"version": "~6.60900.0",
|
||||
"optionalVersions": [
|
||||
"~6.51506.0"
|
||||
]
|
||||
@@ -209,6 +209,12 @@
|
||||
"owner": "platformio",
|
||||
"version": "~2.10.0"
|
||||
},
|
||||
"framework-arduino-mbed": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"owner": "platformio",
|
||||
"version": "~1.3.2"
|
||||
},
|
||||
"framework-stm32cubef0": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
|
||||
10
platform.py
10
platform.py
@@ -32,7 +32,12 @@ class Ststm32Platform(PlatformBase):
|
||||
|
||||
frameworks = variables.get("pioframework", [])
|
||||
if "arduino" in frameworks:
|
||||
if build_core == "maple":
|
||||
if board.startswith("portenta"):
|
||||
self.frameworks["arduino"]["package"] = "framework-arduino-mbed"
|
||||
self.frameworks["arduino"][
|
||||
"script"
|
||||
] = "builder/frameworks/arduino/mbed-core/arduino-core-mbed.py"
|
||||
elif build_core == "maple":
|
||||
self.frameworks["arduino"]["package"] = "framework-arduinoststm32-maple"
|
||||
self.packages["framework-arduinoststm32-maple"]["optional"] = False
|
||||
self.packages["framework-arduinoststm32"]["optional"] = True
|
||||
@@ -182,9 +187,10 @@ class Ststm32Platform(PlatformBase):
|
||||
|
||||
def configure_debug_options(self, initial_debug_options, ide_data):
|
||||
debug_options = copy.deepcopy(initial_debug_options)
|
||||
server_executable = debug_options["server"]["executable"].lower()
|
||||
adapter_speed = initial_debug_options.get("speed")
|
||||
if adapter_speed:
|
||||
server_options = debug_options.get("server") or {}
|
||||
server_executable = server_options.get("executable", "").lower()
|
||||
if "openocd" in server_executable:
|
||||
debug_options["server"]["arguments"].extend(
|
||||
["-c", "adapter speed %s" % adapter_speed]
|
||||
|
||||
Reference in New Issue
Block a user