Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#More details.

import os
import atexit
import logging
import logging.handlers
from os import path
Expand Down Expand Up @@ -214,6 +215,7 @@ def _build_sdsio_request(command: int, sid: int = 0, argument: int = 0, data: by
Stream = sdsio_manager(
work_dir=_work_dir,
auto_playback=_auto_playback,
exit_after_playback=True,
play_list=_play_list,
mon_port=None,
write_flush_records=_write_flush_records,
Expand All @@ -222,6 +224,15 @@ def _build_sdsio_request(command: int, sid: int = 0, argument: int = 0, data: by
control_input_factory=False,
)

# Shutdown SDSIO manager on exit
def shutdown():
try:
Stream.shutdown()
except Exception:
logger.error("Failed to shutdown SDSIO manager.")

# Register the shutdown function to be called on exit
atexit.register(shutdown)

## Process command
# @param command requested SDSIO command
Expand Down
168 changes: 132 additions & 36 deletions RockPaperScissors/AppKit-E8_USB/Board/Corstone-320/vsi/python/sdsio.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion RockPaperScissors/AppKit-E8_USB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To run this example:

- Install [Keil Studio for VS Code](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack) and run a
Blinky example on the board to verify tool installation.
- Install SDS-Framework pack v3.0.0 or later from:
- Install SDS-Framework pack v3.1.0 or later from:
- `https://github.com/ARM-software/SDS-Framework/releases`
- Setup the [Python environment](https://arm-software.github.io/SDS-Framework/main/utilities.html#setup) for running
the SDS Utilities.
Expand Down
4 changes: 2 additions & 2 deletions RockPaperScissors/AppKit-E8_USB/SDS.cbuild-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ cbuild-pack:
- resolved-pack: ARM::CMSIS-RTX@5.9.1
selected-by-pack:
- ARM::CMSIS-RTX@^5.9.1
- resolved-pack: ARM::SDS@3.0.0
- resolved-pack: ARM::SDS@3.1.0
selected-by-pack:
- ARM::SDS@^3.0.0-0
- ARM::SDS@^3.1.0-0
- resolved-pack: ARM::SSE_320_BSP@1.1.0
selected-by-pack:
- ARM::SSE_320_BSP@1.1.0
Expand Down
2 changes: 1 addition & 1 deletion RockPaperScissors/AppKit-E8_USB/SDS.csolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ solution:
# Refer to https://open-cmsis-pack.github.io/cmsis-toolbox/ReferenceApplications/ for more information

packs:
- pack: ARM::SDS@^3.0.0-0
- pack: ARM::SDS@^3.1.0-0
- pack: AlifSemiconductor::Ensemble@^2.2.0-0
- pack: ARM::SSE_320_BSP@1.1.0

Expand Down
4 changes: 2 additions & 2 deletions RockPaperScissors/AppKit-E8_USB/SDS.sdsio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ sdsio:
# Data stream information used by VS Code extension
streams:
- name: Camera
view: video
view: image
- name: ML_In
view: video
view: image
- name: ML_Out
view: signal

Expand Down
6 changes: 2 additions & 4 deletions RockPaperScissors/AppKit-E8_USB/SDS_Recordings/Camera.sds.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
sds:
name: Video Stream - RGB565
description: RGB565 video frames from camera
frequency: 8.33
sample-frequency: 8.33
content:
- value: Frame
type: uint16_t
image:
- image:
pixel_format: RGB565
width: 640
height: 480
Expand Down
6 changes: 2 additions & 4 deletions RockPaperScissors/AppKit-E8_USB/SDS_Recordings/ML_In.sds.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
sds:
name: ML input
description: RGB888 video frames from camera
frequency: 8.33
sample-frequency: 8.33
content:
- value: Frame
type: uint8_t
image:
- image:
pixel_format: RGB888
width: 224
height: 224
Expand Down
18 changes: 9 additions & 9 deletions RockPaperScissors/AppKit-E8_USB/SDS_Recordings/ML_Out.sds.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
sds:
name: ML output
description: ML classification results
frequency: 8.33
sample-frequency: 8.33
content:
- value: PAPER
type: float
- value: ROCK
type: float
- value: SCISSORS
type: float
- value: UNKNOWN
type: float
- value: PAPER
type: float
- value: ROCK
type: float
- value: SCISSORS
type: float
- value: UNKNOWN
type: float
2 changes: 1 addition & 1 deletion RockPaperScissors/AppKit-E8_USB/algorithm/data_in_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ int32_t GetInputData (uint8_t *buf, uint32_t max_len) {
do {
ret = sdsWrite(sds_camera_id, timeslot, CAM_Frame, sizeof(CAM_Frame));
if (ret == SDS_NO_SPACE) {
osDelay(10U);
osDelay(1U);
}
} while (ret == SDS_NO_SPACE);
SDS_ASSERT(ret == sizeof(CAM_Frame));
Expand Down
3 changes: 2 additions & 1 deletion RockPaperScissors/AppKit-E8_USB/algorithm/sds_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ osThreadAttr_t attrAlgorithmThread = {

// sdsControlThread thread attributes
osThreadAttr_t attr_sdsControlThread = {
.name = "sdsControl"
.name = "sdsControl",
.priority = osPriorityNormal1
};

// Idle time counter
Expand Down
6 changes: 3 additions & 3 deletions RockPaperScissors/AppKit-E8_USB/algorithm/sds_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ __NO_RETURN void AlgorithmThread (void *argument) {
do {
ret = sdsRead(sds_data_in_id, &timeslot, algo_data_in_buf, sizeof(algo_data_in_buf));
if (ret == SDS_NO_DATA) {
osDelay(10U);
osDelay(1U);
DiscardInputData();
}
} while (ret == SDS_NO_DATA);
Expand Down Expand Up @@ -225,7 +225,7 @@ __NO_RETURN void AlgorithmThread (void *argument) {
do {
ret = sdsWrite(sds_data_in_id, timeslot, algo_data_in_buf, sizeof(algo_data_in_buf));
if (ret == SDS_NO_SPACE) {
osDelay(10U);
osDelay(1U);
}
} while (ret == SDS_NO_SPACE);
SDS_ASSERT(ret == sizeof(algo_data_in_buf));
Expand All @@ -243,7 +243,7 @@ __NO_RETURN void AlgorithmThread (void *argument) {
do {
ret = sdsWrite(sds_data_out_id, timeslot, algo_data_out_buf, sizeof(algo_data_out_buf));
if (ret == SDS_NO_SPACE) {
osDelay(10U);
osDelay(1U);
}
} while (ret == SDS_NO_SPACE);
SDS_ASSERT(ret == sizeof(algo_data_out_buf));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* Name: sds_config.h
* Purpose: SDS configuration options
* Rev.: V3.0.0
* Rev.: V3.1.0
*/

//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
Expand All @@ -40,7 +40,7 @@
#define SDS_THREAD_STACK_SIZE 1024

// SDS system thread priority
#define SDS_THREAD_PRIORITY osPriorityNormal
#define SDS_THREAD_PRIORITY osPriorityNormal1

// SDS stream open timeout in kernel ticks
#define SDS_OPEN_TIMEOUT 3000U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* Name: sds_config.h
* Purpose: SDS configuration options
* Rev.: V3.0.0
* Rev.: V3.1.0
*/

//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
Expand All @@ -40,7 +40,7 @@
#define SDS_THREAD_STACK_SIZE 1024

// SDS system thread priority
#define SDS_THREAD_PRIORITY osPriorityNormal
#define SDS_THREAD_PRIORITY osPriorityNormal1

// SDS stream open timeout in kernel ticks
#define SDS_OPEN_TIMEOUT 3000U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layer:
description: Layer with SDS and SDSIO using VSI

packs:
- pack: ARM::SDS@^3.0.0-0
- pack: ARM::SDS@^3.1.0-0

connections:
- connect: SDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* Name: sds_config.h
* Purpose: SDS configuration options
* Rev.: V3.0.0
* Rev.: V3.1.0
*/

//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
Expand All @@ -40,7 +40,7 @@
#define SDS_THREAD_STACK_SIZE 1024

// SDS system thread priority
#define SDS_THREAD_PRIORITY osPriorityNormal
#define SDS_THREAD_PRIORITY osPriorityNormal1

// SDS stream open timeout in kernel ticks
#define SDS_OPEN_TIMEOUT 3000U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* Name: sds_config.h
* Purpose: SDS configuration options
* Rev.: V3.0.0
* Rev.: V3.1.0
*/

//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
Expand All @@ -40,7 +40,7 @@
#define SDS_THREAD_STACK_SIZE 1024

// SDS system thread priority
#define SDS_THREAD_PRIORITY osPriorityNormal
#define SDS_THREAD_PRIORITY osPriorityNormal1

// SDS stream open timeout in kernel ticks
#define SDS_OPEN_TIMEOUT 3000U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layer:
description: Layer with SDS and SDSIO using USB interface to the SDSIO-Server

packs:
- pack: ARM::SDS@^3.0.0-0
- pack: ARM::SDS@^3.1.0-0
- pack: Keil::MDK-Middleware@^8.0.0

connections:
Expand Down