Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jul 28, 2023
2 parents d3b1912 + 7fdde23 commit d32e136
Show file tree
Hide file tree
Showing 45 changed files with 1,364 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:
example:
- "examples/arduino-blink"
- "examples/arduino-internal-libs"
- "examples/arduino-uno-r4-led-animation"
- "examples/arduino-wifiscan"
- "examples/cmsis-blink"
- "examples/fsp-blink"
- "examples/fsp-button-isr"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.pyc
.piolibdeps
.pio
__pycache__

4 changes: 3 additions & 1 deletion boards/portenta_c33.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"svd_path": "R7FA6M5BH.svd"
},
"frameworks": [
"arduino"
"arduino",
"fsp",
"cmsis"
],
"name": "Arduino Portenta C33",
"upload": {
Expand Down
4 changes: 3 additions & 1 deletion boards/uno_r4_minima.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"svd_path": "R7FA4M1AB.svd"
},
"frameworks": [
"arduino"
"arduino",
"fsp",
"cmsis"
],
"name": "Arduino Uno R4 Minima",
"upload": {
Expand Down
4 changes: 3 additions & 1 deletion boards/uno_r4_wifi.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"svd_path": "R7FA4M1AB.svd"
},
"frameworks": [
"arduino"
"arduino",
"fsp",
"cmsis"
],
"name": "Arduino Uno R4 WiFi",
"upload": {
Expand Down
55 changes: 55 additions & 0 deletions builder/frameworks/cmsis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from os.path import isdir, join

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()
variant = board.get("build.variant")

env.SConscript("_bare.py")

FRAMEWORK_DIR = platform.get_package_dir("framework-cmsis-renesas")
assert isdir(FRAMEWORK_DIR)

env.Append(
CFLAGS=[
"-std=gnu11"
],

CPPDEFINES=[
"_RENESAS_RA_"
],

CXXFLAGS=[
"-std=gnu++17",
"-fno-use-cxa-atexit"
],

CPPPATH=[
join(FRAMEWORK_DIR, "CMSIS", "Core", "Include"),
join(FRAMEWORK_DIR, "Device", "RENESAS", "Include"),
join(FRAMEWORK_DIR, "Device", "RENESAS", "Source"),
],
LINKFLAGS=[
"--specs=nano.specs"
],
LIBPATH=[
join(FRAMEWORK_DIR, "variants", variant)
],
LDSCRIPT_PATH=join(FRAMEWORK_DIR, "variants", variant, "fsp.ld")
)

if board.id == "portenta_c33":
env.Append(CPPDEFINES=[("BSP_MCU_GROUP_RA6M5", 1)])
else:
env.Append(CPPDEFINES=[("BSP_MCU_GROUP_RA4M1", 1)])

libs = []

libs.append(env.BuildLibrary(
join("$BUILD_DIR", "CMSISFramework"),
join(FRAMEWORK_DIR, "Device", "RENESAS", "Source"))
)

env.Prepend(LIBS=libs)
115 changes: 115 additions & 0 deletions builder/frameworks/fsp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
from os.path import isdir, join

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()
variant = board.get("build.variant")

env.SConscript("_bare.py")

FRAMEWORK_DIR = platform.get_package_dir("framework-renesas-fsp")
assert isdir(FRAMEWORK_DIR)

env.Append(
CFLAGS=[
"-std=gnu11"
],

CPPDEFINES=[
"_RENESAS_RA_"
],

CXXFLAGS=[
"-std=gnu++17",
"-fno-use-cxa-atexit"
],

CPPPATH=[
join(FRAMEWORK_DIR, "fsp", "inc"),
join(FRAMEWORK_DIR, "fsp", "inc", "api"),
join(FRAMEWORK_DIR, "fsp", "inc", "instances"),
join(FRAMEWORK_DIR, "fsp", "src"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce", "common"),
join(FRAMEWORK_DIR, "fsp", "inc", "arm", "CMSIS_5", "CMSIS", "Core", "Include"),
join(FRAMEWORK_DIR, "variants", variant),
join(FRAMEWORK_DIR, "variants", variant, "includes", "ra_gen"),
join(FRAMEWORK_DIR, "variants", variant, "includes", "ra_cfg", "fsp_cfg"),
join(FRAMEWORK_DIR, "variants", variant, "includes", "ra_cfg", "fsp_cfg", "bsp"),
join(FRAMEWORK_DIR, "variants", variant, "tmp_gen_c_files")
],
LINKFLAGS=[
"--specs=nano.specs"
],
LIBPATH=[
join(FRAMEWORK_DIR, "variants", variant)
],
LDSCRIPT_PATH=join(FRAMEWORK_DIR, "variants", variant, "fsp.ld")
)

libs = []

# Extracted from ArduinoCore-Renesas\extras\e2studioProjects\Santiago\configuration.xml "raComponentSelection"
sublibs_uno_r4_x = ["r_adc", "r_agt", "r_cgc", "r_dac", "r_doc", "r_dmac", "r_dtc",
"r_elc", "r_gpt", "r_icu", "r_iic_master", "r_iic_slave", "r_ioport",
"r_kint", "r_lpm", "r_rtc", "r_sce/crypto_procedures/src/sce5", "r_sce5_ra4",
"r_sci_i2c", "r_sci_spi", "r_sci_uart", "r_spi", "r_usb_basic", "r_usb_pcdc",
"r_wdt", "r_can", "r_flash_lp", "rm_vee_flash"]
# Extracted from ArduinoCore-Renesas\extras\e2studioProjects\portenta_h33_lib
sublibs_portenta_c33 = ["r_adc", "r_agt", "r_canfd", "r_cgc", "r_crc", "r_dac", "r_dmac", "r_dtc",
"r_elc", "r_ether_phy", "r_ether", "r_flash_hp", "r_gpt", "r_icu", "r_iic_master",
"r_iic_slave", "r_ioport", "r_lpm", "r_qspi", "r_rtc",
"r_sce_protected/crypto_procedures/src/sce9", "r_sci_i2c", "r_sci_spi",
"r_sci_uart", "r_spi", "r_ssi", "r_usb_basic", "r_usb_pcdc", "r_usb_composite",
"r_wdt", "rm_adpcm_decoder", "r_sdhi"]
# This is always built
src_filter = [
"-<*>",
"+<bsp/cmsis>",
"+<bsp/mcu/all>"
]
if board.get("build.mcu", "").lower().startswith("ra4m1"):
src_filter.append("+<bsp/mcu/ra4m1>") # Uno R4 (Minima, WiFI)
else:
src_filter.append("+<bsp/mcu/ra6m5>") # Portenta
if board.id in ("uno_r4_minima", "uno_r4_wifi"):
src_filter.extend(["+<" + sublib + ">" for sublib in sublibs_uno_r4_x])
env.Append(CPPPATH=[
join(FRAMEWORK_DIR, "fsp", "src", "bsp", "mcu", "ra4m1"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce", "crypto_procedures", "src", "sce5", "plainkey", "public", "inc"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce", "crypto_procedures", "src", "sce5", "plainkey", "private", "inc")
])
env.Append(CPPDEFINES=[
("_RA_CORE", "CM4")
])
elif board.id == "portenta_c33":
src_filter.extend(["+<" + sublib + ">" for sublib in sublibs_portenta_c33])
env.Append(CPPPATH=[
join(FRAMEWORK_DIR, "fsp", "src", "bsp", "mcu", "ra6m5"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce", "crypto_procedures", "src", "sce9", "plainkey", "public", "inc"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce", "crypto_procedures", "src", "sce9", "plainkey", "private", "inc"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce_protected", "crypto_procedures_protected", "src", "sce9", "inc", "api"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce_protected", "crypto_procedures_protected", "src", "sce9", "inc", "instances"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce_protected", "crypto_procedures_protected", "src", "sce9", "private", "inc"),
join(FRAMEWORK_DIR, "fsp", "src", "r_sce_protected", "crypto_procedures_protected", "src", "sce9", "public", "inc"),
join(FRAMEWORK_DIR, "variants", variant, "includes", "ra_cfg", "driver")
])
env.Append(CPPDEFINES=[
("_RA_CORE", "CM33")
])

# Build the FSP framework
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "FSPFramework"),
join(FRAMEWORK_DIR, "fsp", "src"),
src_filter
)
)
# Build the glue files
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "FSPFrameworkVariant"),
join(FRAMEWORK_DIR, "variants", variant, "tmp_gen_c_files")))

env.Prepend(LIBS=libs)
1 change: 1 addition & 0 deletions examples/arduino-uno-r4-led-animation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pio
21 changes: 21 additions & 0 deletions examples/arduino-uno-r4-led-animation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
How to build PlatformIO based project
=====================================

1. [Install PlatformIO Core](https://docs.platformio.org/page/core.html)
2. Download [development platform with examples](https://github.com/platformio/platform-renesas-ra/archive/develop.zip)
3. Extract ZIP archive
4. Run these commands:

```shell
# Change directory to example
$ cd platform-renesas-ra/examples/arduino-uno-r4-led-animation

# Build project
$ pio run

# Upload firmware
$ pio run --target upload

# Clean build files
$ pio run --target clean
```
39 changes: 39 additions & 0 deletions examples/arduino-uno-r4-led-animation/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/arduino-uno-r4-led-animation/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
16 changes: 16 additions & 0 deletions examples/arduino-uno-r4-led-animation/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; 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
; https://docs.platformio.org/page/projectconf.html

[env]
platform = renesas-ra
framework = arduino

[env:uno_r4_wifi]
board = uno_r4_wifi

Loading

0 comments on commit d32e136

Please sign in to comment.