Skip to content

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jun 17, 2020
2 parents 4fc1ad3 + a22dc58 commit ed9eb44
Show file tree
Hide file tree
Showing 32 changed files with 2,308 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Examples

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, windows-latest, macos-latest]
python-version: [2.7, 3.7]
example: ["examples/native-blink_asm", "examples/rtosal-freertos"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U https://github.com/platformio/platformio/archive/develop.zip
platformio platform install file://.
- name: Build examples
run: |
platformio run -d ${{ matrix.example }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# platform-chipsalliance
CHIPS Alliance: development platform for PlatformIO
# CHIPS Alliance: development platform for [PlatformIO](http://platformio.org)

![alt text](https://github.com/platformio/platform-chipsalliance/workflows/Examples/badge.svg "CHIPS Alliance development platform")

CHIPS Alliance brings the power of open source and software automation to the semiconductor industry, making it possible to develop new hardware faster and more affordably than ever before.

* [Home](http://platformio.org/platforms/chipsalliance) (home page in PlatformIO Platform Registry)
* [Documentation](http://docs.platformio.org/page/platforms/chipsalliance.html) (advanced usage, packages, boards, frameworks, etc.)

# Usage

1. [Install PlatformIO](http://platformio.org)
2. Create PlatformIO project and configure a platform option in [platformio.ini](http://docs.platformio.org/page/projectconf.html) file:

## Stable version

```ini
[env:stable]
platform = chipsalliance
board = ...
...
```

## Development version

```ini
[env:development]
platform = https://github.com/platformio/platform-chipsalliance.git
board = ...
...
```

# Configuration

Please navigate to [documentation](http://docs.platformio.org/page/platforms/chipsalliance.html).
34 changes: 34 additions & 0 deletions boards/swervolf_nexys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"build": {
"f_cpu": "320000000L",
"extra_flags": "-DD_NEXYS_A7",
"hwids": [
[
"0x0403",
"0x6010"
]
],
"mabi": "ilp32",
"march": "rv32i",
"mcmodel": "medlow",
"variant": "nexys_a7_swerv_eh1"
},
"debug": {
"onboard_tools": [
"digilent-hs1"
],
"openocd_config": "swervolf_nexys_debug.cfg"
},
"frameworks": ["wd-riscv-sdk"],
"name": "digilentincNexys A7",
"upload": {
"maximum_ram_size": 1216512,
"maximum_size": 16777216,
"protocols": [
"digilent-hs1"
],
"protocol": "digilent-hs1"
},
"url": "https://reference.digilentinc.com/reference/programmable-logic/nexys-a7/start",
"vendor": "Digilent"
}
38 changes: 38 additions & 0 deletions builder/compat.py
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.

from SCons.Script import AlwaysBuild, Import


Import("env")


# Added in PIO Core 4.4.0
if not hasattr(env, "AddPlatformTarget"):

def AddPlatformTarget(
env,
name,
dependencies,
actions,
title=None,
description=None,
always_build=True,
):
target = env.Alias(name, dependencies, actions)
if always_build:
AlwaysBuild(target)
return target

env.AddMethod(AddPlatformTarget)
65 changes: 65 additions & 0 deletions builder/frameworks/_bare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()

env.Append(
ASFLAGS=[
"-x", "assembler-with-cpp",
"-Wa,-march=%s" % board.get("build.march")
],

CCFLAGS=[
"-Os",
"-Wall",
"-ffunction-sections",
"-fdata-sections",
"-march=%s" % board.get("build.march"),
"-mabi=%s" % board.get("build.mabi"),
"-mcmodel=%s" % board.get("build.mcmodel")
],

LINKFLAGS=[
"-Os",
"-march=%s" % board.get("build.march"),
"-mabi=%s" % board.get("build.mabi"),
"-mcmodel=%s" % board.get("build.mcmodel"),
"-Wl,-gc-sections",
"-nostdlib",
"-nostartfiles",
"-static",
"-Wl,--wrap=malloc",
"-Wl,--wrap=free",
"-Wl,--wrap=open",
"-Wl,--wrap=lseek",
"-Wl,--wrap=read",
"-Wl,--wrap=write",
"-Wl,--wrap=fstat",
"-Wl,--wrap=stat",
"-Wl,--wrap=close",
"-Wl,--wrap=link",
"-Wl,--wrap=unlink",
"-Wl,--wrap=execve",
"-Wl,--wrap=fork",
"-Wl,--wrap=getpid",
"-Wl,--wrap=kill",
"-Wl,--wrap=wait",
"-Wl,--wrap=isatty",
"-Wl,--wrap=times",
"-Wl,--wrap=sbrk",
"-Wl,--wrap=_exit"
"-Wl,-Map="
+ os.path.join("$BUILD_DIR", os.path.basename(env.subst("${PROJECT_DIR}.map"))),
"-Wl,--defsym=__comrv_cache_size=0",
]
)

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

#
# Target: Build libraries
#
102 changes: 102 additions & 0 deletions builder/frameworks/wd-riscv-sdk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import os

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()
platform = env.PioPlatform()

FIRMWARE_DIR = platform.get_package_dir("framework-wd-riscv-sdk")
assert os.path.isdir(FIRMWARE_DIR)

board = env.BoardConfig()
variant_dir = os.path.join(FIRMWARE_DIR, "board", board.get("build.variant", ""))

env.SConscript("_bare.py")

env.Append(
CCFLAGS=[
"-fno-builtin-printf",
],

CPPDEFINES=[
"D_USE_RTOSAL",
"D_USE_FREERTOS",
("D_TICK_TIME_MS", 4),
("D_ISR_STACK_SIZE", 400),
("D_MTIME_ADDRESS", "0x80001020"),
("D_MTIMECMP_ADDRESS", "0x80001028"),
("D_CLOCK_RATE", 50000000),
("D_PIC_BASE_ADDRESS", "0xA0000000"),
("D_PIC_NUM_OF_EXT_INTERRUPTS", 256),
("D_EXT_INTERRUPT_FIRST_SOURCE_USED", 0),
("D_EXT_INTERRUPT_LAST_SOURCE_USED", 255),
],

CPPPATH=[
"$PROJECT_SRC_DIR",
os.path.join(FIRMWARE_DIR, "rtos", "rtosal", "loc_inc"),
os.path.join(FIRMWARE_DIR, "common", "api_inc"),
os.path.join(FIRMWARE_DIR, "rtos", "rtos_core", "freertos", "Source", "include"),
os.path.join(FIRMWARE_DIR, "rtos", "rtosal", "api_inc"),
os.path.join(FIRMWARE_DIR, "rtos", "rtosal", "config", "swerv_eh1"),
os.path.join(FIRMWARE_DIR, "psp", "api_inc"),
os.path.join(FIRMWARE_DIR, "rtos", "rtos_core", "freertos", "Source", "include"),
],

LIBPATH=[variant_dir],

LIBS=["c", "gcc"]
)

# Only for C/C++ sources
env.Append(CCFLAGS=["-include", "sys/cdefs.h"])

if not board.get("build.ldscript", ""):
env.Replace(LDSCRIPT_PATH="link.lds")

#
# Target: Build libraries
#

libs = []

if "build.variant" in board:
env.Append(CPPPATH=[variant_dir, os.path.join(variant_dir, "bsp")])
libs.append(env.BuildLibrary(os.path.join("$BUILD_DIR", "BoardBSP"), variant_dir))

libs.extend([
env.BuildLibrary(
os.path.join("$BUILD_DIR", "FreeRTOS"),
os.path.join(FIRMWARE_DIR, "rtos", "rtos_core", "freertos", "Source"),
src_filter=[
"-<*>",
"+<croutine.c>",
"+<list.c>",
"+<portable/portASM.S>",
"+<queue.c>",
"+<tasks.c>",
"+<timers.c>",
],
),

env.BuildLibrary(
os.path.join("$BUILD_DIR", "RTOS-AL"),
os.path.join(FIRMWARE_DIR, "rtos", "rtosal"),
src_filter="+<*> -<rtosal_memory.c> -<list.c>",
),

env.BuildLibrary(
os.path.join("$BUILD_DIR", "PSP"),
os.path.join(FIRMWARE_DIR, "psp"),
src_filter=[
"-<*>",
"+<psp_ext_interrupts_swerv_eh1.c>",
"+<psp_traps_interrupts.c>",
"+<psp_timers.c>",
"+<psp_performance_monitor_eh1.c>",
"+<psp_int_vect_swerv_eh1.S>"
],
)
])

env.Prepend(LIBS=libs)
Loading

0 comments on commit ed9eb44

Please sign in to comment.