Skip to content

Commit

Permalink
boards: Add new target board for SC-SAT1 ADCS
Browse files Browse the repository at this point in the history
This commit adds new dts and related files for SC-SAT1 ADCS board.

Signed-off-by: Takuya Sasaki <takuya.sasaki@spacecubics.com>
  • Loading branch information
sasataku committed Nov 7, 2023
1 parent 7f65ef0 commit 1d71dae
Show file tree
Hide file tree
Showing 15 changed files with 454 additions and 14 deletions.
239 changes: 239 additions & 0 deletions adcs/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
#+title: SC-Sat1 ADCS board Flight Softrare

This is for SC-Sat1 ADCS board Flight Softrare

* Software
Flight Software for SC-Sat1 ADCS board is based on [[https://zephyrproject.org/][Zephyr
RTOS]]. This repository can be use as a Zephyr application
repository -- aka. T2 star topology.

** Requirements
- Zephyr 3.4

** Setting up a Build Environment
#+begin_example
mkdir workspace
cd workspace
git clone https://github.com/spacecubics/scsat1-fsw.git
pip install west
west init -l scsat1-fsw
west update
pip install -r zephyr/scripts/requirements-base.txt
#+end_example

** How to build

Here is an instraction to build the flight software. This instruction
uses "scsat1_adcs" as the target board.

#+begin_example
cd workspace/scsat1-fsw/adcs/
rm -rf build && west build -b scsat1_adcs
#+end_example

** How to program

Currently This code is enough size to running on ITCM on 128 KB ITCM. But if
your code will larger than 128 KB, you need to switch to HREM with below.
And first flash will always fail for a known limitation, need a retry.

#+begin_example
west flash --cmd-pre-load 'mww 0x4f000000 0x5a5a0000'
west flash --cmd-pre-load 'mww 0x4f000000 0x5a5a0000'
#+end_example

** How to run the ztest

This software support the CAN driver, and ztest already prepare the CAN
driver test code.
If you want to run the test code, please build the ztest program with below.

#+begin_example
cd workspace/
rm -rf build && west build -b scsat1_adcs zephyr/tests/drivers/can/api/ -- -DBOARD_ROOT=${PWD}/scsat1-fsw/
#+end_example

And then you can run the ztest for CAN driver.

#+begin_example
west flash --cmd-pre-load 'mww 0x4f000000 0x5a5a0000'
west flash --cmd-pre-load 'mww 0x4f000000 0x5a5a0000'
*** Booting Zephyr OS build zephyr-v3.4.0-1430-g0bfe3cc2d051 ***
Running TESTSUITE can_classic
===================================================================
START - test_add_filter
PASS - test_add_filter in 0.006 seconds
===================================================================
START - test_filters_added_while_stopped
PASS - test_filters_added_while_stopped in 0.002 seconds
===================================================================
START - test_filters_preserved_through_bitrate_change
PASS - test_filters_preserved_through_bitrate_change in 0.004 seconds
===================================================================
START - test_filters_preserved_through_mode_change
PASS - test_filters_preserved_through_mode_change in 0.004 seconds
===================================================================
START - test_get_capabilities
PASS - test_get_capabilities in 0.001 seconds
===================================================================
START - test_get_core_clock
PASS - test_get_core_clock in 0.001 seconds
===================================================================
START - test_get_state
PASS - test_get_state in 0.001 seconds
===================================================================
START - test_max_ext_filters
E: No free filter left
PASS - test_max_ext_filters in 0.005 seconds
===================================================================
START - test_max_std_filters
E: No free filter left
PASS - test_max_std_filters in 0.005 seconds
===================================================================
START - test_receive_timeout
PASS - test_receive_timeout in 0.102 seconds
===================================================================
START - test_recover
PASS - test_recover in 0.001 seconds
===================================================================
START - test_recover_while_stopped
PASS - test_recover_while_stopped in 0.001 seconds
===================================================================
START - test_send_and_forget
PASS - test_send_and_forget in 0.002 seconds
===================================================================
START - test_send_callback
PASS - test_send_callback in 0.002 seconds
===================================================================
START - test_send_fd_format
E: unsupported CAN frame flags 0x04
PASS - test_send_fd_format in 0.004 seconds
===================================================================
START - test_send_invalid_dlc
E: DLC of 9 exceeds maximum (8)
PASS - test_send_invalid_dlc in 0.004 seconds
===================================================================
START - test_send_receive_ext_id
PASS - test_send_receive_ext_id in 0.007 seconds
===================================================================
START - test_send_receive_ext_id_masked
PASS - test_send_receive_ext_id_masked in 0.007 seconds
===================================================================
START - test_send_receive_ext_id_rtr
PASS - test_send_receive_ext_id_rtr in 0.207 seconds
===================================================================
START - test_send_receive_msgq
PASS - test_send_receive_msgq in 0.014 seconds
===================================================================
START - test_send_receive_std_id
PASS - test_send_receive_std_id in 0.006 seconds
===================================================================
START - test_send_receive_std_id_masked
PASS - test_send_receive_std_id_masked in 0.006 seconds
===================================================================
START - test_send_receive_std_id_rtr
PASS - test_send_receive_std_id_rtr in 0.206 seconds
===================================================================
START - test_send_receive_wrong_id
PASS - test_send_receive_wrong_id in 0.103 seconds
===================================================================
START - test_send_while_stopped
PASS - test_send_while_stopped in 0.001 seconds
===================================================================
START - test_set_bitrate
PASS - test_set_bitrate in 0.001 seconds
===================================================================
START - test_set_bitrate_too_high
PASS - test_set_bitrate_too_high in 0.001 seconds
===================================================================
START - test_set_bitrate_while_started
E: Failed to set timing because enabled CAN
PASS - test_set_bitrate_while_started in 0.005 seconds
===================================================================
START - test_set_mode_while_started
PASS - test_set_mode_while_started in 0.001 seconds
===================================================================
START - test_set_state_change_callback
PASS - test_set_state_change_callback in 0.001 seconds
===================================================================
START - test_set_timing_while_started
E: Failed to set timing because enabled CAN
PASS - test_set_timing_while_started in 0.005 seconds
===================================================================
START - test_start_while_started
PASS - test_start_while_started in 0.001 seconds
===================================================================
START - test_stop_while_stopped
PASS - test_stop_while_stopped in 0.001 seconds
===================================================================
TESTSUITE can_classic succeeded
Running TESTSUITE can_utilities
===================================================================
START - test_can_bytes_to_dlc
PASS - test_can_bytes_to_dlc in 0.001 seconds
===================================================================
START - test_can_dlc_to_bytes
PASS - test_can_dlc_to_bytes in 0.001 seconds
===================================================================
START - test_can_frame_matches_filter
PASS - test_can_frame_matches_filter in 0.001 seconds
===================================================================
TESTSUITE can_utilities succeeded

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [can_classic]: pass = 33, fail = 0, skip = 0, total = 33 duration = 0.718 seconds
- PASS - [can_classic.test_add_filter] duration = 0.006 seconds
- PASS - [can_classic.test_filters_added_while_stopped] duration = 0.002 seconds
- PASS - [can_classic.test_filters_preserved_through_bitrate_change] duration = 0.004 seconds
- PASS - [can_classic.test_filters_preserved_through_mode_change] duration = 0.004 seconds
- PASS - [can_classic.test_get_capabilities] duration = 0.001 seconds
- PASS - [can_classic.test_get_core_clock] duration = 0.001 seconds
- PASS - [can_classic.test_get_state] duration = 0.001 seconds
- PASS - [can_classic.test_max_ext_filters] duration = 0.005 seconds
- PASS - [can_classic.test_max_std_filters] duration = 0.005 seconds
- PASS - [can_classic.test_receive_timeout] duration = 0.102 seconds
- PASS - [can_classic.test_recover] duration = 0.001 seconds
- PASS - [can_classic.test_recover_while_stopped] duration = 0.001 seconds
- PASS - [can_classic.test_send_and_forget] duration = 0.002 seconds
- PASS - [can_classic.test_send_callback] duration = 0.002 seconds
- PASS - [can_classic.test_send_fd_format] duration = 0.004 seconds
- PASS - [can_classic.test_send_invalid_dlc] duration = 0.004 seconds
- PASS - [can_classic.test_send_receive_ext_id] duration = 0.007 seconds
- PASS - [can_classic.test_send_receive_ext_id_masked] duration = 0.007 seconds
- PASS - [can_classic.test_send_receive_ext_id_rtr] duration = 0.207 seconds
- PASS - [can_classic.test_send_receive_msgq] duration = 0.014 seconds
- PASS - [can_classic.test_send_receive_std_id] duration = 0.006 seconds
- PASS - [can_classic.test_send_receive_std_id_masked] duration = 0.006 seconds
- PASS - [can_classic.test_send_receive_std_id_rtr] duration = 0.206 seconds
- PASS - [can_classic.test_send_receive_wrong_id] duration = 0.103 seconds
- PASS - [can_classic.test_send_while_stopped] duration = 0.001 seconds
- PASS - [can_classic.test_set_bitrate] duration = 0.001 seconds
- PASS - [can_classic.test_set_bitrate_too_high] duration = 0.001 seconds
- PASS - [can_classic.test_set_bitrate_while_started] duration = 0.005 seconds
- PASS - [can_classic.test_set_mode_while_started] duration = 0.001 seconds
- PASS - [can_classic.test_set_state_change_callback] duration = 0.001 seconds
- PASS - [can_classic.test_set_timing_while_started] duration = 0.005 seconds
- PASS - [can_classic.test_start_while_started] duration = 0.001 seconds
- PASS - [can_classic.test_stop_while_stopped] duration = 0.001 seconds

SUITE PASS - 100.00% [can_utilities]: pass = 3, fail = 0, skip = 0, total = 3 duration = 0.003 seconds
- PASS - [can_utilities.test_can_bytes_to_dlc] duration = 0.001 seconds
- PASS - [can_utilities.test_can_dlc_to_bytes] duration = 0.001 seconds
- PASS - [can_utilities.test_can_frame_matches_filter] duration = 0.001 seconds

SUITE SKIP - 0.00% [canfd]: pass = 0, fail = 0, skip = 8, total = 8 duration = 0.000 seconds
- SKIP - [canfd.test_filters_preserved_through_classic_to_fd_mode_change] duration = 0.000 seconds
- SKIP - [canfd.test_filters_preserved_through_fd_to_classic_mode_change] duration = 0.000 seconds
- SKIP - [canfd.test_get_capabilities] duration = 0.000 seconds
- SKIP - [canfd.test_send_receive_classic] duration = 0.000 seconds
- SKIP - [canfd.test_send_receive_fd] duration = 0.000 seconds
- SKIP - [canfd.test_send_receive_mixed] duration = 0.000 seconds
- SKIP - [canfd.test_set_bitrate_data_while_started] duration = 0.000 seconds
- SKIP - [canfd.test_set_timing_data_while_started] duration = 0.000 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL
#+end_example
14 changes: 0 additions & 14 deletions adcs/app.overlay

This file was deleted.

2 changes: 2 additions & 0 deletions adcs/prj.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
CONFIG_LIBCSP=y
CONFIG_PICOLIBC=y
CONFIG_CAN=y
CONFIG_LOG=y
8 changes: 8 additions & 0 deletions boards/arm/scsat1_adcs/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SC-Sat1 ADCS Board configuration

# Copyright (c) 2023 Space Cubics, LLC.
# SPDX-License-Identifier: Apache-2.0

config BOARD_SCSAT1_ADCS
bool "SC-Sat1 ADCS Board"
depends on SOC_SERIES_ARM_DESIGNSTART
20 changes: 20 additions & 0 deletions boards/arm/scsat1_adcs/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SC-Sat1 ADCS Board

# Copyright (c) 2023 Space Cubics,LLC
# SPDX-License-Identifier: Apache-2.0

if BOARD_SCSAT1_ADCS

config BOARD
default "scsat1_adcs"

config CPU_CORTEX_M_HAS_SYSTICK
default y

config CPU_HAS_ARM_MPU
default y

config NUM_IRQS
default 32

endif # BOARD_SCSAT1_ADCS
7 changes: 7 additions & 0 deletions boards/arm/scsat1_adcs/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_BOARD_SCSAT1_ADCS)
board_runner_args(openocd "--use-elf" "--config=${BOARD_DIR}/support/openocd-ftdi.cfg")

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
endif()
11 changes: 11 additions & 0 deletions boards/arm/scsat1_adcs/dts/bindings/sc,hrmem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0

description: Space Cubics HRMEM (High-reliability Memory)

compatible: "sc,hrmem"

include: base.yaml

properties:
reg:
required: true
72 changes: 72 additions & 0 deletions boards/arm/scsat1_adcs/scsat1_adcs.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2023 Space Cubics, LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <arm/armv7-m.dtsi>
#include <mem.h>

/ {
model = "Space Cubics Satellite 1 ADCS Board";

chosen {
zephyr,console = &uartlite0;
zephyr,shell-uart = &uartlite0;
zephyr,sram = &hrmem;
zephyr,canbus = &can0;
};

cpus {
#address-cells = <1>;
#size-cells = <0>;

cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-m3";
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;

mpu: mpu@e000ed90 {
compatible = "arm,armv7m-mpu";
reg = <0xe000ed90 0x40>;
arm,num-mpu-regions = <8>;
};
};
};

soc {
hrmem: memory@0 {
compatible = "sc,hrmem";
reg = <0x00000000 DT_SIZE_M(4)>;
};

uartlite0: uartlite@4f010000 {
compatible = "xlnx,xps-uartlite-1.00.a";
interrupts = <0 0>;
reg = <0x4f010000 0x10000>;
};

can0: can@40400000 {
compatible = "sc,can";
clock-frequency = <24000000>;
interrupts = <5 0>;
reg = <0x40400000 0x10000>;
bus-speed = <1000000>;
sjw = <4>;
sample-point = <750>;
tx-fifo-depth = <64>;
max-filter = <4>;

can-transceiver {
max-bitrate = <1000000>;
};
};
};
};

&nvic {
arm,num-irq-priority-bits = <3>;
};
9 changes: 9 additions & 0 deletions boards/arm/scsat1_adcs/scsat1_adcs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
identifier: scsat1_adcs
name: SC-Sat1 ADCS Board
type: mcu
arch: arm
toolchain:
- zephyr
supported:
- uart
- can
Loading

0 comments on commit 1d71dae

Please sign in to comment.