Skip to content

Commit 1e7d4fb

Browse files
Merge pull request #415 from ut-issl/develop
Update main (v3.7.0) on 2022-09-01
2 parents 954ea0d + 1d0cc8d commit 1e7d4fb

File tree

244 files changed

+8687
-3500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+8687
-3500
lines changed

.github/workflows/build_as_c89.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,20 @@ jobs:
2525
"Werror"
2626
"Wextra"
2727
)
28+
examples=(
29+
"minimum_user"
30+
"2nd_obc_user"
31+
)
2832
echo "[" > tmp
29-
for c in "${compiler[@]}"; do
30-
for w in "${warning[@]}"; do
31-
if [ "$c" == "gcc" ] && [ "$w" == "Werror" ]; then
32-
continue
33-
fi
34-
echo "{ \"compiler\": \"${c}\", \"warning\": \"${w}\" }" >> tmp
35-
echo "," >> tmp
33+
for e in "${examples[@]}"; do
34+
for c in "${compiler[@]}"; do
35+
for w in "${warning[@]}"; do
36+
if [ "$c" == "gcc" ] && [ "$w" == "Werror" ]; then
37+
continue
38+
fi
39+
echo "{ \"compiler\": \"${c}\", \"warning\": \"${w}\", \"example\": \"${e}\" }" >> tmp
40+
echo "," >> tmp
41+
done
3642
done
3743
done
3844
sed -i -e '$d' tmp # remove final comma
@@ -41,7 +47,7 @@ jobs:
4147
jq < tmp
4248
echo "::set-output name=matrix::{\"include\": $(cat tmp) }"
4349
44-
build_minimum_user_as_c89:
50+
build_examples_as_c89:
4551
runs-on: ubuntu-latest
4652
needs: gen_build_matrix
4753
strategy:
@@ -80,7 +86,7 @@ jobs:
8086
echo "::set-output name=WEXTRA::${WEXTRA}"
8187
8288
- name: cmake
83-
working-directory: ./Examples/minimum_user
89+
working-directory: ./Examples/${{ matrix.example }}
8490
env:
8591
CC: ${{ matrix.compiler }}
8692
run: |
@@ -92,12 +98,12 @@ jobs:
9298
- name: build
9399
id: build
94100
continue-on-error: ${{ matrix.compiler == 'clang' }}
95-
working-directory: ./Examples/minimum_user/build
101+
working-directory: ./Examples/${{ matrix.example }}/build
96102
run: cmake --build .
97103

98104
- name: run
99105
if: steps.build.outcome == 'success'
100-
working-directory: ./Examples/minimum_user/build
106+
working-directory: ./Examples/${{ matrix.example }}/build
101107
shell: bash
102108
run: timeout 3 ./C2A || exit 0
103109

@@ -112,22 +118,22 @@ jobs:
112118

113119
- name: clang-tidy
114120
if: matrix.compiler == 'clang'
115-
working-directory: ./Examples/minimum_user/build
121+
working-directory: ./Examples/${{ matrix.example }}/build
116122
run: |
117123
run-clang-tidy-11 \
118124
| sed 's/\/home\/runner\/work\/c2a-core\/c2a-core\///g' \
119-
| sed 's/Examples\/minimum_user\/src\/src_core\///g' \
125+
| sed 's/Examples\/${{ matrix.example }}\/src\/src_core\///g' \
120126
> clang_tidy.log
121127
122128
- name: clang-tidy result
123129
if: matrix.compiler == 'clang'
124-
working-directory: ./Examples/minimum_user/build
130+
working-directory: ./Examples/${{ matrix.example }}/build
125131
run: cat clang_tidy.log
126132

127133
- name: remove duplicate error
128134
if: matrix.compiler == 'clang'
129135
run: |
130-
python Script/CI/remove_duplicate_error.py ./Examples/minimum_user/build/clang_tidy.log "clang-tidy" | tee clang_tidy.log
136+
python Script/CI/remove_duplicate_error.py ./Examples/${{ matrix.example }}/build/clang_tidy.log "clang-tidy" | tee clang_tidy.log
131137
132138
- name: reviewdog clang-tidy (github-pr-review)
133139
if: matrix.compiler == 'clang' && matrix.warning == 'Werror'

.github/workflows/build_as_cxx.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ on:
88
pull_request:
99

1010
jobs:
11-
build_minimum_user_as_cxx:
11+
build_example_user_as_cxx:
1212
runs-on: windows-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
example:
17+
- minimum_user
18+
- 2nd_obc_user
19+
1320
steps:
1421
- uses: actions/checkout@v3
1522

@@ -18,19 +25,26 @@ jobs:
1825
run: ./setup.bat
1926

2027
- name: cmake
21-
working-directory: ./Examples/minimum_user
28+
working-directory: ./Examples/${{ matrix.example }}
2229
run: |
2330
mkdir build
2431
cd build
2532
cmake --version
2633
cmake .. -A Win32
2734
2835
- name: build
29-
working-directory: ./Examples/minimum_user/build
36+
working-directory: ./Examples/${{ matrix.example }}/build
3037
run: cmake --build .
3138

3239
build_s2e_mockup:
3340
runs-on: windows-latest
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
example:
45+
- minimum_user
46+
- 2nd_obc_user
47+
3448
steps:
3549
- uses: actions/checkout@v3
3650

@@ -39,13 +53,13 @@ jobs:
3953
run: ./setup.bat
4054

4155
- name: cmake
42-
working-directory: ./Examples/minimum_user/src/s2e_mockup
56+
working-directory: ./Examples/${{ matrix.example }}/src/s2e_mockup
4357
run: |
4458
mkdir build
4559
cd build
4660
cmake --version
4761
cmake .. -A Win32
4862
4963
- name: build
50-
working-directory: ./Examples/minimum_user/src/s2e_mockup/build
64+
working-directory: ./Examples/${{ matrix.example }}/src/s2e_mockup/build
5165
run: cmake --build .

.github/workflows/build_with_s2e.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
build_s2e_win:
1515
name: Build on Windows VS2022
1616
runs-on: windows-2022
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
example:
21+
- minimum_user
22+
- 2nd_obc_user
1723

1824
steps:
1925
- name: checkout S2E core
@@ -89,5 +95,5 @@ jobs:
8995
run: |
9096
cl.exe
9197
cmake --version
92-
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DEXT_LIB_DIR=../s2e-core/ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/minimum_user -DUSE_C2A=ON
98+
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DEXT_LIB_DIR=../s2e-core/ExtLibraries -DFLIGHT_SW_DIR=../c2a-core -DC2A_NAME=Examples/${{ matrix.example }} -DUSE_C2A=ON
9399
cmake --build . --clean-first

.github/workflows/check_coding_rule.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ on:
1010
jobs:
1111
check_coding_rule:
1212
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
example:
17+
- minimum_user
18+
- 2nd_obc_user
19+
1320
steps:
1421
- uses: actions/checkout@v3
1522
- uses: actions/setup-python@v4
@@ -23,7 +30,7 @@ jobs:
2330
id: check
2431
shell: bash -e {0}
2532
continue-on-error: true
26-
working-directory: ./Examples/minimum_user/src
33+
working-directory: ./Examples/${{ matrix.example }}/src
2734
run: |
2835
python ./src_core/Script/CI/check_coding_rule.py ./src_core/Script/CI/check_coding_rule.json | tee /tmp/coding-rule.log
2936
status="${PIPESTATUS[0]}"
@@ -38,7 +45,7 @@ jobs:
3845
run: |
3946
sed 's/.\/src_core\///g' < /tmp/coding-rule.log \
4047
| > ./coding-rule.log \
41-
sed 's/.\/src_user/Examples\/minimum_user\/src\/src_user/g'
48+
sed 's/.\/src_user/Examples\/${{ matrix.example }}\/src\/src_user/g'
4249
cat ./coding-rule.log
4350
4451
- name: reviewdog(github-pr-review)

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,7 @@ dkms.conf
6161
Examples/minimum_user/src/src_core
6262
Examples/minimum_user/build
6363
Examples/minimum_user/src/src_user/Test/authorization.json
64+
Examples/2nd_obc_user/src/src_core
65+
Examples/2nd_obc_user/build
66+
Examples/2nd_obc_user/src/src_user/Test/authorization.json
6467
*.pyc

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ set(C2A_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
1616

1717
set(C2A_SRCS
1818
c2a_core_main.c
19+
Drivers/Protocol/common_tlm_cmd_packet_for_driver_super.c
20+
Drivers/Protocol/eb90_frame_for_driver_super.c
21+
Drivers/Protocol/eb90_packet_for_driver_super.c
1922
Drivers/Super/driver_super.c
20-
Drivers/Super/driver_super_issl_format.c
2123
# System/AnomalyLogger/anomaly_logger.c # deprecated. 使いたい場合は, user 側でビルドターゲットに入れる.
2224
System/ApplicationManager/app_info.c
2325
System/ApplicationManager/app_manager.c

Docs/Core/communication.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Communication
22

33
## 概要
4-
通信関連,ネットワーク関連などをまとめる.
4+
通信関連,ネットワーク関連などをまとめる.
5+
コンポーネント間通信については [Driver/Communication with Components](../Driver/communication_with_components.md) などを参照のこと.
6+
57

68
## C2A 内部を流れるパケットについて (Common Packet)
79
C2A 内部を流れるパケットは以下の 3 つである.
@@ -21,6 +23,9 @@ C2A 標準として, Space Packet が Core 内で定義されており,基
2123

2224

2325
## C2A 標準 Space Packet 定義
26+
C2A 標準 Space Packet は,CCSDS (Consultative Committee for Space Data Systems.宇宙データシステムの標準化を進めている機関) の Space Packet に準拠したものである(参考: [CCSDS SPACE PACKET PROTOCOL](https://public.ccsds.org/Pubs/133x0b2e1.pdf)).
27+
CCSDS Space Packet において, Secondary Header はユーザー定義とされており, C2A 用に Secondary Header がカスタムされたものが C2A 標準 Space Packet である.
28+
2429
現在,C2A 標準 Space Packet として,テレメパケット,コマンドパケットともに, Ver.1 のみ策定している.
2530
ここでは, Ver.1 について記載する.
2631

@@ -47,16 +52,17 @@ https://github.com/ut-issl/c2a-core/blob/217c3156a07ec503cd60fc7b75978a3234ec2c5
4752
- 以下は CCSDS で規定
4853
- `0b11111111000` - `0b11111111110`: CCSDS Reserved
4954
- `0b11111111111`: Idle Packet
55+
- Packet Sequence Control Field
5056
- Sequence Flag
5157
- `0b00`: Continuation component of higher data structure
5258
- `0b01`: First component of higher data structure
5359
- `0b10`: Last component of higher data structure
5460
- `0b11`: Standalone Packet
5561
- Sequence Count
5662
- APID ごとにパケットの伝送順番を示すカウンタ
57-
- Packet Data Length
58-
- パケット全長から Primary Header 長を引き,さらに 1 を引いたもの
59-
- つまり,これが 0 の時, Secondary Header + User Data Field 長は 1 byte である
63+
- Packet Data Length
64+
- パケット全長から Primary Header 長を引き,さらに 1 を引いたもの
65+
- つまり,これが 0 の時, Secondary Header + User Data Field 長は 1 byte である
6066

6167

6268
### Secondary Header (Telemetry)
@@ -153,7 +159,7 @@ https://github.com/ut-issl/c2a-core/blob/b84c3d051a1e15ab62c8f1a9744957daa4a62a3
153159
- TLC: GS から MOBC に届き, MOBC で TLC としてエンキューされる.デキューした後, APID を元に, AOBC へ配送される.配送時, Destination Type は自分宛に上書きされ, AOBC で RTC としてキューイング & 実行される.
154160
- BC: GS から MOBC に届き, MOBC で BC 登録される.BC 展開した後, TL にエンキューされ,デキューした後, APID を元に, AOBC へ配送される.配送時, Destination Type は自分宛に上書きされ, AOBC で RTC としてキューイング & 実行される.
155161
- APID: AOBC, Destination Type: AOBC
156-
- GSC: GS から MOBC に届き, MOBC でエンキューされずに,そのまま AOBC へ配送される.配送時, Destination Type は自分宛に上書きされ, AOBC で GSC としてキューイング & 実行される.
162+
- GSC: GS から MOBC に届き, MOBC でエンキューされずに,そのまま AOBC へ配送される.配送時, Destination Type は自分宛に上書きされ, AOBC で RTC としてキューイング & 実行される.
157163
- TLC: GS から MOBC に届き, MOBC でエンキューされずに,そのまま AOBC へ配送される.配送時, Destination Type は自分宛に上書きされ, AOBC で TLC としてキューイング & 実行される.
158164
- BC: GS から MOBC に届き, MOBC で BC 登録されずに,そのまま AOBC へ配送される.配送時, Destination Type は自分宛に上書きされ, AOBC で BC として登録 & 実行される.
159165
- 地上局 SW での実装まとめ
@@ -176,5 +182,9 @@ https://github.com/ut-issl/c2a-core/blob/b84c3d051a1e15ab62c8f1a9744957daa4a62a3
176182
- https://github.com/ut-issl/c2a-core/blob/f3197d549559d1f571eb3e28497c9a488611f07f/Examples/minimum_user_for_s2e/src/src_user/Settings/TlmCmd/common_cmd_packet_define.h#L10-L11
177183

178184

185+
## C2A 間通信について
186+
上記 [#コマンド配送におけるルーティングについて](#コマンド配送におけるルーティングについて)[Driver/Communication with Components#c2a-間通信](../Driver/communication_with_components.md#c2a-間通信) などを参照すること.
187+
188+
179189
## CCSDS 準拠状況
180190
TBA
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Communication with Components
2+
3+
## 概要
4+
コンポーネント間通信などをまとめる.
5+
なお,地上局との通信関連や, CCSDS などについて,衛星内コンポーネントのネットワーク関連などについては [Core Layer/Communication](../Core/communication.md) を参照のこと.
6+
7+
8+
## 通信レイヤ
9+
コンポーネント間通信などのための通信レイヤについてまとめる.
10+
11+
### ネットワーク層
12+
コンポーネントや地上局,その他のノードでのデータ配送において,エンド・ツー・エンドの配送に責任を持つ.
13+
CCSDS における APID によって制御されるデータ配送はネットワーク層である.
14+
15+
この層を流れるデータ単位を `Packet` と呼ぶ.
16+
17+
C2A では,地上局との通信や C2A 間通信において, [Core Layer/Communication](../Core/communication.md) の Common Packet が標準的に使用される.
18+
C2A を搭載した OBC と Common Packet に対応していないその他のコンポーネントでは,後述する EB90 Packet を可能な限り用いる.
19+
20+
### データリンク層
21+
隣接するコンポーネントや地上局,その他のノード間でのデータ転送を行う.
22+
例えば,衛星内のコンポーネント A と B 間での UART での通信に対して責任を持つ.
23+
したがって,この場合は, UART 通信で発生しうるノイズへの耐性を提供することが期待される.
24+
25+
この層を流れるデータ単位を `Frame` と呼ぶ.
26+
27+
C2A では,CCSDS に準拠した地上局との通信では,それに準拠し Transfer Frame が使用される.
28+
それ以外では,後述する EB90 Frame を可能な限り用いる.
29+
30+
31+
## ネットワーク層 (Packet)
32+
### Common Packet
33+
[Core Layer/Communication](../Core/communication.md) を参照のこと.
34+
35+
### EB90 Packet
36+
Common Packet ほどリッチな情報をやり取りしない通信に用いる.
37+
したがって, User Data Field 以外の Header には,
38+
39+
- Version ID
40+
- Tlm / Cmd Count
41+
- Tlm / Cmd ID
42+
43+
のみ,定義されている.
44+
45+
直接通信する2者を超え,ネットワークを構築するだけの能力はない.
46+
また,通常データリンク層としては EB90 Frame が用いられる.
47+
48+
現在は Ver.1 のみ策定されており,その定義は以下を参照すること.
49+
50+
https://github.com/ut-issl/c2a-core/blob/9f5154ddc5684f8e626b77c8f8bc7c8215c0e096/Drivers/Protocol/eb90_packet_for_driver_super.h#L1-L25
51+
52+
#### 各フィールドの説明
53+
- Version ID
54+
- `0x00`: バージョン不定
55+
- `0x01`: Version 1
56+
- Tlm / Cmd Count
57+
- 送信 Packet 毎にインクリメントされていくカウンタ
58+
- Tlm / Cmd ID
59+
- Packet 種別を表す ID
60+
- User Data Field
61+
- バイト単位で格納されたユーザーデータ
62+
63+
なお,すべてのフィールドのバイトオーダはビッグエンディアンとする.
64+
65+
66+
## データリンク層 (Frame)
67+
### EB90 Frame
68+
UART などで接続されたコンポーネント間の通信といった,軽微な通信ノイズの誤り検出のみ必要な場合に用いる.
69+
ネットワーク層として EB90 Packet や Common Packet などが標準的に使用される.
70+
71+
https://github.com/ut-issl/c2a-core/blob/9f5154ddc5684f8e626b77c8f8bc7c8215c0e096/Drivers/Protocol/eb90_frame_for_driver_super.h#L1-L33
72+
73+
#### 各フィールドの説明
74+
- STX
75+
- Frame 先頭識別子
76+
- `0xEB 0x90` 固定
77+
- Packet Length
78+
- Packet Field の長さ
79+
- CRC
80+
- Packet Field 部分の CRC (Header は含めない)
81+
- 使用する CRC の種類は CRC-16/CCITT-FALSE (CRC-16/AUTOSAR, CRC-16/IBM-3740 とも)
82+
- `width=16, poly=0x1021, init=0xffff, refin=false, refout=false, xorout=0x0000, check=0x29b1, residue=0x0000`
83+
- ETX
84+
- Frame 終端識別子
85+
- `0xC5 0x79` 固定
86+
- Packet Field
87+
- バイト単位で格納された送信 Packet
88+
- EB90 Packet や Common Packet などが格納される
89+
90+
なお,すべてのフィールドのバイトオーダはビッグエンディアンとする.
91+
92+
93+
## C2A 間通信
94+
衛星内上の C2A (ないしは互換の Common Packet を用いる FSW)を搭載したコンポーネント(主に OBC)間での通信について記す.
95+
C2A 間通信によって,以下のような機能が提供される.
96+
97+
- OBC 間の簡易な Driver 実装と自動コード生成
98+
- [c2a-tlm-cmd-code-generator](https://github.com/ut-issl/c2a-tlm-cmd-code-generator) 参照.
99+
- [`Examples/minimum_user/src/src_user/Drivers/Aocs`](/Examples/minimum_user/src/src_user/Drivers/Aocs/) などの多くのコードが自動生成される.
100+
- OBC と地上局でネットワークを形成.
101+
- 地上局から MOBC をルーターとして, 2nd OBC へコマンド配送.
102+
- 2nd OBC のテレメトリを MOBC を経由して地上局まで配送.
103+
- OBC A から OBC B に対してコマンド発行 / テレメ送信.
104+
-
105+
106+
C2A 間通信の具体的な実装については,本リポジトリに同封されている User Sample である [`Examples/minimum_user`](/Examples/minimum_user)[`Examples/2nd_obc_user`](/Examples/2nd_obc_user) での通信(前者が MOBC,後者が AOBC を想定)を参考にされたい.
107+
具体的なドライバのコードは以下となる.
108+
109+
- https://github.com/ut-issl/c2a-core/blob/9f5154ddc5684f8e626b77c8f8bc7c8215c0e096/Examples/minimum_user/src/src_user/Drivers/Aocs/aobc.c#L1-L164
110+
- https://github.com/ut-issl/c2a-core/blob/9f5154ddc5684f8e626b77c8f8bc7c8215c0e096/Examples/2nd_obc_user/src/src_user/Drivers/Etc/mobc.c#L1-L150
111+
112+
地上局からのコマンドルーティングについては [Core Layer/Communication#コマンド配送におけるルーティングについて](../Core/communication.md#コマンド配送におけるルーティングについて) などを参照すること.
113+

0 commit comments

Comments
 (0)