Skip to content

Commit

Permalink
Add initial support for Shakti platform
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jul 9, 2019
1 parent ba68c84 commit 6443896
Show file tree
Hide file tree
Showing 89 changed files with 3,610 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.pyc
25 changes: 25 additions & 0 deletions .travis.yml
@@ -0,0 +1,25 @@
language: python
python:
- "2.7"
- "3.6"

env:
- PLATFORMIO_PROJECT_DIR=examples/shakti-sdk_gpio-keypad
- PLATFORMIO_PROJECT_DIR=examples/shakti-sdk_i2c-lm75
- PLATFORMIO_PROJECT_DIR=examples/shakti-sdk_uart-hello

install:
- pip install -U https://github.com/platformio/platformio/archive/develop.zip
- platformio platform install file://.

script:
- platformio run -d $PLATFORMIO_PROJECT_DIR

notifications:
email: false

slack:
rooms:
secure: UgmaiBeFcBbN/gr5YI+ZKEd2s7hiudTa7EBTDtHx1nL8BcgJv32cUGbgXHJoCNILqBCkGhdm+KZLOgUHpEnqjfmmKHz28MUvghlBfVc4QiBdVChlKQa4CSfa2OgQrL5fO5X/ETGSmU+kvH7gPvvwdvK3cmI+KzZIoPCymWxPxdLjkQ29smJdGi7+PGL8z3ucsTmec2eTDLogymjQdWeqXgvqzV3mg9MmQ5KBGwEMTrArJl56kJnGON3SyhXdDOW52aicDX+79AwWtII87Jue17O3b80qNQeupvhsmqz1/rgME60UrpQslfrL/Zhq77s8WKj/5ticfTBWVBZmJoP3AGPQVFXiVAo8YD2A9/kHVyRVb2yCVVnouc08Cj8auZR8JMyJzD9B/CE27jLu5g4GdFtv0a3O7qLZ1sEzuTuWI1R0KdUt7ZtCM7B5i7+T2F36mdHattzSM4GrJfucltE63GkYyzyqsRV7fjiPyf4Vqv89PJGnu8kIAOH3HC0PXT722b3xR3qodnQaF1EAn2v4H4fWeNcpyXtgHI42HaFqfauMFc+JZRZ1PM8c/yFIbvJg3ndQcXCAzKRPFnQeHjjWjNYzHK/6CQes3ovQmgmdkbd4TnhJ5IvvG0tVAIcdeucp4RamOe0m8h8JDfBqoqykPrfiTGoedkTv6LULXwhRWHA=
on_failure: always
on_success: change
35 changes: 35 additions & 0 deletions README.md
@@ -0,0 +1,35 @@
# Shakti: development platform for [PlatformIO](http://platformio.org)
[![Build Status](https://travis-ci.org/platformio/platform-shakti.svg?branch=develop)](https://travis-ci.org/platformio/platform-shakti)
[![Build status](https://ci.appveyor.com/api/projects/status/pm59mq539ttp51hd/branch/develop?svg=true)](https://ci.appveyor.com/project/ivankravets/platform-shakti/branch/develop)

Shakti is an open-source initiative by the RISE group at IIT-Madras, which is not only building open source, production grade processors, but also associated components like interconnect fabrics, verification tools, storage controllers, peripheral IPs and SOC tools.

* [Home](http://platformio.org/platforms/shakti) (home page in PlatformIO Platform Registry)
* [Documentation](http://docs.platformio.org/page/platforms/shakti.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 = shakti
board = ...
...
```

## Development version

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

# Configuration

Please navigate to [documentation](http://docs.platformio.org/page/platforms/shakti.html).
24 changes: 24 additions & 0 deletions appveyor.yml
@@ -0,0 +1,24 @@
build: off
environment:

matrix:
- PLATFORMIO_PROJECT_DIR: "examples/shakti-sdk_gpio-keypad"
- PLATFORMIO_PROJECT_DIR: "examples/shakti-sdk_i2c-lm75"
- PLATFORMIO_PROJECT_DIR: "examples/shakti-sdk_uart-hello"

install:
- cmd: git submodule update --init --recursive
- cmd: SET PATH=%PATH%;C:\Python27\Scripts
- cmd: pip install -U https://github.com/platformio/platformio/archive/develop.zip
- cmd: platformio platform install file://.

test_script:
- cmd: platformio run -d %PLATFORMIO_PROJECT_DIR%

notifications:
- provider: Slack
incoming_webhook:
secure: E9H0SU0Ju7WLDvgxsV8cs3J62T3nTTX7QkEjsczN0Sto/c9hWkVfhc5gGWUkxhlD975cokHByKGJIdwYwCewqOI+7BrcT8U+nlga4Uau7J8=
on_build_success: false
on_build_failure: true
on_build_status_changed: true
47 changes: 47 additions & 0 deletions boards/artix7_100t.json
@@ -0,0 +1,47 @@
{
"build": {
"extra_flags": "-D ARTIX7_100T",
"f_cpu": "1500000000L",
"hwids": [
[
"0x0403",
"0x6010"
]
],
"ldscript": "link.ld",
"mabi": "lp64",
"march": "rv64imac",
"mcmodel": "medany",
"mcu": "e51"
},
"debug": {
"init_cmds": [
"define pio_reset_halt_target",
" monitor halt",
"end",
"define pio_reset_target",
" pio_reset_halt_target",
"end",
"target extended-remote $DEBUG_PORT",
"$INIT_BREAK",
"$LOAD_CMDS",
"monitor init",
"pio_reset_halt_target"
]
},
"frameworks": [
"shakti-sdk"
],
"name": "Arty A7-100: Artix-7 FPGA Development Board",
"upload": {
"maximum_ram_size": 268435456,
"maximum_size": 16777216,
"protocol": "jlink",
"protocols": [
"ftdi",
"jlink"
]
},
"url": "https://www.xilinx.com/products/boards-and-kits/1-w51quh.html",
"vendor": "Xilinx"
}
52 changes: 52 additions & 0 deletions boards/artix7_35t.json
@@ -0,0 +1,52 @@
{
"build": {
"extra_flags": "-D ARTIX7_35T",
"f_cpu": "320000000L",
"hwids": [
[
"0x0403",
"0x6010"
]
],
"ldscript": "link.ld",
"mabi": "ilp32",
"march": "rv32imac",
"mcmodel": "medany",
"mcu": "e31"
},
"debug": {
"jlink_device": "FE310",
"init_cmds": [
"define pio_reset_halt_target",
" monitor halt",
"end",
"define pio_reset_target",
" pio_reset_halt_target",
"end",
"target extended-remote $DEBUG_PORT",
"$INIT_BREAK",
"$LOAD_CMDS",
"monitor init",
"pio_reset_halt_target"
],
"svd_path": "FE310.svd",
"onboard_tools": [
"ftdi"
]
},
"frameworks": [
"shakti-sdk"
],
"name": "Artix-7 35T Arty FPGA Evaluation Kit",
"upload": {
"maximum_ram_size": 268435456,
"maximum_size": 16777216,
"protocol": "ftdi",
"protocols": [
"ftdi",
"jlink"
]
},
"url": "https://www.xilinx.com/products/boards-and-kits/arty.html",
"vendor": "Xilinx"
}
44 changes: 44 additions & 0 deletions builder/frameworks/_bare.py
@@ -0,0 +1,44 @@
# 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.

#
# Default flags for bare-metal programming (without any framework layers)
#

from SCons.Script import Import

Import("env")

board_config = env.BoardConfig()

env.Append(
CCFLAGS=[
"-Wall", # show warnings
"-march=%s" % board_config.get("build.march"),
"-mabi=%s" % board_config.get("build.mabi"),
"-mcmodel=%s" % board_config.get("build.mcmodel")
],

LINKFLAGS=[
"-nostartfiles",
"-march=%s" % board_config.get("build.march"),
"-mabi=%s" % board_config.get("build.mabi"),
"-mcmodel=%s" % board_config.get("build.mcmodel")
],

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

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
108 changes: 108 additions & 0 deletions builder/frameworks/shakti-sdk.py
@@ -0,0 +1,108 @@
# Copyright 2019-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.

"""
Shakti SDK
Open Source Software for Developing on the Shakti Platform
https://gitlab.com/shaktiproject/software/shakti-sdk
"""

from shutil import copyfile
from os import makedirs, listdir
from os.path import isdir, join

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()

FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-shakti-sdk")
assert FRAMEWORK_DIR and isdir(FRAMEWORK_DIR)


def is_valid_target(target):
target_dir = join(FRAMEWORK_DIR, "bsp", "third_party", target)
return isdir(target_dir)


env.SConscript("_bare.py", exports="env")

target = env.subst("$BOARD")

env.Append(
ASFLAGS=[
("-D__ASSEMBLY__=1")
],

CFLAGS=[
"-std=gnu99"
],

CCFLAGS=[
"-fno-common",
"-fno-builtin-printf"
],

CPPPATH=[
join(FRAMEWORK_DIR, "bsp", "include"),
join(FRAMEWORK_DIR, "bsp", "third_party", target)
],

LIBPATH=[
join(FRAMEWORK_DIR, "bsp", "third_party", target)
]
)

if not is_valid_target(target):
print ("Could not find BSP package for %s" % target)
env.Exit(1)

#
# Target: Build core BSP libraries
#

unsupported_drivers = ("plic", "timer")

libs = []

for driver in listdir(join(FRAMEWORK_DIR, "bsp", "drivers")):
if driver in unsupported_drivers:
continue

libs.append(
env.BuildLibrary(
join("$BUILD_DIR", "bsp", "drivers", driver),
join(FRAMEWORK_DIR, "bsp", "drivers", driver))
)

libs.append(
env.BuildLibrary(
join("$BUILD_DIR", "bsp", "libwrap"),
join(FRAMEWORK_DIR, "bsp", "libwrap"))
)

libs.append(
env.BuildLibrary(
join("$BUILD_DIR", "bsp", "include"),
join(FRAMEWORK_DIR, "bsp", "include"))
)

libs.append(
env.BuildLibrary(
join("$BUILD_DIR", "bsp", "third_party", target),
join(FRAMEWORK_DIR, "bsp", "third_party", target))
)

env.Prepend(LIBS=libs)

0 comments on commit 6443896

Please sign in to comment.