Skip to content

Commit

Permalink
Merge branch 'release/v4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Feb 26, 2021
2 parents 548a005 + 0cf941a commit 06af7c2
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-16.04, windows-latest, macos-latest]
python-version: [2.7, 3.7]
python-version: [3.7]
example:
- "examples/freedom-e-sdk_freertos-blinky"
- "examples/freedom-e-sdk_freertos-blinky-system-view"
Expand Down
6 changes: 5 additions & 1 deletion builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _jlink_cmd_script(env, source):
UPLOADER="JLink.exe" if system() == "Windows" else "JLinkExe",
UPLOADERFLAGS=[
"-device", env.BoardConfig().get("debug", {}).get("jlink_device"),
"-speed", "1000",
"-speed", env.GetProjectOption("debug_speed", "4000"),
"-if", "JTAG",
"-jtagconf", "-1,-1",
"-autoconnect", "1",
Expand Down Expand Up @@ -158,6 +158,10 @@ def _jlink_cmd_script(env, source):
]
tool_args.extend(
debug_tools.get(upload_protocol).get("server").get("arguments", []))
if env.GetProjectOption("debug_speed"):
tool_args.extend(
["-c", "adapter_khz %s" % env.GetProjectOption("debug_speed")]
)
tool_args.extend([
"-c", "program {$SOURCE} %s verify; shutdown;" %
board_config.get("upload").get("flash_start", "")
Expand Down
10 changes: 2 additions & 8 deletions examples/zephyr-blink/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <devicetree.h>
#include <drivers/gpio.h>


/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 1000

Expand All @@ -19,25 +18,20 @@
#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN DT_GPIO_PIN(LED0_NODE, gpios)
#if DT_PHA_HAS_CELL(LED0_NODE, gpios, flags)
#define FLAGS DT_GPIO_FLAGS(LED0_NODE, gpios)
#endif
#else
/* A build error here means your board isn't set up to blink an LED. */
#error "Unsupported board: led0 devicetree alias is not defined"
#define LED0 ""
#define PIN 0
#endif

#ifndef FLAGS
#define FLAGS 0
#endif

void main(void)
{
struct device *dev;
const struct device *dev;
bool led_is_on = true;
int ret = 0;
int ret;

dev = device_get_binding(LED0);
if (dev == NULL) {
Expand Down
28 changes: 21 additions & 7 deletions examples/zephyr-synchronization/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,31 @@ void helloLoop(const char *my_name,
struct k_sem *my_sem, struct k_sem *other_sem)
{
const char *tname;
uint8_t cpu;
struct k_thread *current_thread;

while (1) {
/* take my semaphore */
k_sem_take(my_sem, K_FOREVER);

current_thread = k_current_get();
tname = k_thread_name_get(current_thread);
#if CONFIG_SMP
cpu = arch_curr_cpu()->id;
#else
cpu = 0;
#endif
/* say "hello" */
tname = k_thread_name_get(k_current_get());
if (tname != NULL && tname[0] != '\0') {
printk("%s: Hello World from %s!\n",
tname, CONFIG_BOARD);
if (tname == NULL) {
printk("%s: Hello World from cpu %d on %s!\n",
my_name, cpu, CONFIG_BOARD);
} else {
printk("%s: Hello World from %s!\n",
my_name, CONFIG_BOARD);
printk("%s: Hello World from cpu %d on %s!\n",
tname, cpu, CONFIG_BOARD);
}

/* wait a while, then let other thread have a turn */
k_busy_wait(100000);
k_msleep(SLEEPTIME);
k_sem_give(other_sem);
}
Expand Down Expand Up @@ -89,9 +98,14 @@ void threadA(void *dummy1, void *dummy2, void *dummy3)
/* spawn threadB */
k_tid_t tid = k_thread_create(&threadB_data, threadB_stack_area,
STACKSIZE, threadB, NULL, NULL, NULL,
PRIORITY, 0, K_NO_WAIT);
PRIORITY, 0, K_FOREVER);

k_thread_name_set(tid, "thread_b");
#if CONFIG_SCHED_CPU_MASK
k_thread_cpu_mask_disable(&threadB_data, 1);
k_thread_cpu_mask_enable(&threadB_data, 0);
#endif
k_thread_start(&threadB_data);

/* invoke routine to ping-pong hello messages with threadB */
helloLoop(__func__, &threadA_sem, &threadB_sem);
Expand Down
2 changes: 1 addition & 1 deletion examples/zephyr-synchronization/zephyr/prj.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CONFIG_STDOUT_CONSOLE=y
# enable to use thread names
#CONFIG_THREAD_NAME=y
CONFIG_THREAD_NAME=y
46 changes: 28 additions & 18 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"homepage": "https://sifive.com",
"license": "Apache-2.0",
"keywords": [
"dev-platform",
"SiFive",
"RISC-V"
"dev-platform",
"SiFive",
"RISC-V"
],
"engines": {
"platformio": "^5"
Expand All @@ -16,7 +16,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-sifive.git"
},
"version": "3.0.1",
"version": "4.0.0",
"frameworks": {
"freedom-e-sdk": {
"package": "framework-freedom-e-sdk",
Expand Down Expand Up @@ -52,7 +52,7 @@
"type": "framework",
"optional": true,
"owner": "platformio",
"version": "~2.20400.0"
"version": "~2.20500.0"
},
"framework-zephyr-canopennode": {
"optional": true,
Expand All @@ -62,47 +62,47 @@
"framework-zephyr-civetweb": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.99129c5efc"
"version": "0.0.0-alpha+sha.e6903b80c0"
},
"framework-zephyr-fatfs": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.13697783bf"
"version": "0.0.0-alpha+sha.1d1fcc725a"
},
"framework-zephyr-hal-st": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.5b3ec3e182"
"version": "0.0.0-alpha+sha.b52fdbf4b6"
},
"framework-zephyr-libmetal": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.0b23894a04"
"version": "0.0.0-alpha+sha.9d4ee2c3cf"
},
"framework-zephyr-lvgl": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.928b61c7c8"
"version": "0.0.0-alpha+sha.31acbaa36e"
},
"framework-zephyr-mbedtls": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.aef137b1af"
"version": "0.0.0-alpha+sha.24d84ecff1"
},
"framework-zephyr-mcuboot": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.a5d79cf8cc"
"version": "0.0.0-alpha+sha.3fc59410b6"
},
"framework-zephyr-mcumgr": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.5051f9d900"
"version": "0.0.0-alpha+sha.43845e883f"
},
"framework-zephyr-open-amp": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.724f7e2a45"
"version": "0.0.0-alpha+sha.de1b85a130"
},
"framework-zephyr-loramac-node": {
"optional": true,
Expand All @@ -112,12 +112,17 @@
"framework-zephyr-openthread": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.07f430dac6"
"version": "0.0.0-alpha+sha.1d668284a0"
},
"framework-zephyr-segger": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.874d9e9696"
"version": "0.0.0-alpha+sha.38c79a447e"
},
"framework-zephyr-sof": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.b5b772dd61"
},
"framework-zephyr-tinycbor": {
"optional": true,
Expand All @@ -137,12 +142,17 @@
"framework-zephyr-mipi-sys-t": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.957d46bc3c"
"version": "0.0.0-alpha+sha.75e671550a"
},
"framework-zephyr-tfm-mcuboot": {
"optional": true,
"owner": "platformio",
"version": "1.7.0-rc1"
},
"framework-zephyr-trusted-firmware-m": {
"optional": true,
"owner": "platformio",
"version": "0.0.0-alpha+sha.143df67555"
"version": "0.0.0-alpha+sha.96340fb6c0"
},
"tool-openocd-riscv": {
"optional": true,
Expand Down
54 changes: 35 additions & 19 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from os.path import isfile, join
from platform import system
import copy
import os
import platform

from platformio.managers.platform import PlatformBase
from platformio.util import get_systype
Expand All @@ -28,15 +29,15 @@ def configure_default_packages(self, variables, targets):
"tool-cmake", "tool-dtc", "tool-ninja"):
self.packages[p]["optional"] = False
if "windows" not in get_systype():
self.packages['tool-gperf']['optional'] = False
self.packages["tool-gperf"]["optional"] = False

upload_protocol = variables.get(
"upload_protocol",
self.board_config(variables.get("board")).get(
"upload.protocol", ""))

if upload_protocol == "renode" and "debug" not in targets:
self.packages['tool-renode']['type'] = "uploader"
self.packages["tool-renode"]["type"] = "uploader"

return PlatformBase.configure_default_packages(self, variables, targets)

Expand All @@ -56,7 +57,7 @@ def _add_default_debug_tools(self, board):
upload_protocols = board.manifest.get("upload",
{}).get("protocols", [])
if "tools" not in debug:
debug['tools'] = {}
debug["tools"] = {}

tools = ("jlink", "qemu", "renode", "ftdi", "minimodule",
"olimex-arm-usb-tiny-h", "olimex-arm-usb-ocd-h",
Expand All @@ -65,33 +66,32 @@ def _add_default_debug_tools(self, board):
if tool in ("qemu", "renode"):
if not debug.get("%s_machine" % tool):
continue
elif (tool not in upload_protocols or tool in debug['tools']):
elif (tool not in upload_protocols or tool in debug["tools"]):
continue
if tool == "jlink":
assert debug.get("jlink_device"), (
"Missed J-Link Device ID for %s" % board.id)
debug['tools'][tool] = {
debug["tools"][tool] = {
"server": {
"package": "tool-jlink",
"arguments": [
"-singlerun",
"-if", "JTAG",
"-select", "USB",
"-speed", "1000",
"-jtagconf", "-1,-1",
"-device", debug.get("jlink_device"),
"-port", "2331"
],
"executable": ("JLinkGDBServerCL.exe"
if system() == "Windows" else
if platform.system() == "Windows" else
"JLinkGDBServer")
},
"onboard": tool in debug.get("onboard_tools", [])
}

elif tool == "qemu":
machine64bit = "64" in board.get("build.mabi")
debug['tools'][tool] = {
debug["tools"][tool] = {
"server": {
"package": "tool-qemu-riscv",
"arguments": [
Expand All @@ -109,17 +109,17 @@ def _add_default_debug_tools(self, board):
elif tool == "renode":
assert debug.get("renode_machine"), (
"Missing Renode machine ID for %s" % board.id)
debug['tools'][tool] = {
debug["tools"][tool] = {
"server": {
"package": "tool-renode",
"arguments": [
"--disable-xwt",
"-e", "include @%s" % join(
"-e", "include @%s" % os.path.join(
"scripts", "single-node", debug.get("renode_machine")),
"-e", "machine StartGdbServer 3333 True"
],
"executable": ("bin/Renode"
if system() == "Windows" else
if platform.system() == "Windows" else
"renode"),
"ready_pattern": "GDB server with all CPUs started on port"

Expand All @@ -131,20 +131,20 @@ def _add_default_debug_tools(self, board):
"-s", "$PACKAGE_DIR/share/openocd/scripts"
]
sdk_dir = self.get_package_dir("framework-freedom-e-sdk")
board_cfg = join(
board_cfg = os.path.join(
sdk_dir or "", "bsp", "sifive-%s" % board.id, "openocd.cfg")
if isfile(board_cfg):
if os.path.isfile(board_cfg):
server_args.extend(["-f", board_cfg])
elif board.id == "e310-arty":
server_args.extend([
"-f", join("interface", "ftdi", "%s.cfg" % (
"-f", os.path.join("interface", "ftdi", "%s.cfg" % (
"arty-onboard-ftdi" if tool == "ftdi" else tool)),
"-f", join(
"-f", os.path.join(
sdk_dir or "", "bsp", "freedom-e310-arty", "openocd.cfg")
])
else:
assert "Unknown debug configuration", board.id
debug['tools'][tool] = {
debug["tools"][tool] = {
"server": {
"package": "tool-openocd-riscv",
"executable": "bin/openocd",
Expand All @@ -154,5 +154,21 @@ def _add_default_debug_tools(self, board):
"init_cmds": debug.get("init_cmds", None)
}

board.manifest['debug'] = debug
board.manifest["debug"] = debug
return board

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:
if "openocd" in server_executable:
debug_options["server"]["arguments"].extend(
["-c", "adapter_khz %s" % adapter_speed]
)
elif "jlink" in server_executable:
debug_options["server"]["arguments"].extend(
["-speed", adapter_speed]
)

return debug_options

0 comments on commit 06af7c2

Please sign in to comment.