Compare commits

..

793 Commits

Author SHA1 Message Date
a9813aedbb Merge pull request 'Release v1.3.0' (#54) from develop into master
Reviewed-on: #54
2021-07-22 11:53:07 +02:00
bda4dad22b config option needs to be in config namespace 2021-07-22 11:51:58 +02:00
ce15ee8107 Merge pull request 'Filesystem Update' (#53) from mueller/filesystem-update into develop
Reviewed-on: #53
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-07-22 09:03:43 +02:00
6a65474db2 Merge branch 'develop' into mueller/filesystem-update 2021-07-15 18:37:40 +02:00
4eb740fd07 minor changes 2021-07-12 17:50:01 +02:00
aa461d69f1 added builder functions for full paths 2021-07-12 17:41:13 +02:00
15ab1dd89d continued functions to create/delete dir 2021-07-12 17:39:36 +02:00
eb7b0770a0 starting file system handler 2021-07-12 17:23:32 +02:00
3a6b8cc66b FS queue size configurable 2021-07-12 16:32:14 +02:00
32ef21ea22 some more fixes 2021-07-12 15:58:43 +02:00
5454392a91 some refactoring 2021-07-12 15:52:13 +02:00
5fc8b650f9 more bugfixes 2021-07-12 15:19:06 +02:00
bd505f35e2 cold redundant and hot redundant configuration 2021-07-12 14:32:20 +02:00
a15e0bbaa5 sd card is now mounted as well 2021-07-12 13:26:02 +02:00
ed772665d5 fix so it compiles 2021-07-12 11:49:19 +02:00
c03233ad26 added docs and improvements 2021-07-12 11:47:23 +02:00
9cc236b275 mounting SD cards now as well 2021-07-12 11:37:10 +02:00
c399a8f5fb continued prep section 2021-07-12 10:48:12 +02:00
cca3115cee Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into mueller/master 2021-07-12 10:43:56 +02:00
435feb3980 section for rootfs differences 2021-07-12 10:43:41 +02:00
7053c63c5d Merge pull request 'SD Card, Scratch Buffer and README updates' (#52) from mueller/first-sd-tests into develop
Reviewed-on: #52
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-07-09 22:02:30 +02:00
eb7daf5013 bumped subversion 2021-07-09 17:55:09 +02:00
e22399c5be now a sd card will always be on 2021-07-09 17:54:32 +02:00
d1aa68ea80 testing scratch API 2021-07-09 17:21:26 +02:00
7facfaebff writing api for scratch buffer 2021-07-09 16:57:34 +02:00
567cc7eab2 added another useful command 2021-07-09 14:11:26 +02:00
5fcc9327a4 README update 2021-07-09 09:00:39 +02:00
4b7e338b7e readme update 2021-07-08 22:42:15 +02:00
86c689709e readme update 2021-07-08 22:32:16 +02:00
7bf5ed76dd README update 2021-07-08 21:39:23 +02:00
4abc92db76 readme small correction 2021-07-08 19:45:49 +02:00
355789aa9d readme update 2021-07-08 13:59:33 +02:00
d92b043a21 update README 2021-07-08 13:19:08 +02:00
7b6a8b7a54 updated xiphos traq link 2021-07-08 12:58:04 +02:00
643f37110b updated README 2021-07-08 12:36:41 +02:00
a3610d28ba contd file system handler 2021-07-08 12:32:24 +02:00
aeff4685ad updated file system handler 2021-07-08 12:22:41 +02:00
9c954f019d linking again fs 2021-07-08 12:13:38 +02:00
a56bfe5be1 added core controller 2021-07-08 12:11:24 +02:00
1f179bfd3a updated core controller 2021-07-08 12:07:39 +02:00
9eacccb86a continued sd card manager 2021-07-08 11:23:08 +02:00
2d043edea7 continued sd card manager 2021-07-08 00:03:17 +02:00
2526a45f6b cotninued sd card access manager 2021-07-07 20:50:11 +02:00
6829dd59f9 moved printout 2021-07-06 18:23:28 +02:00
e2f3da08a9 disabled test task 2021-07-06 18:20:14 +02:00
ec32b828c7 cleaning up 2021-07-06 18:18:57 +02:00
743efa3e95 found issue root 2021-07-06 18:17:32 +02:00
528551fc08 REAMDE update 2021-07-06 11:28:58 +02:00
499f191ee2 README update 2021-07-05 16:48:11 +02:00
9074984378 README Update 2021-07-05 16:41:15 +02:00
98a30ca918 Merge remote-tracking branch 'origin/develop' into mueller/master 2021-07-05 15:46:21 +02:00
f34ced78e7 Merge pull request 'meier/ReactionWheelHandler' (#51) from meier/ReactionWheelHandler into develop
Reviewed-on: #51
Reviewed-by: Robin Müller <robin.mueller.m@gmail.com>
2021-07-05 15:40:41 +02:00
dc849b2f9a Merge remote-tracking branch 'origin/develop' into meier/ReactionWheelHandler 2021-07-05 15:38:04 +02:00
7d41cdf9db linux update 2021-07-05 15:36:22 +02:00
36d2cbfac5 added more sd card stubs 2021-07-05 12:09:31 +02:00
b2c17f12bf added device list issue fix 2021-07-05 10:51:47 +02:00
afbd70b7fe updated README 2021-07-05 10:40:52 +02:00
b79d814bf5 added small printout 2021-07-05 10:24:38 +02:00
b3946336a7 updated project file 2021-07-05 10:18:55 +02:00
477aa2e75d updated project file 2021-07-05 10:14:32 +02:00
c55d58d07c Merge pull request 'Update Package' (#50) from mueller/update-package into develop
Reviewed-on: #50
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-07-01 17:26:13 +02:00
6356922ace updated tmtc 2021-07-01 14:53:00 +02:00
29e252d8fc commend rad sensor in again 2021-07-01 11:56:13 +02:00
8dbe77d4a5 added spi mux functionality to the rwSpiCallback 2021-07-01 10:53:50 +02:00
caebb4a4f4 Merge branch 'meier/ReactionWheelHandler' into meier/master 2021-07-01 07:42:24 +02:00
3cb6f77b62 comment in readme 2021-07-01 07:25:28 +02:00
13b50e8721 added file system test 2021-06-30 16:15:46 +02:00
21e740258e Merge remote-tracking branch 'origin/develop' into mueller/master 2021-06-30 16:03:49 +02:00
197c6d5abe Merge remote-tracking branch 'origin/develop' into mueller/update-package 2021-06-30 16:03:41 +02:00
16e865341e slight adaptions 2021-06-30 15:58:56 +02:00
0e31c6fa7c added tmtc 2021-06-30 15:46:58 +02:00
a27187825a updated project file 2021-06-30 15:45:57 +02:00
18545af1d8 deleted unneeded file 2021-06-30 15:40:49 +02:00
26bdda2d1f updated more build scripts 2021-06-30 15:36:27 +02:00
f4115bb92c simple mode working 2021-06-30 15:32:15 +02:00
4f2b422711 simple mode implemented 2021-06-30 15:18:41 +02:00
83fa6e7a4b added get telemetry command 2021-06-30 15:07:26 +02:00
480f1a833e save before using prepareDataLessCmd 2021-06-30 08:21:14 +02:00
d49e99b3e4 generator runs and rw transition delay 2021-06-29 17:27:39 +02:00
868dc17651 merge muller/master 2021-06-29 16:12:06 +02:00
613a58da30 tmtc update 2021-06-29 16:10:19 +02:00
4c879fc768 added event manager 2021-06-29 16:09:32 +02:00
43a18e030c all reaction wheels working 2021-06-29 16:08:20 +02:00
eba2a92021 fsfw_hal and tmtc update 2021-06-29 11:23:18 +02:00
6257bf759d created all rw objects 2021-06-29 09:50:50 +02:00
38fa2e0f93 gitmodules and tmtc update 2021-06-28 17:49:24 +02:00
03b10d8e42 rw2 enable fix 2021-06-28 14:39:08 +02:00
c6655e50a0 added second reaction wheel 2021-06-28 14:07:37 +02:00
67f2ed83ce added periodically polling of reset status in rw handler 2021-06-28 09:31:10 +02:00
ad43ebd587 added get reset and clear reset command to rw handler 2021-06-28 08:57:37 +02:00
3193d007c7 added init command 2021-06-25 16:00:32 +02:00
034f07ebba Merge branch 'meier/ReactionWheelHandler' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into meier/ReactionWheelHandler 2021-06-25 15:47:39 +02:00
a1b070c242 modified rw definitions 2021-06-25 15:47:33 +02:00
18cdfab9c9 rw handler fixes 2021-06-25 15:25:54 +02:00
993b405c99 added tmtc update 2021-06-25 12:17:07 +02:00
a53ff3c4d6 fixed object id merge conflicts 2021-06-25 12:15:59 +02:00
a5820cb285 updated tmtc 2021-06-25 12:07:33 +02:00
d976697c2a Merge pull request 'Object ID Update' (#49) from mueller/update into develop
Reviewed-on: #49
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-06-25 12:03:57 +02:00
5e5b813817 Merge remote-tracking branch 'origin/develop' into mueller/update 2021-06-24 18:10:57 +02:00
2965ab53f9 Merge remote-tracking branch 'origin/develop' into mueller/master 2021-06-24 18:10:47 +02:00
17024cd420 set id is now 0 2021-06-24 18:05:41 +02:00
72c9ca08b2 fixed merge conflicts 2021-06-24 18:01:09 +02:00
f772c18c08 added assembly index 2021-06-24 17:52:09 +02:00
2cc93c5fef fixed merge conflicts 2021-06-24 17:49:23 +02:00
e29939ff27 Merge pull request 'Update PSTs & Contd GPS Handler' (#48) from mueller/update-branch into develop
Reviewed-on: #48
2021-06-24 17:33:25 +02:00
31f9265338 get temperature and status of reaction wheel 2021-06-24 17:32:42 +02:00
525445823b logical addresses fix 2021-06-24 16:50:36 +02:00
4d2e7fe8da moved some object ids 2021-06-24 16:49:36 +02:00
7b71a96a93 updated object IDs again 2021-06-24 16:43:15 +02:00
8aba720bf6 update dev handler IDs 2021-06-24 16:39:46 +02:00
240bce5d2f added bus descriptors 2021-06-24 16:36:42 +02:00
e8ad502289 tmtc update 2021-06-24 16:35:04 +02:00
f190ad6f71 updated object IDs 2021-06-24 16:17:38 +02:00
08ab507440 removed unused code 2021-06-24 14:19:25 +02:00
a965a80d94 lis3 minor form changes 2021-06-24 14:17:24 +02:00
74b320d8e4 gps contd 2021-06-24 13:55:51 +02:00
d05b1913ab rw wip 2021-06-24 12:04:36 +02:00
9f795e3a3e continued gps handler 2021-06-24 11:42:40 +02:00
29989e7ae5 small README fix 2021-06-24 11:24:19 +02:00
f73e7cd4b1 added ninja scripts 2021-06-24 11:23:49 +02:00
f9ba20b877 fsfw update 2021-06-24 11:17:36 +02:00
fb29723728 fsfw update, rm3100 update 2021-06-24 11:16:08 +02:00
142dc29c75 Merge branch 'develop' into mueller/update-branch 2021-06-24 11:02:07 +02:00
00ee82956e fsfw update 2021-06-24 08:51:49 +02:00
6ba3f6918d split up PSTs and add contd GPS handler 2021-06-24 08:50:46 +02:00
cea1494649 split up psts 2021-06-23 15:18:31 +02:00
88181d8fb4 rw enable wip 2021-06-22 13:48:30 +02:00
d88b920dea tmtc update 2021-06-21 18:40:26 +02:00
ae3e0894b5 test 2021-06-21 18:11:07 +02:00
49c7b3fd45 fixed conflicts 2021-06-21 18:01:23 +02:00
ddbfe7529d Merge pull request 'Release v1.2.0' (#47) from develop into master
Reviewed-on: #47
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-06-21 17:58:40 +02:00
a2255e2cfe Merge pull request 'Small fix for hosted BSP' (#46) from mueller/update into develop
Reviewed-on: #46
2021-06-21 17:57:53 +02:00
ba5832d30e fixed merge conflicts 2021-06-21 17:51:08 +02:00
1046334c0c Merge remote-tracking branch 'origin/develop' into mueller/master 2021-06-21 17:48:03 +02:00
3f91973637 Merge pull request 'meier/ImtqHandler' (#44) from meier/ImtqHandler into develop
Reviewed-on: #44
2021-06-21 17:47:21 +02:00
0bcfafc76d Merge remote-tracking branch 'origin/develop' into meier/ImtqHandler 2021-06-21 17:45:56 +02:00
1d98fa9bfa tmtc update 2021-06-21 17:44:01 +02:00
0407aad611 Merge pull request 'Update Package' (#45) from mueller/update-package into develop
Reviewed-on: #45
2021-06-21 17:38:56 +02:00
0c92a9a941 tmtc update 2021-06-21 17:35:30 +02:00
26cad171df added tmtc 2021-06-21 17:27:54 +02:00
c23f1fc762 Merge branch 'meier/ImtqHandler' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into meier/ImtqHandler 2021-06-21 17:26:01 +02:00
4b4ac7902f applied changes according to pr comments 2021-06-21 17:25:13 +02:00
0ada1d8dfc tmtc update 2021-06-21 17:19:12 +02:00
8d8bb41334 rw chip select decoding 2021-06-21 17:15:19 +02:00
ec2f9d243b hosted build fixes 2021-06-21 17:09:49 +02:00
9097438cc2 script correction 2021-06-21 17:05:20 +02:00
89dc521e04 small q7s fix 2021-06-21 17:00:34 +02:00
85c3300e0b hal update 2021-06-21 16:57:36 +02:00
5bbf0255ef fixes for updated fsfw 2021-06-21 16:54:33 +02:00
67a1a84615 fsfw hal update 2021-06-21 16:51:27 +02:00
7424d1edfc Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2021-06-21 16:46:56 +02:00
2b25b3a605 q7s compiling 2021-06-21 16:46:49 +02:00
e2ac721432 minor tweaks, fsfw_hal update 2021-06-21 16:20:11 +02:00
428ae97e0e reaction wheels testing 2021-06-21 14:46:46 +02:00
df9119241e RwHandler first commands 2021-06-21 09:50:26 +02:00
95e625922e gps test complete 2021-06-16 18:38:06 +02:00
6d09006f1a compiling again 2021-06-16 17:19:14 +02:00
64427dd12d removed obj folder 2021-06-15 17:16:28 +02:00
bdc1b384f7 removed _dep, _bin, _obj 2021-06-15 17:12:23 +02:00
236244bbb4 added gps definitions file 2021-06-15 17:07:47 +02:00
78cb72d12d added startup and shutdown sequence 2021-06-15 16:44:31 +02:00
16066b4cf9 fsfw update 2021-06-15 16:18:18 +02:00
66e1c71615 updated submodules 2021-06-15 16:11:07 +02:00
d74f8860c8 fixed merge conflicts 2021-06-15 15:39:39 +02:00
677963a528 fsfw update and gomspace handler doc crossref 2021-06-15 15:37:37 +02:00
56a7198753 Merge pull request 'Update Package' (#43) from mueller/update-package into develop
Reviewed-on: #43
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-06-15 15:14:53 +02:00
89b11d725b IMTQ handler complete 2021-06-15 15:13:47 +02:00
2604876d0e cross referencing 2021-06-15 13:58:19 +02:00
e39d6a8ec9 comment block 2021-06-15 13:40:58 +02:00
80c3323553 fsfw and fsfw_hal update 2021-06-15 13:32:57 +02:00
ab8b3ae116 IMTQ positive x dipole test 2021-06-12 15:45:24 +02:00
2b03838b94 small cmake fix 2021-06-12 15:27:24 +02:00
32fa7026a1 moved gyro handler to archive 2021-06-12 15:21:17 +02:00
b7ae1bfed7 updated launch cfg 2021-06-12 15:17:27 +02:00
a7243dfc01 updated mingw configs 2021-06-12 15:15:37 +02:00
b6047455a8 updated proj name 2021-06-12 15:12:07 +02:00
8652ca0c12 submodule update 2021-06-12 15:09:25 +02:00
fd1cccd600 proj file update 2021-06-11 15:07:18 +02:00
6cac70b7c5 small update 2021-06-11 15:07:09 +02:00
76c6702f41 minor updates 2021-06-11 15:06:46 +02:00
46d49e130b fixed merge conflicts 2021-06-11 14:55:28 +02:00
7f8d0b6e14 Merge remote-tracking branch 'origin/develop' into mueller/master 2021-06-11 13:43:48 +02:00
d42a273336 Merge pull request 'Generators & CMake & FSFW Update' (#42) from mueller/generators-cmake-fsfw-update into develop
Reviewed-on: #42
2021-06-11 13:22:45 +02:00
b84a81556f positive x axis self test, untested 2021-06-11 11:53:43 +02:00
a09d121551 and another update 2021-06-11 11:19:58 +02:00
e61a17164a updated indexers 2021-06-11 11:18:03 +02:00
03b59c7f00 updated project file again 2021-06-11 11:13:46 +02:00
93c4fda8d9 updated project file 2021-06-11 11:10:31 +02:00
7acd21039e bugfixes for RPi 2021-06-11 11:01:23 +02:00
185e5fd730 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into mueller/master 2021-06-11 10:53:12 +02:00
3ba85abd86 hal update 2021-06-11 10:53:07 +02:00
7f6aedce71 dockerifle update 2021-06-09 12:22:32 +02:00
d3781ab46f trying ipv6 curl 2021-06-09 12:09:13 +02:00
95a3882fa1 bug fixes in ImtqHandler 2021-06-09 12:00:41 +02:00
06919d4f6a hal update 2021-06-09 11:34:14 +02:00
ab560bc0fc removed jenkinsfile 2021-06-08 17:11:04 +02:00
2b3d4306b9 updated generators 2021-06-08 17:10:47 +02:00
c28e608a33 removed submodule 2021-06-08 17:07:23 +02:00
de82746f40 using configuration files now 2021-06-08 17:04:28 +02:00
b271d0d47b small tweak 2021-06-08 16:47:32 +02:00
3a024c9a30 object manager singleton now 2021-06-08 16:45:25 +02:00
62cd36469f docker file update 2021-06-08 16:10:15 +02:00
ee66d0a349 updated docker files 2021-06-08 16:03:19 +02:00
1f52e1f35f trying older version 2021-06-08 15:53:38 +02:00
477ddbde69 fsfw update 2021-06-08 15:37:20 +02:00
427e36ed15 some fixes in IMTQ Handler 2021-06-06 14:11:05 +02:00
d7024e1ee7 added self test, untested 2021-06-04 16:45:54 +02:00
7dfaedd1d5 fixed merge conflicts and added threshold configuration to Max31865Handler 2021-06-02 10:25:35 +02:00
e532512042 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2021-05-31 17:06:41 +02:00
295805f522 updated FSFW and CMakeLIsts 2021-05-31 17:06:29 +02:00
84266dddc5 simple jenkinsfile 2021-05-28 20:18:08 +02:00
f287745eeb smaller corrections 2021-05-28 18:39:14 +02:00
a2cd806dbf some stubs 2021-05-27 21:06:37 +02:00
d6d11e26e7 rtd test 2021-05-27 19:05:08 +02:00
d3328ce013 added srv3 to linux bsp 2021-05-27 16:20:40 +02:00
c27830334d minor changes 2021-05-27 15:24:19 +02:00
a3020b4dac fsfw update 2021-05-27 14:10:23 +02:00
30eb733e82 small include fix 2021-05-27 14:09:07 +02:00
2193db6705 updated submodules 2021-05-27 14:06:52 +02:00
72939f569d compile failure 2021-05-27 14:04:33 +02:00
70e43960ae rtd update 2021-05-27 13:50:05 +02:00
1a4f928689 Merge pull request 'Update Package' (#38) from mueller/adis-handler-spi-update into develop
Reviewed-on: eive/eive_obsw#38
2021-05-27 13:48:12 +02:00
2033065e22 fixed include names 2021-05-27 13:34:28 +02:00
22439fe192 ptme bridge wip 2021-05-27 13:07:57 +02:00
e7e3b26b24 fsfw update 2021-05-27 11:57:06 +02:00
546273d5b8 added core controller stub 2021-05-26 14:16:16 +02:00
37fb33e378 adis handler fixes 2021-05-26 13:41:26 +02:00
4a7087fa5a adis handler continued 2021-05-26 13:30:12 +02:00
a73d31b0fb added a few more commands 2021-05-26 13:11:48 +02:00
b03c6f686e moved uart com if 2021-05-25 17:21:44 +02:00
2be6589251 some more corrections 2021-05-25 15:45:48 +02:00
501a775db0 small correction 2021-05-25 15:43:09 +02:00
de6e30498a fsfw_hal update 2021-05-25 15:38:21 +02:00
1d325b88b7 smaller bugfixes 2021-05-25 15:16:18 +02:00
4b78ccaae4 fsfw_hal update 2021-05-25 14:01:54 +02:00
54699837b1 some bugfixes for adis datasets 2021-05-25 13:53:03 +02:00
d864b8abf9 adis handler continued 2021-05-25 12:45:51 +02:00
6cc825f3da updated README 2021-05-25 11:39:58 +02:00
7b048baa71 reply handling for sensor data implemented 2021-05-24 21:15:23 +02:00
608e3eeda2 sensor handling moved to separate function 2021-05-24 20:59:19 +02:00
64bb0ae242 adis handler continued 2021-05-24 20:57:12 +02:00
33554899ae adis handler continued 2021-05-24 20:33:59 +02:00
76b0f3d821 added dockerignore 2021-05-24 15:47:48 +02:00
55def0d20e added docker-compose file 2021-05-24 15:47:09 +02:00
80972a074b fixes dockerfiles 2021-05-24 15:45:57 +02:00
284940bad9 updated links 2021-05-24 15:10:00 +02:00
8823cd856e updated all cloud links 2021-05-24 15:09:11 +02:00
c9dba5a628 initializing query size 2021-05-24 14:37:31 +02:00
c130112b75 q7s build working 2021-05-24 14:35:14 +02:00
7b931e89c6 trying out some stuff 2021-05-24 14:13:47 +02:00
d33a9cfff6 using tar.gz now 2021-05-24 14:08:55 +02:00
f5a181205a fixed hosted dockerfile 2021-05-24 12:43:22 +02:00
0252ded2c1 updated README with wget commands 2021-05-24 01:54:03 +02:00
76a4d63d9d added way to get sysroot with wget 2021-05-24 01:49:17 +02:00
3c41991896 updated RPi build config and scripts 2021-05-24 01:34:32 +02:00
b413ee00d2 updated build configs 2021-05-24 01:30:44 +02:00
6e86794541 small fix for q7s 2021-05-24 01:28:31 +02:00
bb75a74011 test pst 2021-05-24 01:20:44 +02:00
cca4e49bed added empty definitions file 2021-05-24 00:31:47 +02:00
47ca9b869c added gyro stubs 2021-05-24 00:30:46 +02:00
6a49db7daf fixes for linux board 2021-05-23 20:44:54 +02:00
88ccaa7c40 updated dockerfile 2021-05-21 19:53:50 +02:00
06e4147c77 added hosted dockerfile 2021-05-21 13:59:47 +02:00
3fad091f96 Merge pull request 'some objects missing' (#37) from mueller/missing-objects into develop
Reviewed-on: eive/eive_obsw#37
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-05-20 18:25:51 +02:00
56184a0cc3 Merge remote-tracking branch 'origin/develop' into mueller/missing-objects 2021-05-18 16:51:54 +02:00
afa4c41164 Merge remote-tracking branch 'origin/develop' into mueller/missing-objects 2021-05-18 16:51:29 +02:00
c679a2a755 some objects missing 2021-05-18 16:49:24 +02:00
b9907e3cf2 Merge pull request 'Update package 3' (#36) from mueller/update-package-3 into develop
Reviewed-on: eive/eive_obsw#36
2021-05-18 16:38:56 +02:00
78a008c7d9 Merge branch 'develop' into mueller/update-package-3 2021-05-18 16:38:25 +02:00
05e119c032 fsfw update 2021-05-18 16:19:33 +02:00
11192d7670 fix for hosted bsp 2021-05-18 16:17:51 +02:00
fbb7dfa5ee bsp name is gen csv 2021-05-18 16:16:02 +02:00
3cf93164a4 updated all auto-generated files 2021-05-18 16:14:11 +02:00
d9aa3684d3 Merge pull request 'Update package 2' (#35) from mueller/update-package-2 into develop
Reviewed-on: eive/eive_obsw#35
2021-05-18 15:48:18 +02:00
12dbc8f117 Merge remote-tracking branch 'origin/develop' into mueller/update-package-2 2021-05-18 15:38:47 +02:00
018356f606 Merge pull request 'Update Package v1.2.0' (#34) from mueller/update-package into develop
Reviewed-on: eive/eive_obsw#34
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-05-18 12:32:45 +02:00
9ccd0d2e72 moved fsfwconfig into linux folder 2021-05-17 20:03:56 +02:00
fd29f6ce85 hosted compiling with event translation 2021-05-17 19:51:38 +02:00
da94a61cfe default bsp is q7s 2021-05-17 19:50:24 +02:00
e5921bece3 regenerated hosted events 2021-05-17 19:50:07 +02:00
5c591f628a compiling with translation files 2021-05-17 19:49:29 +02:00
da17ec22fb generated event translation files 2021-05-17 19:39:35 +02:00
73e2b6eea8 moved makefiles to archive 2021-05-17 19:17:38 +02:00
ed5bb4406c deleted .db 2021-05-17 19:13:45 +02:00
c0bde2ddeb generated for host as well 2021-05-17 19:13:00 +02:00
17d187d4b0 generated header file as well 2021-05-17 19:12:25 +02:00
99acbccf84 generated translation file 2021-05-17 19:03:37 +02:00
6837ee641b object update 2021-05-17 18:58:15 +02:00
ff93529bac continued object id gen 2021-05-17 18:56:38 +02:00
0ab9d3bbe9 modgen update 2021-05-17 18:28:33 +02:00
0742e91c0a update tmtc 2021-05-17 18:17:57 +02:00
507be0958a update tmtc 2021-05-17 18:15:10 +02:00
51a6456b48 tmtc update 2021-05-17 18:09:08 +02:00
452eaaa76b tmtc update 2021-05-17 18:02:56 +02:00
c76aec726f tmtc update 2021-05-17 18:02:16 +02:00
8c2b0ae06e updated tmtc 2021-05-17 17:42:19 +02:00
c908f55820 removed hosted OBSWversion.h 2021-05-17 17:08:48 +02:00
558e0ac882 bumped OBSW version 2021-05-17 17:07:34 +02:00
0179a34a62 updated project files 2021-05-17 17:05:16 +02:00
ed2c7a2ec1 q7s compiling 2021-05-17 16:53:06 +02:00
b11ca551c7 host compiling again 2021-05-17 16:37:29 +02:00
fd9d6c6180 common config files 2021-05-17 16:22:51 +02:00
b3c4f2e48d updating everything 2021-05-17 16:10:53 +02:00
e2a9bed4d8 Merge remote-tracking branch 'origin/develop' into mueller/master 2021-05-17 16:02:04 +02:00
3d6ae3116f update fsfw_hal 2021-05-17 15:59:46 +02:00
9e6a7c6faf Merge pull request 'meier/master' (#33) from meier/master into develop
Reviewed-on: eive/eive_obsw#33
Reviewed-by: Robin Müller <robin.mueller.m@gmail.com>
2021-05-17 14:59:46 +02:00
09e66ceb49 Merge branch 'develop' into meier/master 2021-05-17 13:56:54 +02:00
8508957f5b added etl and tmtc 2021-05-17 13:54:12 +02:00
88fd3c03c3 ptme access wip 2021-05-17 13:47:10 +02:00
9d6c511f91 save before endianess change 2021-05-16 21:53:07 +02:00
486ca36cbc uio implementation 2021-05-16 19:22:04 +02:00
b0c2606e6a updated fsfw_hal 2021-05-13 13:42:47 +02:00
5b2e226bdc updated submodules 2021-05-13 13:35:24 +02:00
33c229d08a all sus initialized 2021-05-13 13:17:12 +02:00
44bde15a46 solved merge conflicts 2021-05-12 17:01:11 +02:00
65d0c1fabf Sus handler complete 2021-05-12 16:38:20 +02:00
2d170a1f61 sus delay implementation 2021-05-12 13:06:56 +02:00
e1e69539ca changed SusHandler MAX1227 to internal clock mode 2021-05-10 11:13:39 +02:00
a6465c42ba save before changing to internally clocked mode 2021-05-09 18:18:27 +02:00
fab28904de working SUS in externally clocked mode 2021-05-09 16:48:55 +02:00
261f16f15b write setup byte and conversions 2021-05-09 14:46:42 +02:00
98387a6d24 this works with q7s and new sus 2021-05-09 14:39:56 +02:00
950eab2373 this works with the old SUS 2021-05-09 12:09:39 +02:00
eeb8167cdc this worked with the prototype SUS 2021-05-09 10:06:36 +02:00
be29d0e71f some tries to get data from max1227 in externally clocked mode 2021-05-08 22:49:21 +02:00
1eb9909377 save before making change in spicomif 2021-05-07 18:48:42 +02:00
5ce0a63ad6 save before implementing SusHandler with chip select 2021-05-06 18:00:58 +02:00
60a9358648 correct board output now 2021-05-05 22:51:29 +02:00
4b2d641a8a fsfw update 2021-05-05 22:48:35 +02:00
0250d53e57 fixes for bbb build 2021-05-05 22:47:24 +02:00
5ace0dd61f beagle bone build working 2021-05-05 22:43:17 +02:00
ad05d61a2e added BBB support 2021-05-05 20:25:52 +02:00
3c6ec68faa rad sensor working 2021-05-03 13:35:16 +02:00
fd9adee1ae rad sensor working 2021-05-03 12:49:14 +02:00
31b4246bca another try to read out the adc 2021-05-03 12:05:19 +02:00
f708a67fa8 rad sensor change wip 2021-05-03 11:59:33 +02:00
b873831645 spi decoder callbacks wip 2021-05-02 13:48:39 +02:00
f2caa84098 Merge branch 'meier/master' into meier/max1227Handler 2021-04-30 09:04:20 +02:00
bd63550efd Merge branch 'meier/master' into develop 2021-04-29 17:45:43 +02:00
8509e15736 integrated gyro and mgm handler 2021-04-29 17:45:19 +02:00
ed6eea82c5 max1227 wip 2021-04-29 10:40:11 +02:00
619058bf25 tmtc merge conflict 2021-04-27 17:39:14 +02:00
2473b2ef21 Merge branch 'develop' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into develop 2021-04-27 17:36:05 +02:00
ea2b1fbda4 basic structure for ILH PLOC control 2021-04-27 17:34:50 +02:00
255313d165 added PLOC sequence count. Not tested yet 2021-04-27 12:18:04 +02:00
bf1f2ae1b5 fixed conflicts 2021-04-26 17:59:26 +02:00
ac0cd39f86 fixed merge conflicts 2021-04-26 17:50:36 +02:00
4e8a6b65ec self test wip 2021-04-26 14:25:23 +02:00
cdde3e29a8 corrections in plocHandler, endianness 2021-04-26 11:28:19 +02:00
ad48d5888d imqt base functions 2021-04-26 07:56:02 +02:00
986ee97721 added wiretapping mode check in handleDeviceTm of PlocHandler 2021-04-25 15:54:48 +02:00
191f4b6d0c get commanded dipole wip 2021-04-25 15:53:44 +02:00
70ff6a06f7 Merge branch 'develop' into meier/mgtHandler 2021-04-25 12:47:45 +02:00
d877887826 imqt wip 2021-04-25 12:47:41 +02:00
c4b348c97f Merge pull request 'Update to v1.1.0' (#29) from develop into master
Reviewed-on: eive/eive_obsw#29
2021-04-25 12:43:23 +02:00
c19cdaaa16 Merge pull request 'Update v1.2 - MGT - RTD - PUSC' (#28) from mueller/mgt-rtd-pusc into develop
Reviewed-on: eive/eive_obsw#28
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-04-25 12:40:38 +02:00
89dbe078c9 Merge remote-tracking branch 'origin/develop' into mueller/mgt-rtd-pusc 2021-04-25 12:38:22 +02:00
38ea091a7f obsw version update 2021-04-25 12:37:59 +02:00
e1c7ed419f OBSW VERsion 2021-04-25 12:35:24 +02:00
76c31a4d13 Merge pull request 'Added FSFW HAL, some GPIO modules moved, FSFW update' (#27) from mueller/added-fsfw-hal into develop
Reviewed-on: eive/eive_obsw#27
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
2021-04-25 12:34:26 +02:00
b042335ed1 Merge remote-tracking branch 'origin/meier/mgtHandler' into mueller/master 2021-04-25 12:25:55 +02:00
9fd7943e2e tmtc update 2021-04-25 12:23:34 +02:00
1472c3754d fsfw update 2021-04-25 11:33:32 +02:00
4580a4ef37 tmtc update 2021-04-25 11:32:49 +02:00
132acf0dd3 tmtc and obj factory update 2021-04-25 11:32:21 +02:00
4ec2454542 added modgen submodule 2021-04-25 11:10:05 +02:00
c2a366e449 fixed merge conflicts 2021-04-25 10:51:59 +02:00
053e5f6e92 merged mueller master 2021-04-25 09:33:21 +02:00
076c00717c deleted faulty header includes 2021-04-25 09:24:41 +02:00
3902951a70 Merge branch 'mueller/master' into meier/mgtHandler 2021-04-25 00:06:04 +02:00
b3054baccf fsfw update 2021-04-25 00:00:17 +02:00
24a3b11d62 everything seems to work now 2021-04-24 23:41:27 +02:00
962b267454 added dns name 2021-04-24 23:17:45 +02:00
5cf2338f09 adaptions for new fsfw, using pus c now 2021-04-24 23:04:17 +02:00
1e1446c40e issue with poolManager.subscribe in max handler 2021-04-24 22:55:26 +02:00
c276c11e21 updated fsfw and tmtc submodule 2021-04-24 22:51:04 +02:00
cbbc501039 typo fix 2021-04-24 14:55:15 +02:00
e4a715e24c ploc build for q7s 2021-04-24 14:22:22 +02:00
fa2c9344d6 mgt debugging 2021-04-24 13:01:49 +02:00
2e28016281 readme update 2021-04-24 12:46:08 +02:00
a0a5c4c8aa tc mem write and tc mem read implemented 2021-04-22 17:32:39 +02:00
7c28b2a0bc changes in plocDefinitions and plocHandler 2021-04-19 17:17:22 +02:00
b0e8a8624a wip 2021-04-16 18:59:48 +02:00
0916ca87d9 plocHandler wip 2021-04-15 13:17:15 +02:00
0c892982ae cs gyro 1 change 2021-04-12 10:22:13 +02:00
5d4c2bd521 plocHandler wip 2021-04-12 10:16:59 +02:00
c6171a6c2a merged origin 2021-04-11 15:21:15 +02:00
97e5eb7319 spi chipselects changes 2021-04-11 15:18:55 +02:00
0b9ae5e4ec common versioning file 2021-04-11 12:25:23 +02:00
400f60c7be plocHandler wip 2021-04-11 12:04:13 +02:00
0677852cfc Merge branch 'develop' into mueller/added-fsfw-hal 2021-04-10 22:49:14 +02:00
3046b62ddb resolved merge conflicts 2021-04-10 22:22:39 +02:00
c4a6a680c8 fsfw and fsfw_hal update 2021-04-10 21:59:19 +02:00
5fbaca9b9f non block almostr eworking 2021-04-02 16:44:25 +02:00
14b69ed7e9 minor formatting stuff 2021-04-02 15:26:57 +02:00
1647b8a98e hal update 2021-04-02 15:16:41 +02:00
437f4573b5 added more spi test code, preprocessor defines
and various bugfixes
2021-04-02 15:14:08 +02:00
2dbe893197 added device handler 2021-04-02 13:25:37 +02:00
ffa11ce253 pushed stuff 2021-04-01 17:19:12 +02:00
62834bebcc small form improvements 2021-04-01 17:06:35 +02:00
e79a8e0926 now its compiling 2021-04-01 16:33:30 +02:00
bcc2f89f12 Merge branch 'meier/max13865pt1000Handler' into mueller/master 2021-04-01 16:22:25 +02:00
aa606b031a fixes 2021-04-01 16:21:24 +02:00
e1454db4b9 some adaptions 2021-04-01 15:42:51 +02:00
248c381ade Merge branch 'mueller/master' into meier/max13865pt1000Handler 2021-04-01 15:34:28 +02:00
29d8c8c0c8 one missing zeros 2021-04-01 15:22:16 +02:00
af48c6528d compiling 2021-04-01 15:14:50 +02:00
0027a43315 polling sequence table entries for acs devices 2021-04-01 15:32:43 +02:00
12be9bf7e4 added rpi acs board code to q7s 2021-04-01 14:06:56 +02:00
e86106615a updated default Q7S sysroot 2021-04-01 13:31:10 +02:00
1a4830aea9 deleted folder which was moved 2021-04-01 11:07:56 +02:00
fb7abbc82b moved i2c to fsfw_hal as well 2021-04-01 11:06:26 +02:00
2b3d531e5d moved spi code to fsfw_hal 2021-04-01 10:59:36 +02:00
4e2d8bdc5c updated host osal 2021-04-01 10:37:34 +02:00
5f6479d193 added unix path helper 2021-04-01 10:24:21 +02:00
1eb487a84b Merge remote-tracking branch 'origin/mueller/added-fsfw-hal' into mueller/master 2021-04-01 10:14:01 +02:00
f13b86379f updated to new fsfw 2021-04-01 10:12:57 +02:00
c5406951ad Merge remote-tracking branch 'origin/develop' into mueller/master 2021-04-01 10:11:36 +02:00
93daabab73 fsfw update 2021-04-01 10:09:37 +02:00
b062be78db Merge branch 'meier/mgtHandler' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into meier/mgtHandler 2021-03-29 16:54:22 +02:00
eee73f46c5 fixes in imqt 2021-03-29 16:40:14 +02:00
103c12052c corrections ofr updated common udp code 2021-03-29 14:42:33 +02:00
699b4a0eb9 ploc handler wip 2021-03-29 14:37:52 +02:00
25b5734186 fsfw updated 2021-03-29 14:37:08 +02:00
ebfda75e34 added way to supply definesto cmake 2021-03-29 14:31:55 +02:00
77bd1ea50d merged origin mgtHandler 2021-03-26 14:07:13 +01:00
0e614aa163 submodules add 2021-03-26 14:05:56 +01:00
be9d11afff imqt handler compiled 2021-03-26 13:55:32 +01:00
1492d168d8 fixed merge conflicts 2021-03-26 12:30:24 +01:00
887a47f7f5 imtq instantiation 2021-03-26 12:08:37 +01:00
fed2d56e20 Merge branch 'meier/max13865pt1000Handler' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into meier/max13865pt1000Handler 2021-03-25 17:15:59 +01:00
515d56e423 transition delay set to 5000 again 2021-03-25 17:15:54 +01:00
04d0beac4c added all max handler 2021-03-25 13:10:48 +01:00
df723b26a1 rtd handler improvements 2021-03-24 12:53:25 +01:00
1ad03cef9e fixed q7s 2021-03-23 16:52:19 +01:00
ced80ce4d0 updated project files again 2021-03-23 16:47:35 +01:00
4bf1206fbd using new fsfw_hal now 2021-03-23 16:45:07 +01:00
f6fb7f4c4b integrating fsfw_hal 2021-03-23 16:15:31 +01:00
8d30c83d42 added fsfw hal 2021-03-23 16:06:23 +01:00
8331b76ea8 updated tmtc submodule 2021-03-23 13:44:45 +01:00
5bdd4dad28 fixed merge conflicts 2021-03-23 09:09:50 +01:00
af3231f405 minor changes in object factory 2021-03-22 13:57:21 +01:00
e44773fee3 solved all merge conflicts 2021-03-22 13:09:06 +01:00
862a546637 deleted polling sequence file 2021-03-22 12:47:45 +01:00
5439305b8c added fsfw 2021-03-22 12:17:00 +01:00
a3ce747b94 Merge branch 'develop' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into develop 2021-03-21 17:35:28 +01:00
19abeadf74 IMTQHandler wip 2021-03-21 17:35:14 +01:00
682cdb3ce9 readem update 2021-03-20 16:09:11 +01:00
4e6fa7f5ac Merge branch 'mueller/master' into develop 2021-03-20 15:55:38 +01:00
cb2a3636df updated fsfw and obj factory 2021-03-20 15:55:15 +01:00
66375ab0cd corrected project files for host build 2021-03-20 15:07:04 +01:00
1fed42e3dc submodule update 2021-03-20 15:00:47 +01:00
88537fabc7 Merge pull request 'FSFW Update' (#26) from mueller/fsfw-update into develop
Reviewed-on: eive/eive_obsw#26
2021-03-19 16:13:02 +01:00
52a9807f4d Merge remote-tracking branch 'origin/develop' into mueller/fsfw-update 2021-03-19 15:54:12 +01:00
b33c38941e fixed for fsfw update 2021-03-19 15:52:39 +01:00
9404346722 Merge pull request 'Update package' (#25) from mueller/update-package into develop
Reviewed-on: eive/eive_obsw#25
2021-03-19 15:48:22 +01:00
f140eb4154 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2021-03-19 15:44:22 +01:00
703eb5a1e1 fsfw update 2021-03-19 15:42:11 +01:00
6ec4d22a14 IMTQ dipole actuation command, wip 2021-03-19 15:33:43 +01:00
c3a3394c8a IMQT wip 2021-03-17 11:14:48 +01:00
e048d6d7ec rtd handler compiled 2021-03-13 14:42:30 +01:00
cbe55a605d lowered transition times and changed pst to 1sec 2021-03-07 14:11:13 +01:00
cdcb049736 disabled acs board test 2021-03-07 14:07:17 +01:00
dfec824222 L3DG20H device handler tested 2021-03-07 14:06:29 +01:00
5c04ddea1d doc added 2021-03-07 12:55:22 +01:00
b1dc0122b7 using big endian now for gyro 2021-03-07 12:53:10 +01:00
a581ce8bd6 added l3g handler 2021-03-07 12:50:41 +01:00
9ddbdbe19e both magnetic sensors working at once now 2021-03-06 20:49:22 +01:00
88f84c4393 rm3100 tested now as well 2021-03-06 20:37:17 +01:00
32670f4a81 simple rm3100 test working now 2021-03-06 20:21:23 +01:00
5f3d2b1516 started rm3100 testing 2021-03-06 18:12:50 +01:00
bf56ac90ad added additional build config RPI flag 2021-03-06 15:13:28 +01:00
9bf581a528 updated project files 2021-03-06 14:06:46 +01:00
7ed19866b0 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2021-03-06 14:01:55 +01:00
271c7ce7ec made shell scripts executable 2021-03-06 14:01:18 +01:00
602097f1ed lwgps 2021-03-05 21:47:44 +01:00
57d46ca612 fsfw update 2021-03-05 21:12:57 +01:00
a6504e941d adaptions for fsfw api changes 2021-03-05 19:31:45 +01:00
6cc071f8ee removed make launch configs and updated shell scripts 2021-03-05 19:17:03 +01:00
fcda3bd2ea fsfw update 2021-03-05 18:55:58 +01:00
b75eef7c51 fixed merge conflict and copied max13865 code 2021-03-05 12:57:42 +01:00
7f8720706e added etl 2021-03-04 18:31:10 +01:00
93636426b6 moved some files 2021-03-04 18:29:28 +01:00
94ad41abb4 Merge pull request 'lwgps library integrated' (#23) from mueller/lwgps-integrated into develop
Reviewed-on: eive/eive_obsw#23
2021-03-04 18:24:01 +01:00
12f0c91342 Merge pull request 'SPI update, Version bump' (#22) from mueller/spi-com-if-tested into develop
Reviewed-on: eive/eive_obsw#22
2021-03-04 18:23:43 +01:00
189c35eb8d commented out setting pcdu to normal mode 2021-03-04 18:22:04 +01:00
be4977df68 syrlinks hk handler complete 2021-03-01 12:23:39 +01:00
f435238699 lwgps update 2021-02-28 16:16:22 +01:00
3cff08f644 lwgps update 2021-02-27 21:49:15 +01:00
02ac9b1fa5 updated init mission of hosted bsp
and executed lwGPS test
2021-02-27 21:39:32 +01:00
da30b270c4 added lwgps config 2021-02-27 21:24:19 +01:00
30c9d2dc0f solar array depl moved to bsp folder
hosted build working again
2021-02-27 19:46:13 +01:00
6518a7f244 moved all third-party lib to separate folder 2021-02-27 19:32:58 +01:00
b5650033d8 moved etl to thirdparty folder 2021-02-27 19:24:30 +01:00
581aa689ed added lwgps library 2021-02-27 19:22:18 +01:00
705a6d880a tmtc update 2021-02-27 19:21:22 +01:00
e4f3eb0172 added readout of some tx registers 2021-02-27 11:07:42 +01:00
c076ec5487 readme update 2021-02-25 18:18:47 +01:00
1ef873098f added hex string to int functions 2021-02-25 18:15:57 +01:00
4c09e973be hex to int wip 2021-02-25 15:53:28 +01:00
5d24627c91 adapter size of rx registers reply 2021-02-25 15:25:49 +01:00
8243db74ce tab replacements 2021-02-24 11:40:45 +01:00
561893a6b9 small form improvements 2021-02-24 11:36:35 +01:00
8b0ce0c5ec tab replacements 2021-02-24 11:35:22 +01:00
b108c73d35 printf support added 2021-02-24 11:32:24 +01:00
e7d4d7b4ee who am i reg is now checked 2021-02-24 11:24:31 +01:00
1416a56ae7 spi com if basic verification complete 2021-02-24 11:16:33 +01:00
2cc22b2233 added some testcode, zero init spi struct 2021-02-24 10:36:23 +01:00
6b982ce5cd lis 3 basic test code 2021-02-24 00:24:14 +01:00
93aafb4344 version is 1.0 now (i think were post alpha state..) 2021-02-23 22:11:42 +01:00
c5552bbc32 testing mgm handler 2021-02-23 22:07:39 +01:00
d7f8e11563 disabled tests by default 2021-02-23 18:19:11 +01:00
aa69b2f492 added stopwatch include 2021-02-23 18:18:12 +01:00
02c4cae12f removed obsolete printout 2021-02-23 18:14:23 +01:00
84ebc71b23 spi bugfixes 2021-02-23 18:01:28 +01:00
cb0fa384ca continued test class 2021-02-23 17:05:48 +01:00
a47c8d91a0 continued test task 2021-02-23 17:01:25 +01:00
178c3e2540 more bugfixes 2021-02-23 16:58:22 +01:00
673cfc8747 gpio bugfix 2021-02-23 16:47:34 +01:00
4248657680 fsfw update 2021-02-23 14:47:38 +01:00
09ff131133 libgpiod test 2021-02-23 14:44:16 +01:00
f65e28d33b fsfw update 2021-02-23 14:41:57 +01:00
e25e473c32 fsfw update 2021-02-23 14:41:40 +01:00
bbd6a36332 redordered includes 2021-02-23 13:39:01 +01:00
06173eeb03 small fixes for Q7S 2021-02-23 13:38:43 +01:00
46495dd123 deleted unused code 2021-02-23 13:34:34 +01:00
dfe2c81ecd cleaned up includes 2021-02-23 13:34:02 +01:00
c406133ae6 printf supportt 2021-02-23 13:33:12 +01:00
ed40ed70cc bugfix 2021-02-23 13:27:02 +01:00
434d0586b3 refactored GPIO to support callbacks 2021-02-23 13:24:05 +01:00
c042bbea63 source file for utility now 2021-02-23 12:13:04 +01:00
e1e0c07746 spi com if finished 2021-02-23 11:56:48 +01:00
3550fb6ca7 spi com if almost finished 2021-02-23 11:31:50 +01:00
a2e6634208 fsfw update 2021-02-22 18:48:58 +01:00
e9ffa930de better missed deadline handling 2021-02-22 18:46:45 +01:00
b03420c706 added service 20 2021-02-22 17:36:44 +01:00
ac250cb4cb bugfix 2021-02-22 14:25:46 +01:00
e6c75c54ea explicit cast so it compiles 2021-02-22 13:01:46 +01:00
7f05285803 heater handler moved 2021-02-22 12:59:50 +01:00
1ffcc8e5f6 Merge remote-tracking branch 'origin/develop' into mueller/master 2021-02-22 12:59:05 +01:00
400d5710d4 added link library gpiod 2021-02-22 12:57:41 +01:00
ab1b4271ec updated cmake lists 2021-02-22 12:45:10 +01:00
86e527882c added loopback test mode 2021-02-22 12:40:12 +01:00
7c71e2b067 separate folder for RPi builds 2021-02-22 12:36:28 +01:00
9bdc2096b0 syrlinks handler ready for testing 2021-02-22 09:24:42 +01:00
13c75ed9c2 save before removing approach with rememberCommandId 2021-02-19 15:41:50 +01:00
6e0e840c3a included crc for syrlinks 2021-02-19 12:10:02 +01:00
d8c1ad7f71 syrlinks handler wip 2021-02-19 11:02:27 +01:00
effb703d14 syrlinks handler wip 2021-02-18 16:16:38 +01:00
3bc5d1abce Merge branch 'develop' into meier/syrlinksHkHandler 2021-02-17 16:03:31 +01:00
32d17b9f03 improved s/a deployment handler 2021-02-17 16:02:49 +01:00
5179f165da syrlinks handler wip 2021-02-17 15:54:48 +01:00
4d4cf3f694 fixed merge conflicts 2021-02-17 10:33:19 +01:00
4d64897640 read acu hk table complete 2021-02-16 17:02:03 +01:00
c9947bbccc deployment handler 2021-02-16 15:32:24 +01:00
967618f687 new linux boardtest folder 2021-02-14 19:22:58 +01:00
aa5690687a small form stuff 2021-02-14 19:06:26 +01:00
83f080abe9 removed newlines 2021-02-14 18:53:11 +01:00
a8d2557545 added back member iter 2021-02-14 18:52:40 +01:00
0045cd2062 simplified i2c code 2021-02-14 18:45:31 +01:00
101a7696c3 corrected include guards, changed GpioIF prototype 2021-02-14 18:39:50 +01:00
6d2d7ad620 moved heater handler 2021-02-14 18:30:12 +01:00
fc0337af04 some minor improvements 2021-02-14 18:21:59 +01:00
9a995a9b5c reference returned now 2021-02-14 17:44:16 +01:00
e116e0dc64 Merge pull request 'Improved structure' (#17) from mueller/master into develop
Reviewed-on: eive/eive_obsw#17
2021-02-14 16:28:51 +01:00
95ab220f6e corrected p60dock max reply size 2021-02-14 15:49:03 +01:00
c6e145f17d tabs/spaces 2021-02-14 15:01:04 +01:00
313f7f6ec1 repaired q7s build/includes 2021-02-14 14:59:43 +01:00
f64d707f4c moved stuff to linux folder 2021-02-14 14:55:33 +01:00
b4e6edce80 new section for sysroot 2021-02-14 14:48:24 +01:00
37eed4182c readme update 2021-02-14 14:43:25 +01:00
8e9af49574 readme update 2021-02-14 14:41:44 +01:00
b022822113 updated project files 2021-02-14 14:33:53 +01:00
539eb91719 readme update 2021-02-14 14:32:45 +01:00
96a620ccc7 small detail added 2021-02-14 13:26:35 +01:00
be5b189ba0 readme update 2021-02-14 13:24:13 +01:00
38402eac45 compile check succesfull 2021-02-14 13:07:05 +01:00
00fa7fd67e updated project files 2021-02-14 12:57:35 +01:00
f006188814 moved some files 2021-02-14 12:57:09 +01:00
56c89a0751 added new linux folder 2021-02-14 12:35:08 +01:00
ae47acdbbb moved gpiod test to bsp folder 2021-02-14 12:23:29 +01:00
f2b1255b39 fsfw and tmtc update 2021-02-14 12:19:43 +01:00
217c1a6c2a deleted doubled cmake debug folder 2021-02-14 12:08:12 +01:00
9d87b368fb fixed bug with hk table reply size 2021-02-14 12:07:18 +01:00
29fb3cb9b8 Merge branch 'meier_eiveobsw' into meier/acuHkTable 2021-02-14 11:40:49 +01:00
f042572429 little issue with acu hk reply 2021-02-14 11:40:40 +01:00
88f62c5a11 restructured objectfactory and init_mission for libgpio test on te0720 2021-02-14 11:03:53 +01:00
df0e1aa869 fixed merge conflicts 2021-02-14 10:07:31 +01:00
bdc4b1cec5 added gpio read function 2021-02-14 09:25:40 +01:00
1f5504b7f7 Merge pull request 'Small update, Submodule updates' (#15) from mueller/master into develop
Reviewed-on: eive/eive_obsw#15
2021-02-14 08:37:55 +01:00
6cd9d439bc fsfw and tmtc update 2021-02-13 19:00:34 +01:00
5783dfdd06 compilation successful of acu hk table dataset 2021-02-12 22:38:41 +01:00
76e59e3593 improved linux libgpiod interface 2021-02-12 21:23:35 +01:00
b908393b79 added all heater switches 2021-02-12 15:24:37 +01:00
aa70d04730 acu hk tabel local pool, wip 2021-02-12 14:31:43 +01:00
b82e1d72ea added heater 1 2021-02-12 14:18:34 +01:00
7b4949583b enabled gpio switching in heater again 2021-02-12 12:52:40 +01:00
9c02809e10 improved debug messages 2021-02-12 10:51:32 +01:00
78086ebbc7 added p60 dock hk table local pool 2021-02-12 10:20:39 +01:00
95e549e313 init local pool for hktable, wip 2021-02-11 08:49:12 +01:00
5ccb3d1488 heater main switch commanding 2021-02-11 08:19:48 +01:00
1c3d0488e8 fsfw update 2021-02-09 12:43:03 +01:00
64a7532f3f p60 dock init local pool 2021-02-09 10:31:40 +01:00
d602912364 fixed PCDU memory leak 2021-02-08 14:12:36 +01:00
f4249e82e3 issue with PDU Handler 2021-02-08 11:48:58 +01:00
5a70df7bd7 pdu2 hk table periodic request 2021-02-06 16:13:31 +01:00
c3665cbd65 pdu2 dataset update snapshot 2021-02-06 11:57:45 +01:00
015251dab1 fsfw update 2021-02-05 11:17:40 +01:00
00cabbb8e9 save before changing pdu hk table dataset 2021-02-05 07:37:21 +01:00
3d734117e1 pcdu handler pdu2 dataset wip 2021-02-03 19:35:55 +01:00
e33769e654 Merge branch 'develop' into mueller/master 2021-02-03 14:18:24 +01:00
9b8c4fadb1 tmtc update 2021-02-03 14:18:13 +01:00
8e0b38f8db tmtc update 2021-02-03 14:15:06 +01:00
19fb5535f6 fsfw update 2021-02-03 13:41:32 +01:00
75a1db70f4 fsfw update 2021-02-03 13:40:04 +01:00
86df9a9e30 updated eive repo 2021-02-03 13:38:04 +01:00
38d4b28a90 save structs for datasets 2021-02-03 08:09:54 +01:00
26f16995e0 commanding of HeaterHandler and GpioIF working 2021-02-01 11:17:20 +01:00
b9a7a30919 heater handler wip 2021-01-28 14:55:21 +01:00
712b9c83cf Merge pull request 'Updated FSFW' (#14) from mueller/master into develop
Reviewed-on: eive/eive_obsw#14
2021-01-23 17:24:34 +01:00
0a36325371 heater wip 2021-01-23 17:22:40 +01:00
5d354f3526 improved cmake lists 2021-01-19 16:45:33 +01:00
1b44fe3840 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2021-01-19 16:35:57 +01:00
3345f08c31 updated cmakelists 2021-01-19 16:35:44 +01:00
d913fbb416 old approach gpio lib 2021-01-16 12:22:17 +01:00
d66ac9e4a6 bugfix 2021-01-14 12:26:12 +01:00
fa4e442eac updated fsfw, moved file 2021-01-14 12:23:31 +01:00
84c802baec important fsfw bugfix 2021-01-14 12:17:05 +01:00
5f59a2792f updated fsfwconfig files 2021-01-14 12:07:11 +01:00
7d32303f29 updated cproject f ile 2021-01-14 12:05:49 +01:00
f965b783f9 fsfw update 2021-01-14 12:03:01 +01:00
88959f2208 implemented api change 2021-01-14 11:37:32 +01:00
f6b13546bc fsfw update 2021-01-14 11:33:48 +01:00
df67887926 deprecated wiringPi 2021-01-14 10:52:41 +01:00
0f6395b460 added gpio sysfs if 2021-01-14 00:40:30 +01:00
9eaebd22c0 updated tmtc 2021-01-13 22:42:01 +01:00
50a214e6ff little fix in gs device handler class 2021-01-12 13:26:09 +01:00
677979c2c1 added second tmp1075 2021-01-12 11:17:36 +01:00
fd41c3b4db tmp1075handler and I2cComIF complete 2021-01-12 10:39:24 +01:00
adef6eb188 temperature reading successul, but i2c sometimes hanging up 2021-01-11 16:56:44 +01:00
c73c41b03a fixed merge conflicts 2021-01-08 10:05:36 +01:00
64c3aa5e9d tmp1075 handler, wip 2021-01-08 09:34:43 +01:00
35d6d47bd0 updated fsfw config 2021-01-07 20:41:33 +01:00
78d097e965 updated to new fsfw branch 2021-01-07 20:38:07 +01:00
d426699cc3 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2021-01-07 20:32:32 +01:00
f8f0226a13 submodule update 2021-01-07 20:32:15 +01:00
7eba60ba29 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2020-12-30 23:39:15 +01:00
700a7ec2e6 tmtc update 2020-12-30 23:39:05 +01:00
40238caee4 readme update 2020-12-30 16:20:07 +01:00
d387c1ce69 added project files 2020-12-30 14:36:02 +01:00
8d0b87524e updated readme 2020-12-30 14:34:25 +01:00
e216e03897 reamde update 2020-12-30 10:37:01 +01:00
58ab8996bf readme update 2020-12-30 10:22:52 +01:00
43e986de90 added readme and user manual 2020-12-30 10:10:15 +01:00
6687a913fe README update 2020-12-30 09:39:34 +01:00
78b17fdb45 typo 2020-12-29 22:29:02 +01:00
1ca24ae6e0 png capital 2020-12-29 22:24:38 +01:00
9a2b2dd167 one pic not showing,. 2020-12-29 22:23:12 +01:00
c4e57ec818 readme update 2020-12-29 22:21:39 +01:00
af43722ee8 updared readme, added scripts 2020-12-29 22:20:38 +01:00
db4e918649 cmake lists update 2020-12-29 18:12:05 +01:00
ac01d54804 Merge pull request 'Update' (#12) from mueller/master into develop
Reviewed-on: eive/eive_obsw#12
2020-12-29 18:11:11 +01:00
3a9c0f7c9a Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2020-12-29 18:07:03 +01:00
ffe22036c6 suppressed warning flags 2020-12-29 18:06:52 +01:00
8f6afda279 Merge pull request 'CMake update' (#11) from mueller/cmake-update into develop
Reviewed-on: eive/eive_obsw#11
2020-12-29 17:55:34 +01:00
d07294980a reamde update 2020-12-29 15:04:08 +01:00
6995d52a9a added launch config 2020-12-29 14:59:14 +01:00
9bedc302f4 added linux release launch config 2020-12-29 14:57:19 +01:00
326c595bbe deleted make luanch config 2020-12-29 14:55:10 +01:00
a8edb34931 some fixes, launch configs added 2020-12-29 14:53:34 +01:00
7afd80d0ab includes formal correction 2020-12-29 14:39:03 +01:00
3f41fc181c include fix 2020-12-29 14:37:39 +01:00
dd211f23cb added cmake launch config 2020-12-29 14:31:10 +01:00
bc5f340e2b renamed launch configs for clear distrinction 2020-12-29 14:29:38 +01:00
455ad12fec updated project files 2020-12-29 14:28:38 +01:00
df355652e0 restructured build system support 2020-12-29 14:21:52 +01:00
dd37efd34d fsfw points to eive/develop now 2020-12-29 14:14:11 +01:00
9a6fbbaff6 added cmake support for csp lib 2020-12-29 13:59:31 +01:00
96ea535242 Merge remote-tracking branch 'origin/develop' into mueller/master 2020-12-29 12:37:03 +01:00
e7f34185f4 Merge pull request 'meier/pcduhandler' (#10) from meier/pcduhandler into develop
Reviewed-on: eive/eive_obsw#10
2020-12-29 12:35:44 +01:00
6666ae0e3e small bugfix 2020-12-29 12:22:35 +01:00
33b48e97a3 fsfw update 2020-12-29 12:16:38 +01:00
fe9364550d fsfw points to devel now 2020-12-29 12:15:55 +01:00
d0114d53c2 correction in factoryx 2020-12-29 02:16:39 +01:00
d4c4c6dd40 project name corrected 2020-12-29 02:15:04 +01:00
9ee2e4e1da added q7s xcompile file 2020-12-29 01:40:47 +01:00
4c30deb6cb including taspbery pi bsp 2020-12-29 01:28:21 +01:00
be82cd472e added rpi support 2020-12-29 01:26:22 +01:00
e2d7905334 bugfix 2020-12-29 01:15:35 +01:00
c1e9604977 added cmake support 2020-12-29 01:09:59 +01:00
5fe0ea5fc9 Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/eive/eive_obsw into mueller/master 2020-12-28 23:54:16 +01:00
647126863c fixed merge conflict 2020-12-28 11:16:58 +01:00
2b09baad4f merged mueller/tmtc-dh-update 2020-12-28 11:14:08 +01:00
abf53527b3 Merge pull request 'Device Handler Updates' (#9) from mueller/tmtc-dh-update into develop
Reviewed-on: eive/eive_obsw#9
2020-12-28 11:09:08 +01:00
aa33d23563 added polling sequence table slot for PERFORM_OPERATION 2020-12-28 11:02:24 +01:00
d97f0aaed0 adapted GomspaceDeviceHandler to new DeviceHandlerBase 2020-12-28 09:49:50 +01:00
de433e06a1 now compiling 2020-12-27 17:31:38 +01:00
13a83a2f16 Merge branch 'hotfix/fsfwconfig' into mueller/master 2020-12-27 17:16:53 +01:00
4e90612d34 fix 2020-12-27 17:15:59 +01:00
c60457cf57 another fix 2020-12-27 17:14:26 +01:00
cb01bcd97d Merge branch 'hotfix/fsfwconfig' into meier/pcduhandler 2020-12-27 17:07:37 +01:00
9c42b40cc1 tmtc update 2020-12-27 17:04:15 +01:00
4737fc4f6e Merge remote-tracking branch 'origin/hotfix/fsfwconfig' into mueller/master 2020-12-27 17:01:57 +01:00
64972f1e43 more fixes 2020-12-27 17:00:38 +01:00
c3833c4a4c Merge branch 'hotfix/fsfwconfig' into meier/pcduhandler 2020-12-27 16:57:55 +01:00
3df7a6d23e another fix 2020-12-27 16:56:51 +01:00
86b36352dc Merge branch 'hotfix/fsfwconfig' into meier/pcduhandler 2020-12-27 16:48:34 +01:00
d359222b45 another fix 2020-12-27 16:46:01 +01:00
025337227c fsfwconfig fix 2020-12-27 16:45:37 +01:00
52a2973291 updated config 2020-12-27 16:29:49 +01:00
6dbafec3ad fixed merge conflict 2020-12-27 15:32:16 +01:00
14ae300363 Merge branch 'develop' into mueller/master 2020-12-27 15:31:01 +01:00
4636a809f4 tmtc p60dock 2020-12-27 15:27:16 +01:00
fdf72f2fb3 Merge pull request 'TMTC updated' (#7) from mueller/tmtc-update into develop
Reviewed-on: eive/eive_obsw#7
2020-12-27 15:22:45 +01:00
0a86fab520 valid fsfw now 2020-12-23 20:26:37 +01:00
8421c5de0d fsfw update 2020-12-23 20:20:22 +01:00
7e0c56edcb gyro handler finished 2020-12-23 20:17:39 +01:00
76a6db18ab started with l3dg20h definitions 2020-12-22 13:44:32 +01:00
2203b8ed53 started gyro handler, renamed 2020-12-22 13:41:01 +01:00
7aceb6a658 added top comment block 2020-12-22 13:36:10 +01:00
421ac0e1fe added top comment 2020-12-22 13:32:40 +01:00
e817a38f92 replaced last sent command with
getPendingCommand()
2020-12-22 00:36:39 +01:00
de0f8f5c41 added gps handler stub 2020-12-22 00:32:11 +01:00
88d357fe4d added gyro handler stub 2020-12-22 00:30:50 +01:00
f692993954 rm3100 finished, lis3 set normal datapool entries
invalid removed, will be replaced by default implementation
2020-12-22 00:24:19 +01:00
8ecd0ec551 rm3100 continued 2020-12-21 23:09:35 +01:00
24cf9a661f rm3100 continued 2020-12-21 19:52:00 +01:00
1e33f810cf type correction 2020-12-21 19:50:50 +01:00
1cf278e23e started rm3100 handler 2020-12-21 19:50:01 +01:00
bb1735d0fe updated project file 2020-12-21 18:15:27 +01:00
b0434a3d72 reparied arduino stuff 2020-12-21 18:14:03 +01:00
2372ddef78 makefile hosted update 2020-12-21 17:52:53 +01:00
042d014148 disabled LTO for host release build on windows 2020-12-21 17:32:51 +01:00
dce00e9b53 resolved merge conflict 2020-12-21 10:29:44 +01:00
f330650b55 cspcomif removed commented lines 2020-12-21 10:27:29 +01:00
f573d15830 p60dock, acu and pdu handler completed 2020-12-21 10:26:28 +01:00
c9fbd2c048 working pdu2handler 2020-12-20 17:35:03 +01:00
23fd408e08 issue with makefile 2020-12-20 13:31:44 +01:00
208fd889f7 added eclipse project and launch files 2020-12-17 19:50:11 +01:00
39ff3f6c9b deleted linux bsp arduino files 2020-12-17 19:47:21 +01:00
26ffc5a470 additional include for win compileation 2020-12-17 19:45:20 +01:00
2450d2240e updated gitignore file 2020-12-17 19:43:20 +01:00
4e11eafd28 c++ include used 2020-12-17 19:38:26 +01:00
688ada173e tmtc update 2020-12-17 19:38:09 +01:00
c74405d4a8 tmtc update 2020-12-17 18:43:27 +01:00
90c06122f2 tmtc update 2020-12-17 18:16:49 +01:00
20fffd8b48 tmtc points to new commit 2020-12-17 18:11:40 +01:00
8d99dd6021 tmtc update 2020-12-17 18:04:33 +01:00
2881d4e7b2 tmtc update 2020-12-17 18:04:04 +01:00
a59432f41f added new tmtc submodule 2020-12-17 17:47:40 +01:00
b2a460d77f removed tmtc submodule, will be replaced 2020-12-17 17:46:11 +01:00
b19cfbfc2b tmtc update 2020-12-17 17:45:42 +01:00
0ebd9e2c43 fsfw update 2020-12-17 17:44:54 +01:00
a9f2c98f8d tmtc p60dock 2020-12-17 15:49:11 +01:00
d69e79ce07 Merge branch 'master' into meier_eiveobsw
update meier_eiveobsw
2020-12-17 14:28:22 +01:00
009850273b added tmtc 2020-12-17 14:27:49 +01:00
5f46e4ab6a updated tmtc 2020-12-17 14:19:05 +01:00
5fac6424ca p60 dock handler completed 2020-12-17 13:26:00 +01:00
32bd57d6d1 ping test 2020-12-16 15:17:10 +01:00
f022504fe4 fsfw update 2020-12-16 14:05:38 +01:00
380543756d successful change of endian swapping in p60dock param set 2020-12-16 11:02:49 +01:00
f778292d8e working parameter getting and setting of p60dock 2020-12-16 10:56:32 +01:00
e0c57f5d5d updated obsw config 2020-12-14 22:52:53 +01:00
48386a8e3f stuff stored in local poo lnow 2020-12-14 22:50:15 +01:00
29c07461b3 Merge branch 'mueller/master' into develop 2020-12-14 22:30:35 +01:00
ccf9770172 formatting 2020-12-14 22:23:28 +01:00
20911a15a2 again, indentation.. 2020-12-14 22:21:47 +01:00
512cf58579 indentation 2020-12-14 22:18:25 +01:00
7db8914c32 tmtc update 2020-12-14 22:15:07 +01:00
45283131e3 Merge branch 'master' into develop 2020-12-14 22:12:42 +01:00
e539d63293 updated submodules 2020-12-14 22:09:18 +01:00
fd75183590 hosted build working again 2020-12-14 22:03:57 +01:00
9b990f86fd fsfw update 2020-12-14 21:57:52 +01:00
bdc506a54c some fixes 2020-12-14 13:03:47 +01:00
c88bc6508d successful temperature reading 2020-12-14 09:46:59 +01:00
551a8f021b wip CspComIF 2020-12-14 08:42:48 +01:00
c502ee1172 wip CspComIF 2020-12-14 08:42:21 +01:00
fa0cdcf399 read module config and read hk working 2020-12-10 10:01:45 +01:00
b8dd7b74cd timeout error in hk read 2020-12-09 12:24:34 +01:00
ed77c97432 read module cfg and read hk from p60 dock, intermediate state 2020-12-09 12:00:24 +01:00
a195f63acb some changes for P60Dock cookie 2020-12-05 14:52:18 +01:00
47b6485e29 p60dock read config table compiling 2020-12-04 20:08:58 +01:00
2f4421b904 parts of p60dock handler 2020-12-04 14:14:08 +01:00
12d5db0ec0 device definition adaptions taken over 2020-12-03 12:57:44 +01:00
7edaba4d5d taken over source lis3mdl device 2020-12-03 12:49:14 +01:00
c68566a1e1 read temperature test 2020-11-28 13:41:30 +01:00
338857efc3 p60 dock test task get parameters incomplete 2020-11-27 12:07:33 +01:00
a8e9a6f0de extended p60 dock test task 2020-11-26 18:13:20 +01:00
17fc4b0de1 save failed integration state 2020-11-26 10:24:23 +01:00
77970418d8 resolved merge conflicts 2020-11-25 16:17:16 +01:00
81ae5ea167 bring up can, readme 2020-11-25 09:19:51 +01:00
9d092edda4 pdock 60 test task 2020-11-23 11:42:22 +01:00
6c23b00c22 failed approach 2020-11-19 18:24:03 +01:00
461 changed files with 45188 additions and 2499 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
/build*
generators
misc
tmtc
doc

16
.gitignore vendored
View File

@ -1,9 +1,19 @@
_obj
_bin
_dep
/build*
Debug
Debug*
Release
Release*
.settings
.metadata
.project
.cproject
__pycache__
.idea
!misc/eclipse/**/.cproject
!misc/eclipse/**/.project
generators/*.db

17
.gitmodules vendored
View File

@ -1,12 +1,21 @@
[submodule "etl"]
path = etl
path = thirdparty/etl
url = https://github.com/ETLCPP/etl.git
[submodule "tmtc"]
path = tmtc
url = https://git.ksat-stuttgart.de/Robin.Mueller/tmtc.git
[submodule "arduino"]
path = arduino
url = https://egit.irs.uni-stuttgart.de/eive/eive_arduino_interface.git
[submodule "fsfw"]
path = fsfw
url = https://egit.irs.uni-stuttgart.de/eive/fsfw.git
[submodule "tmtc"]
path = tmtc
url = https://egit.irs.uni-stuttgart.de/eive/eive-tmtc.git
[submodule "thirdparty/lwgps"]
path = thirdparty/lwgps
url = https://github.com/rmspacefish/lwgps.git
[submodule "fsfw_hal"]
path = fsfw_hal
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-hal.git
[submodule "generators/fsfwgen"]
path = generators/fsfwgen
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-generators.git

259
CMakeLists.txt Normal file
View File

@ -0,0 +1,259 @@
################################################################################
# CMake support for the EIVE OBSW
#
# Developed in an effort to replace Make with a modern build system.
#
# Author: R. Mueller
################################################################################
################################################################################
# Pre-Project preparation
################################################################################
cmake_minimum_required(VERSION 3.13)
# set(CMAKE_VERBOSE TRUE)
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(TGT_BSP MATCHES "arm/q7s")
option(Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
endif()
option(ADD_ETL_LIB "Add ETL library" ON)
if(NOT OS_FSFW)
set(OS_FSFW host CACHE STRING "OS for the FSFW.")
endif()
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
option(LINUX_CROSS_COMPILE ON)
endif()
# Perform steps like loading toolchain files where applicable.
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config()
# Project Name
project(eive_obsw ASM C CXX)
################################################################################
# Pre-Sources preparation
################################################################################
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set names and variables
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
set(LIB_FSFW_NAME fsfw)
set(LIB_ETL_NAME etl)
set(LIB_CSP_NAME libcsp)
set(LIB_FSFW_HAL_NAME fsfw_hal)
set(LIB_LWGPS_NAME lwgps)
set(THIRD_PARTY_FOLDER thirdparty)
set(LIB_CXX_FS -lstdc++fs)
# Set path names
set(FSFW_PATH fsfw)
set(MISSION_PATH mission)
set(TEST_PATH test/testtasks)
set(LINUX_PATH linux)
set(COMMON_PATH common)
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
set(FSFW_HAL_LIB_PATH fsfw_hal)
set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp)
set(ETL_LIB_PATH ${THIRD_PARTY_FOLDER}/etl)
set(LWGPS_LIB_PATH ${THIRD_PARTY_FOLDER}/lwgps)
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
set(ADD_LINUX_FILES False)
# Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc.
include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake)
pre_source_hw_os_config()
if(TGT_BSP)
if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi"
OR ${TGT_BSP} MATCHES "arm/beagleboneblack"
)
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT Q7S_SIMPLE_MODE)
set(ADD_LINUX_FILES TRUE)
set(ADD_CSP_LIB TRUE)
set(FSFW_HAL_ADD_LINUX ON)
endif()
endif()
if(${TGT_BSP} MATCHES "arm/raspberrypi")
add_definitions(-DRASPBERRY_PI)
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
endif()
if(${TGT_BSP} MATCHES "arm/beagleboneblack")
add_definitions(-DBEAGLEBONEBLACK)
endif()
if(${TGT_BSP} MATCHES "arm/q7s")
add_definitions(-DXIPHOS_Q7S)
endif()
else()
# Required by FSFW library
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
endif()
# Configuration files
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
if(${TGT_BSP} MATCHES "arm/q7s")
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
elseif(${TGT_BSP} MATCHES "arm/raspberrypi")
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
endif()
# Set common config path for FSFW
set(FSFW_ADDITIONAL_INC_PATHS
"${COMMON_PATH}/config"
${CMAKE_CURRENT_BINARY_DIR}
)
# Set for lwgps library
set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
################################################################################
# Executable and Sources
################################################################################
# Add executable
add_executable(${TARGET_NAME})
if(ADD_CSP_LIB)
add_subdirectory(${CSP_LIB_PATH})
endif()
if(ADD_ETL_LIB)
add_subdirectory(${ETL_LIB_PATH})
endif()
if(ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${BSP_PATH})
add_subdirectory(${COMMON_PATH})
if(NOT Q7S_SIMPLE_MODE)
add_subdirectory(${LWGPS_LIB_PATH})
add_subdirectory(${FSFW_PATH})
add_subdirectory(${MISSION_PATH})
add_subdirectory(${TEST_PATH})
add_subdirectory(${FSFW_HAL_LIB_PATH})
endif()
################################################################################
# Post-Sources preparation
################################################################################
set_property(CACHE OS_FSFW PROPERTY STRINGS host linux)
if(NOT Q7S_SIMPLE_MODE)
# Add libraries for all sources.
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_FSFW_NAME}
${LIB_OS_NAME}
${LIB_LWGPS_NAME}
${LIB_FSFW_HAL_NAME}
${LIB_CXX_FS}
)
endif()
if(ADD_ETL_LIB)
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_ETL_NAME}
)
endif()
if(ADD_CSP_LIB)
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_CSP_NAME}
)
endif()
# Add include paths for all sources.
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR}
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS
-Wall
-Wextra
-Wimplicit-fallthrough=1
-Wno-unused-parameter
-Wno-psabi
)
# Remove unused sections.
target_compile_options(${TARGET_NAME} PRIVATE
"-ffunction-sections"
"-fdata-sections"
)
# Removed unused sections.
target_link_options(${TARGET_NAME} PRIVATE
"-Wl,--gc-sections"
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILER_FLAGS "/permissive-")
endif()
if(CMAKE_VERBOSE)
message(STATUS "Warning flags: ${WARNING_FLAGS}")
endif()
# Compile options for all sources.
target_compile_options(${TARGET_NAME} PRIVATE
${WARNING_FLAGS}
)
if(${CMAKE_CROSSCOMPILING})
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
post_source_hw_os_config()
endif()
if(NOT CMAKE_SIZE)
set(CMAKE_SIZE size)
if(WIN32)
set(FILE_SUFFIX ".exe")
endif()
endif()
if(TGT_BSP)
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
else()
set(TARGET_STRING "Target BSP: Hosted")
endif()
string(CONCAT POST_BUILD_COMMENT
"Build directory: ${CMAKE_BINARY_DIR}\n"
"Target OSAL: ${OS_FSFW}\n"
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
"${TARGET_STRING}"
)
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
COMMENT ${POST_BUILD_COMMENT}
)
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
set_build_type()

828
README.md
View File

@ -1,67 +1,237 @@
# <a id="top"></a> <a name="linux"></a> EIVE On-Board Software
<a id="top"></a> <a name="linux"></a> EIVE On-Board Software
======
## General information
# General information
Target systems:
* OBC
* Xiphos Q7S
* Based on Zynq-7020 SoC (xc7z020clg484-2)
* Dual-core ARM Cortex-A9
* 766 MHz
* Artix-7 FPGA (85K pogrammable logic cells)
* Datasheet at https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S&fileid=340648
* Also a lot of informatin about the Q7S can be found on the xiphos trac platform: https://trac.xiphos.com/trac/eive-q7/wiki/Q7RevB
* Linux OS
* Built with Yocto 2.5
* Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git
* OBC with Linux OS
* Xiphos Q7S
* Based on Zynq-7020 SoC (xc7z020clg484-2)
* Dual-core ARM Cortex-A9
* 766 MHz
* Artix-7 FPGA (85K pogrammable logic cells)
* Datasheet at https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S&fileid=340648
* Also a lot of information about the Q7S can be found on
the [Xiphos Traq Platform](https://trac2.xiphos.ca/eive-q7). Press on index to find all
relevant pages.
* Linux OS built with Yocto 2.5
* Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git . EIVE version can be found
[here](https://github.com/spacefisch/linux-xlnx) . Pre-compiled files can be
found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/q7s-linux-components&fileid=777299).
* Q7S base project can be found [here](https://egit.irs.uni-stuttgart.de/eive/q7s-base)
* Minimal base project files can be found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/xiphos-q7s-sdk&fileid=510908)
* Host System
* Generic software components which are not dependant on hardware can also
be run. All host code is contained in the hosted folder
be run on a host system. All host code is contained in the `bsp_hosted` folder
* Tested for Linux (Ubuntu 20.04) and Windows 10
* Raspberry Pi
* EIVE OBC can be built for Raspberry Pi as well (either directly on Raspberry Pi or by installing a cross compiler)
The steps in the primary README are related to the main OBC target Q7S.
The CMake build system can be used to generate build systems as well (see helper scripts in `cmake/scripts`:
- Linux (Raspberry Pi): See special section below.
- Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator.
- Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2.
# Setting up development environment
## Installing Vivado the the Xilinx development tools
It's also possible to perform debugging with a normal Eclipse installation by installing
the TCF plugin and downloading the cross-compiler as specified in the section below. However,
if you want to generate the `*.xdi` files necessary to update the firmware, you need to
installed Vivado with the SDK core tools.
## Setting up development environment
* Install Vivado 2018.2 and Xilinx SDK from https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html.
Install the Vivado Design Suite - HLx Editions - 2018.2 Full Product Installation instead of the updates. It is recommended to use the installer
Install the Vivado Design Suite - HLx Editions - 2018.2 Full Product Installation instead of
the updates. It is recommended to use the installer.
* Install settings. In the Devices selection, it is sufficient to pick SoC &rarr; Zynq-7000: <br>
<img src="./doc/img/xilinx-install.PNG" width="50%"> <br>
* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf
* Add path of linux cross-compiler to environment variables SDK\2018.2\gnu\aarch32\nt\gcc-arm-linux-gnueabi\bin
* Install make (only on windows, SDK on Linux can use the make installed with the SDK)
### Installing make on Windows
1. Install NodeJS LTS
2. Install xpm
```sh
npm install --global xpm
```
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/vivado-edition.png" width="50%"> <br>
3. Install Windows build tools (after installation also linux commands like mkdir can be used from windows)
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/mueller/master/doc/img/vivado-hl-design.png" width="50%"> <br>
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/mueller/master/doc/img/xilinx-install.PNG" width="50%"> <br>
* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf .
Installation was tested on Windows and Ubuntu 21.04.
* Add path of linux cross-compiler to permanent environment variables (`.bashrc` file in Linux):
`<XilinxInstallation>\SDK\2018.2\gnu\aarch32\nt\gcc-arm-linux-gnueabi\bin`
or set up path each time before debugging.
### Installing on Linux - Device List Issue
When installing on Ubuntu, the installer might get stuck at the `Generating installed device list`
step. When this happens, you can kill the installation process (might be necessara to kill a process
twice) and generate this list manually with the following commands, according to
[this forum entry](https://forums.xilinx.com/t5/Installation-and-Licensing/Vivado-2018-3-Final-Processing-hangs-at-Generating-installed/m-p/972114#M25861).
1. Install the following library
```sh
sudo apt install libncurses5
```
2. ```sh
sudo <installRoot>/Vivado/2018.2/bin/vivado -nolog -nojournal -mode batch -source
<installRoot>/.xinstall/Vivado_2018.2/scripts/xlpartinfo.tcl -tclargs
<installRoot>/Vivado/2018.2/data/parts/installed_devices.txt
```
For Linux, you can also download a more recent version of the
[Linaro 8.3.0 cross-compiler](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads)
from [here](https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz?revision=e09a1c45-0ed3-4a8e-b06b-db3978fd8d56&la=en&hash=93ED4444B8B3A812B893373B490B90BBB28FD2E3)
## Installing toolchain without Vivado
You can download the toolchains for Windows and Linux
[from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files?dir=/EIVE_IRS/Software/tools&fileid=831898).
If `wget` is available (e.g. MinGW64), you can use the following command to download the
toolchain for Windows
```sh
xpm install --global @xpack-dev-tools/windows-build-tools@latest
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/rfoaistRd67yBbH/download/gcc-arm-linux-gnueabi-win.zip
```
## Building the software
or the following command for Linux (could be useful for CI/CD)
```sh
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/2Fp2ag6NGnbtAsK/download/gcc-arm-linux-gnueabi.tar.gz
```
## Installing CMake and MSYS2 on Windows
1. Install [MSYS2](https://www.msys2.org/) and [CMake](https://cmake.org/download/) first.
2. Open the MinGW64 console. It is recommended to set up aliases in `.bashrc` to navigate to the
software repository quickly
3. Run the following commands in MinGW64
```sh
pacman -Syu
```
It is recommended to install the full base development toolchain
```sh
pacman -S base-devel
```
It is also possible to only install required packages
```sh
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-make mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb python3
```
## Installing CMake on Linux
1. Run the following command
```sh
sudo apt-get install cmake
````
## Getting the Q7S system root
It is necessary to copy the Q7S system root to your local development machine for libraries
like `libgpio`. You can find the system root for the Q7S, the Raspberry Pi and the
Beagle Bone Black for download here
[here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs&fileid=831849).
Download it and unzip it somewhere in the Xilinx installation folder.
You can use the following command if `wget` can be used or for CI/CD:
```
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
```
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
# Building the software with CMake
When using Windows, run theses steps in MSYS2.
1. Clone the repository with
```sh
git clone https://egit.irs.uni-stuttgart.de/eive/eive_obsw.git
```
```sh
git clone https://egit.irs.uni-stuttgart.de/eive/eive_obsw.git
```
2. Update all the submodules
```sh
git submodule init
git submodule sync
git submodule update
```
3. Open Xilinx SDK 2018.2
4. Import project
```sh
git submodule init
git submodule sync
git submodule update
```
3. Ensure that the cross-compiler is working with `arm-linux-gnueabihf-gcc --version`.
It is recommended to run the shell script `win_path_helper_xilinx_tools.sh` in `cmake/scripts/Q7S`
or to set up the [PATH and the CROSS_COMPILE variable permanently](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path)
in the `.profile` file.
4. Run the CMake configuration to create the build system in a `build-Debug-Q7S` folder.
Add `-G "MinGW Makefiles` in MinGW64 on Windows.
```sh
mkdir build-Debug-Q7S && cd build-Debug-Q7S
cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DOS_FSFW=linux ..
cmake --build . -j
```
You can also use provided shell scripts to perform these commands
```sh
cd cmake/scripts/Q7S
./make_debug_cfg.sh
cd ../../..
```
This will invoke a Python script which in turn invokes CMake with the correct
arguments to configure CMake for Q7S cross-compilation.
You can build the hosted variant of the OBSW by replacing `-DOS_FSFW=linux` with
`-DOS_FSFW=host`. There are also different values for `-DTGT_BSP` to build for the Raspberry Pi
or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`.
5. Build the software with
```sh
cd Debug
cmake --build . -j
```
## Setting up default Eclipse for Q7S projects - TCF agent
The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debugging on the Q7S.
1. Install the TCF agent plugin in Eclipse from the [releases](https://www.eclipse.org/tcf/downloads.php). Go to Help &rarr; Install New Software and use the download page, for example https://download.eclipse.org/tools/tcf/releases/1.6/1.6.2/ to search for the plugin and install it.
2. Go to Window &rarr; Perspective &rarr; Open Perspective and open the **Target Explorer Perspective**.
Here, the Q7S should show up if the local port forwarding was set up as explained previously. Please note that you have to connect to `localhost` and port `1534` with port forwaring set up.
3. A launch configuration was provided, but it might be necessary to adapt it for your own needs. Alternatively:
- Create a new **TCF Remote Application** by pressing the cogs button at the top or going to Run &rarr; Debug Configurations &rarr; Remote Application and creating a new one there.
- Set up the correct image in the main tab (it might be necessary to send the image to the Q7S manually once) and file transfer properties
- It is also recommended to link the correct Eclipse project.
After that, comfortable remote debugging should be possible with the Debug button.
A build configuration and a shell helper script has been provided to set up the path variables and
build the Q7S binary on Windows, but a launch configuration needs to be newly created because the
IP address and path settings differ from machine to machine.
## Building in Xilinx SDK 2018.2
1. Open Xilinx SDK 2018.2
2. Import project
* File &rarr; Import &rarr; C/C++ &rarr; Existing Code as Makefile Project
5. Set build command. Replace \<target\> with either debug or release.
3. Set build command. Replace \<target\> with either debug or release.
* When on Linux right click project &rarr; Properties &rarr; C/C++ Build &rarr; Set build command to `make <target> -j`
* -j causes the compiler to use all available cores
* The target is used to either compile the debug or the optimized release build.
@ -70,29 +240,278 @@ git submodule update
* Target name: all
* Uncheck "Same as the target name"
* Uncheck "Use builder settings"
* As build command type: `make -j <target> WINDOWS=1`
6. Run build command by double clicking the created target or by right clicking
* As build command type: `cmake --build .`
* In the Behaviour tab, you can enable build acceleration
4. Run build command by double clicking the created target or by right clicking
the project folder and selecting Build Project.
## Debugging the software (when workstation is directly conncected to Q7S)
## TCF-Agent
1. On reboot, some steps have to be taken on the Q7S. Set static IP address and netmask
```sh
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
```
2. `tcfagent` application should run automatically but this can be checked with
```sh
systemctl status tcfagent
```
3. If the agent is not running, check whether `agent` is located inside `usr/bin`.
You can run it manually there. To perform auto-start on boot, have a look at the start-up
application section.
# Debugging the software via Flatsat PC
Open SSH connection to flatsat PC:
```sh
ssh eive@flatsat.eive.absatvirt.lw
```
or
```sh
ssh eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
```
or
```sh
ssh eive@192.168.199.227
```
If the static IP address of the Q7S has already been set,
you can access it with ssh
```sh
ssh root@192.168.133.10
```
If this has not been done yet, you can access the serial
console of the Q7S like this to set it
```sh
picocom -b 115200 /dev/ttyUSB0
```
If the serial port is blocked for some reason, you can kill
the process using it with `q7s_kill`.
You can use `AltGr` + `X` to exit the picocom session.
To debug an application, first make sure a static IP address is assigned to the Q7S. Run ifconfig
on the Q7S serial console.
```sh
ifconfig
```
Set IP address and netmask with
```sh
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
```
To launch application from Xilinx SDK setup port fowarding on the development machine
(not on the flatsat!)
```sh
ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 -t bash
```
This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address
192.168.133.10.
This needs to be done every time, so it is recommended to create an alias to do this quickly.
Note: When now setting up a debug session in the Xilinx SDK or Eclipse, the host must be set
to localhost instead of the IP address of the Q7S.
# Transfering files via SCP
To transfer files from the local machine to the Q7S, use port forwarding
```sh
ssh -L 1535:192.168.133.10:22 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
```
An `example` file can be copied like this
```sh
scp -P 1535 example root@localhost:/tmp
```
Copying a file from Q7S to flatsat PC
````
scp -P 22 root@192.168.133.10:/tmp/kernel-config /tmp
````
From a windows machine files can be copied with putty tools (note: use IPv4 address)
````
pscp -scp -P 22 eive@192.168.199.227:</directory-to-example-file/>/example-file </windows-machine-path/>
````
# Launching an application at start-up
Load the root partiton from the flash memory (there are to nor-flash memories and each flash holds
two xdi images). Note: It is not possible to modify the currently loaded root partition, e.g.
creating directories. To do this, the parition needs to be mounted.
1. Disable write protection of the desired root partition
```sh
writeprotect 0 0 0 # unlocks nominal image on nor-flash 0
```
2. Mount the root partition
```sh
xsc_mount_copy 0 0 # Mounts the nominal image from nor-flash 0
```
The mounted partition will be located inside the `/tmp` folder
3. Copy the executable to `/usr/bin`
4. Make sure the permissions to execute the application are set
```sh
chmod +x application
```
5. Create systemd service in /lib/systemd/system. The following shows an example service.
```sh
cat > example.service
[Unit]
Description=Example Service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/application
[Install]
WantedBy=multi-user.target
```
6. Enable the service. This is normally done with systemctl enable. However, this is not possible
when the service is created for a mounted root partition. Therefore create a symlink as follows.
```sh
ln -s '/tmp/the-mounted-xdi-image/lib/systemd/system/example.service' '/tmp/the-mounted-xdi-image/etc/systemd/system/multi-user.target.wants/example.service'
```
7. The modified root partition is written back when the partion is locked again.
```sh
writeprotect 0 0 1
```
8. Now verify the application start by booting from the modified image
```sh
xsc_boot_copy 0 0
````
9. After booting verify if the service is running
```sh
systemctl status example
```
More detailed information about the used q7s commands can be found in the Q7S user manual.
## Setting up UNIX environment for real-time functionalities
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
used by the UNIX pthread module are restricted, which will lead to permission errors when creating
these tasks and configuring real-time properites like scheduling priorities.
To solve this issues, try following steps:
1. Edit the /etc/security/limits.conf
file and add following lines at the end:
```sh
<username> hard rtprio 99
<username> soft rtprio 99
```
The soft limit can also be set in the console with `ulimit -Sr` if the hard
limit has been increased, but it is recommended to add it to the file as well for convenience.
If adding the second line is not desired for security reasons,
the soft limit needs to be set for each session. If using an IDE like eclipse
in that case, the IDE needs to be started from the console after setting
the soft limit higher there. After adding the two lines to the file,
the computer needs to be restarted.
It is also recommended to perform the following change so that the unlockRealtime
script does not need to be run anymore each time. The following steps
raise the maximum allowed message queue length to a higher number permanently, which is
required for some framework components. The recommended values for the new message
length is 130.
2. Edit the /etc/sysctl.conf file
```sh
sudo nano /etc/sysctl.conf
```
Append at end:
```sh
fs/mqueue/msg_max = <newMsgMaxLen>
```
Apply changes with:
```sh
sudo sysctl -p
```
A possible solution which only persists for the current session is
```sh
echo <newMsgMax> | sudo tee /proc/sys/fs/mqueue/msg_max
```
# PCDU
Connect to serial console of P60 Dock
````
picocom -b 500000 /dev/ttyUSBx
````
General information
````
cmp ident
````
List parameter table:
x values: 1,2 or 4
````
param list x
````
Table 4 lists HK parameters
Changing parameters
First switch to table where parameter shall be changed (here table id is 1)
````
p60-dock # param mem 1
p60-dock # param set out_en[0] 1
p60-dock # param get out_en[0]
GET out_en[0] = 1
````
# Debugging the software (when workstation is directly conncected to Q7S)
1. Assign static IP address to Q7S
* Open serial console of Q7S (Accessible via the micro-USB of the PIM, see also Q7S user maunal chapter 10.3)
* Open serial console of Q7S (Accessible via the micro-USB of the PIM, see also Q7S user
manual chapter 10.3)
* Baudrate 115200
* Login to Q7S:
* user: root
* pw: root
* Set IP address and netmask with
```sh
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
```
2. Connect Q7S to workstation via ethernet
3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S
* When IP address is set to 192.168.133.10 and the netmask is 255.255.255.0, an example IP address for the workstation
is 192.168.133.2
4. Run tcf-agent on Q7S
* Tcf-agent is not yet integrated in the rootfs of the Q7S. Therefore build tcf-agent manually
```sh
@ -128,95 +547,137 @@ git submodule update
11. Test connection (This ensures the TCF Agent is running on the Q7S)
12. Select Application tab
* Project Name: eive_obsw
* Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel)
* Remote File Path: /tmp/eive_obsw.elf
* Local File Path: Path to eiveobsw-linux.elf (in `_bin\linux\devel`)
* Remote File Path: `/tmp/eive_obsw.elf`
# Running cppcheck on the Software
Static code analysis can be useful to find bugs.
`cppcheck` can be used for this purpose. On Windows you can use MinGW64 to do this.
## Debugging the software via Flatsat PC
Open SSH connection to flatsat PC:
````
ssh eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
````
To access the console of the Q7S run the following:
```sh
picocom -b 115200 /dev/ttyUSB0
pacman -S mingw-w64-x86_64-cppcheck
```
To debug an application, first make sure a static IP address is assigned to the Q7S. Run ifconfig on the Q7S serial console.
````
ifconfig
````
Set IP address and netmask with
````
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
````
To launch application from Xilinx SDK setup port fowarding on the localhost.
````
ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
````
This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address 192.168.133.10.
Note: When now setting up a debug session in the Xilinx SDK, the host must be set to localhost instead of the IP address
of the Q7S.
On Ubuntu, install with
```sh
sudo apt-get install cppcheck
```
## Launching an application after boot
Load the root partiton from the flash memory (there are to nor-flash memories and each flash holds two xdi images).
Note: It is not possible to modify the current loaded root partition.
1. Disable write protection of the desired root partition
````
writeprotect 0 0 0 # unlocks nominal image on nor-flash 0
````
2. Mount the root partition
````
xsc_mount_copy 0 0 # Mounts the nominal image from nor-flash 0
````
3. Copy the executable to /bin/usr
4. Make sure the permissions to execute the application are set
````
chmod +x application
````
5. Create systemd service in /lib/systemd/system. The following shows an example service.
````
cat > example.service
[Unit]
Description=Example Service
StartLimitIntervalSec=0
You can use the Eclipse integration or you can perform the scanning manually from the command line.
CMake will be used for this.
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/application
Run the CMake build generation commands specified above but supply
`-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to the build generation. Invoking the build command will
generate a `compile_commands.json` file which can be used by cppcheck.
[Install]
WantedBy=multi-user.target
````
6. Enable the service. This is normally done with systemctl enable. However, this is not possible when the service is
created for a mounted root partition. Therefore create a symlink as follows.
````
ln -s '/tmp/the-mounted-xdi-image/lib/systemd/system/example.service' '/tmp/the-mounted-xdi-image/etc/systemd/system/multi-user.target.wants/example.service'
````
7. The modified root partition is written back when the partion is locked again.
````
writeprotect 0 0 1
````
8. Now verify the application start by booting from the modified image
````
xsc_boot_copy 0 0
````
9. After booting verify if the service is running
````
systemctl status example
````
More detailed information about the used q7s commands can be found in the Q7S user manual.
```sh
cppcheck --project=compile_commands.json --xml 2> report.xml
```
### Bringing up CAN
Finally, you can convert the generated `.xml` file to HTML with the following command
```sh
cppcheck-htmlreport --file=report.xml --report-dir=cppcheck --source-dir=..
```
# Special notes on Eclipse
When using Eclipse, there are two special build variables in the project properties
&rarr; C/C++ Build &rarr; Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set
the sysroot path in those variables to get any additional includes like `gpiod.h` in the
Eclipse indexer.
# Q7S Utilities and Troubleshooting
## pa3tool Host Tool
The `pa3tool` is a host tool to interface with the ProASIC3 on the Q7S board. It was
installed on the clean room PC but it can also be found
[on the Traq platform](https://trac2.xiphos.ca/manual/attachment/wiki/WikiStart/libpa3-1.3.4.tar.gz).
For more information, see Q7S datasheet.
## Creating files with cat and echo
The only folder which can be written in the root filesystem is the `tmp` folder.
You can create a simple file with initial content with `echo`
```sh
echo "Hallo Welt" > /tmp/test.txt
cat /tmp/test.txt
```
For more useful combinations, see this [link](https://www.freecodecamp.org/news/the-cat-command-in-linux-how-to-create-a-text-file-with-cat-or-touch/).
## Using `system` when debugging
Please note that when using a `system` call in C++/C code and debugging, a new thread will be
spawned which will appear on the left in Eclipse or Xilinx SDK as a `sh` program.
The debugger might attach to this child process automatically, depending on debugger configuration,
and the process needs to be selected and continued/started manually. You can enable or disable
this behaviour by selecting or deselecting the `Attach Process Children` option in the Remote
Application Configuration for the TCF plugin like shown in the following picture
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/ProcessSettings.png" width="50%"> <br>
## Libgpiod
Detect all gpio device files:
````
gpiodetect
````
Get info about a specific gpio group:
````
gpioinfo <name of gpio group>
````
The following sets the gpio 18 from gpio group gpiochip7 to high level.
````
gpioset gpiochip7 18=1
````
Setting the gpio to low.
````
gpioset gpiochip7 18=0
````
Show options for setting gpios.
````
gpioset -h
````
To get the state of a gpio:
````
gpioget <gpiogroup> <offset>
````
Example to get state:
gpioget gpiochip7 14
Both the MIOs and EMIOs can be accessed via the zynq_gpio instance which
comprises 118 pins (54 MIOs and 64 EMIOs).
## Xilinx UARTLIE
Get info about ttyUL* devices
````
cat /proc/tty/driver
````
## I2C
Getting information about I2C device
````
ls /sys/class/i2c-dev/i2c-0/device/device/driver
````
This shows the memory mapping of /dev/i2c-0
## CAN
```sh
ip link set can0 down
ip link set can0 type can loopback off
ip link set can0 up type can bitrate 1000000
````
```
Following command sends 8 bytes to device with id 99 (for petalinux)
````
cansend can0 -i99 99 88 77 11 33 11 22 99
@ -234,77 +695,57 @@ Reading data from CAN:
candump can0
````
## Setting up UNIX environment for real-time functionalities
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
used by the UNIX pthread module are restricted, which will lead to permission errors when creating these tasks
and configuring real-time properites like scheduling priorities.
## Useful Q7S Linux Commands
To solve this issues, try following steps:
1. Edit the /etc/security/limits.conf
file and add following lines at the end:
```sh
<username> hard rtprio 99
<username> soft rtprio 99
```
The soft limit can also be set in the console with `ulimit -Sr` if the hard
limit has been increased, but it is recommended to add it to the file as well for convenience.
If adding the second line is not desired for security reasons,
the soft limit needs to be set for each session. If using an IDE like eclipse
in that case, the IDE needs to be started from the console after setting
the soft limit higher there. After adding the two lines to the file,
the computer needs to be restarted.
It is also recommended to perform the following change so that the unlockRealtime
script does not need to be run anymore each time. The following steps
raise the maximum allowed message queue length to a higher number permanently, which is
required for some framework components. The recommended values for the new message
length is 130.
2. Edit the /etc/sysctl.conf file
```sh
sudo nano /etc/sysctl.conf
```
Append at end:
```sh
fs/mqueue/msg_max = <newMsgMaxLen>
```
Apply changes with:
```sh
sudo sysctl -p
```
A possible solution which only persists for the current session is
```sh
echo <newMsgMax> | sudo tee /proc/sys/fs/mqueue/msg_max
```
or running the `unlockRealtime` script.
3. Run the shell script inside the linux folder
```sh
./unlockRealtime
```
This script executes the `sudo setcap 'cap_sys_nice=eip' \<application\>`
command on the binaries, increases the soft real time limit of the current
session and increases the maximum number of message queues by setting
`/proc/sys/fs/mqueue/msg_max`.
All changes are only applied for the current session (read 2. and 3. for
a permanent solution). If running the script before executing the binary does
not help or an warning is issue that the soft real time value is invalid,
the hard real-time limit of the system might not be high enough (see step 1).
## Building and running the software on a host system
The host build can be built with following command
Display currently running image:
```sh
make -f Makefile-Hosted all -j
xsc_boot_copy
```
If compiling on Windows, it is recommended to supply `WINDOWS=1` .
A release build can be built by using the `mission` target.
Rebooting currently running image:
## Flight Software Framework (FSFW)
```sh
xsc_boot_copy -r
```
## Preparation of a fresh rootfs and SD card
This section summarizes important changes between a fresh rootfs and the current
EIVE implementation
### rootfs
- Mount point `/mnt/sd0` created for SD card 0. Created with `mkdir`
- Mount point `/mnt/sd1` created for SD card 1. Created with `mkdir`
- Folder `scripts` in `/home/root` folder.
- `scripts` folder currently contains `update_main_components.sh` script
### SD Cards
- Folder `bin` for binaries, for example the OBSW
- Folder `misc` for miscellaneous files
- Folder `tc` for telecommands
- Folder `tm` for telemetry
- Folder `xdi` for XDI components (e.g. for firmware or device tree updates)
# Running the EIVE OBSW on a Raspberry Pi
Special section for running the EIVE OBSW on the Raspberry Pi.
The Raspberry Pi build uses the `bsp_rpi` BSP folder, and a very similar cross-compiler.
For running the software on a Raspberry Pi, it is recommended to follow the steps specified in
[the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top)
and using the TCF agent to have a similar set-up process also required for the Q7S.
You should run the following command first on your Raspberry Pi
```sh
sudo apt-get install gpiod libgpiod-dev
```
to install the required GPIO libraries before cloning the system root folder.
# Flight Software Framework (FSFW)
An EIVE fork of the FSFW is submodules into this repository.
To add the master upstream branch and merge changes and updates from it
@ -321,5 +762,4 @@ After that, an update can be merged by running
git merge upstream/master
```
Alternatively, changes from other upstreams (forks) and branches can be merged like that in
the same way.
Alternatively, changes from other upstreams (forks) and branches can be merged like that in the same way.

10
bsp_hosted/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
target_sources(${TARGET_NAME} PUBLIC
InitMission.cpp
main.cpp
ObjectFactory.cpp
)
add_subdirectory(fsfwconfig)
add_subdirectory(boardconfig)

21
bsp_hosted/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM ubuntu:latest
# FROM alpine:latest
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y cmake g++
# RUN apk add cmake make g++
WORKDIR /usr/src/app
COPY . .
RUN set -ex; \
rm -rf build-hosted; \
mkdir build-hosted; \
cd build-hosted; \
cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux ..;
ENTRYPOINT ["cmake", "--build", "build-hosted"]
CMD ["-j"]
# CMD ["bash"]

159
bsp_hosted/InitMission.cpp Normal file
View File

@ -0,0 +1,159 @@
#include "InitMission.h"
#include "ObjectFactory.h"
#include <OBSWConfig.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <mission/utility/InitMission.h>
#include <iostream>
#ifdef LINUX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR", false, false, true);
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
}
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
if(factory == nullptr) {
/* Should never happen ! */
return;
}
#if OBSW_PRINT_MISSED_DEADLINES == 1
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
#else
void (*missedDeadlineFunc) (void) = nullptr;
#endif
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
ReturnValue_t result = tmTcDistributor->addComponent(
objects::CCSDS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
/* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
/* PUS Services */
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
PeriodicTaskIF* testTask = factory->createPeriodicTask(
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_CODE == 1 */
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
pusVerification->startTask();
pusEvents->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */
sif::info << "Tasks started.." << std::endl;
}

View File

@ -1,7 +1,7 @@
#ifndef BSP_LINUX_INITMISSION_H_
#define BSP_LINUX_INITMISSION_H_
namespace InitMission {
namespace initmission {
void initMission();
void initTasks();
};

View File

@ -1,20 +1,27 @@
#include "ObjectFactory.h"
#include <objects/systemObjectList.h>
#include <OBSWConfig.h>
#include <objects/systemObjectList.h>
#include <tmtc/apid.h>
#include <tmtc/pusIds.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <mission/core/GenericFactory.h>
#include <mission/utility/TmFunnel.h>
void Factory::setStaticFrameworkObjectIds() {
#include <fsfw/osal/common/UdpTcPollingTask.h>
#include <fsfw/osal/common/UdpTmTcBridge.h>
#include <fsfw/tmtcpacket/pus/tm.h>
#if OBSW_ADD_TEST_CODE == 1
#include <test/testtasks/TestTask.h>
#endif
void Factory::setStaticFrameworkObjectIds(){
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
@ -26,17 +33,14 @@ void Factory::setStaticFrameworkObjectIds() {
TmFunnel::storageDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
new TmTcUnixUdpBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
}

View File

@ -1,17 +1,10 @@
/*
* ObjectFactory.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
void produce(void* args);
};
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -0,0 +1,10 @@
target_sources(${TARGET_NAME} PRIVATE
print.c
)
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -1,4 +1,5 @@
#include "print.h"
#include <stdio.h>
void printChar(const char* character, bool errStream) {

View File

@ -0,0 +1,8 @@
#ifndef BSP_HOSTED_BOARDCONFIG_PRINT_H_
#define BSP_HOSTED_BOARDCONFIG_PRINT_H_
#include <stdbool.h>
void printChar(const char* character, bool errStream);
#endif /* BSP_HOSTED_BOARDCONFIG_PRINT_H_ */

View File

@ -7,4 +7,5 @@ CSRC += $(wildcard $(CURRENTPATH)/boardconfig/*.c)
CXXSRC += $(wildcard $(CURRENTPATH)/comIF/*.cpp)
CSRC += $(wildcard $(CURRENTPATH)/comIF/*.c)
INCLUDES += $(CURRENTPATH)/boardconfig
INCLUDES += $(CURRENTPATH)/boardconfig
INCLUDES += $(CURRENTPATH)/fsfwconfig

View File

@ -8,6 +8,8 @@
// This only works on Linux
#ifdef LINUX
#include <termios.h>
#include <fcntl.h>
#include <unistd.h>
#elif WIN32
#include <windows.h>
#include <strsafe.h>
@ -255,7 +257,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
encodedLen = sizeof(sendBuffer) - remainingLen;
#ifdef LINUX
ssize_t writtenlen = write(serialPort, sendBuffer, encodedLen);
ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen);
if (writtenlen < 0) {
//we could try to find out what happened...
return RETURN_FAILED;
@ -286,7 +288,7 @@ void ArduinoComIF::handleSerialPortRx() {
rxBuffer.writeData(dataFromSerial, bytesRead);
uint8_t dataReceivedSoFar[rxBuffer.maxSize()];
uint8_t dataReceivedSoFar[rxBuffer.getMaxSize()];
uint32_t dataLenReceivedSoFar = 0;
@ -296,11 +298,11 @@ void ArduinoComIF::handleSerialPortRx() {
//look for STX
size_t firstSTXinRawData = 0;
while ((firstSTXinRawData < dataLenReceivedSoFar)
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX)) {
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
firstSTXinRawData++;
}
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX) {
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR) {
//there is no STX in our data, throw it away...
rxBuffer.deleteData(dataLenReceivedSoFar);
return;

View File

@ -1,4 +1,4 @@
#include "ArduinoCookie.h"
#include <bsp_hosted/comIF/ArduinoCookie.h>
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
const size_t maxReplySize) :

View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PUBLIC
ArduinoComIF.cpp
ArduinoCookie.cpp
)

View File

@ -0,0 +1,21 @@
target_sources(${TARGET_NAME} PRIVATE
ipc/MissionMessageTypes.cpp
)
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
# If a special translation file for object IDs exists, compile it.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
target_sources(${TARGET_NAME} PRIVATE
objects/translateObjects.cpp
)
endif()
# If a special translation file for events exists, compile it.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
target_sources(${TARGET_NAME} PRIVATE
events/translateEvents.cpp
)
endif()

View File

@ -0,0 +1,75 @@
#ifndef CONFIG_FSFWCONFIG_H_
#define CONFIG_FSFWCONFIG_H_
#include <cstddef>
#include <cstdint>
//! Used to determine whether C++ ostreams are used which can increase
//! the binary size significantly. If this is disabled,
//! the C stdio functions can be used alternatively
#define FSFW_CPP_OSTREAM_ENABLED 1
//! More FSFW related printouts depending on level. Useful for development.
#define FSFW_VERBOSE_LEVEL 1
//! Can be used to completely disable printouts, even the C stdio ones.
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
#define FSFW_DISABLE_PRINTOUT 0
#endif
#define FSFW_USE_PUS_C_TELEMETRY 1
#define FSFW_USE_PUS_C_TELECOMMANDS 1
//! Can be used to disable the ANSI color sequences for C stdio.
#define FSFW_COLORED_OUTPUT 1
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
//! additional output which requires the translation files translateObjects
//! and translateEvents (and their compiled source files)
#define FSFW_OBJ_EVENT_TRANSLATION 1
#if FSFW_OBJ_EVENT_TRANSLATION == 1
//! Specify whether info events are printed too.
#define FSFW_DEBUG_INFO 1
#include "objects/translateObjects.h"
#include "events/translateEvents.h"
#else
#endif
//! When using the newlib nano library, C99 support for stdio facilities
//! will not be provided. This define should be set to 1 if this is the case.
#define FSFW_NO_C99_IO 1
//! Specify whether a special mode store is used for Subsystem components.
#define FSFW_USE_MODESTORE 0
//! Defines if the real time scheduler for linux should be used.
//! If set to 0, this will also disable priority settings for linux
//! as most systems will not allow to set nice values without privileges
//! For embedded linux system set this to 1.
//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run
#define FSFW_USE_REALTIME_FOR_LINUX 0
namespace fsfwconfig {
//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp.
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
//! Configure the allocated pool sizes for the event manager.
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
//! Defines the FIFO depth of each commanding service base which
//! also determines how many commands a CSB service can handle in one cycle
//! simultaneously. This will increase the required RAM for
//! each CSB service !
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
}
#endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -0,0 +1,32 @@
/**
* @brief This file can be used to add preprocessor define for conditional
* code inclusion exclusion or various other project constants and
* properties in one place.
*/
#ifndef CONFIG_OBSWCONFIG_H_
#define CONFIG_OBSWCONFIG_H_
#include "commonConfig.h"
#define OBSW_ADD_TEST_CODE 1
/* These defines should be disabled for mission code but are useful for
debugging. */
#define OBSW_VEBOSE_LEVEL 1
#ifdef __cplusplus
#include "objects/systemObjectList.h"
#include "events/subsystemIdRanges.h"
#include "returnvalues/classIds.h"
namespace config {
#endif
/* Add mission configuration flags here */
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_OBSWCONFIG_H_ */

View File

@ -0,0 +1,59 @@
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
#include <linux/gpio/GpioIF.h>
namespace gpioIds {
enum gpioId_t {
HEATER_0,
HEATER_1,
HEATER_2,
HEATER_3,
HEATER_4,
HEATER_5,
HEATER_6,
HEATER_7,
DEPLSA1,
DEPLSA2,
MGM_0_LIS3_CS,
MGM_1_RM3100_CS,
GYRO_0_ADIS_CS,
GYRO_1_L3G_CS,
GYRO_2_L3G_CS,
MGM_2_LIS3_CS,
MGM_3_RM3100_CS,
TEST_ID_0,
TEST_ID_1,
RTD_IC3,
RTD_IC4,
RTD_IC5,
RTD_IC6,
RTD_IC7,
RTD_IC8,
RTD_IC9,
RTD_IC10,
RTD_IC11,
RTD_IC12,
RTD_IC13,
RTD_IC14,
RTD_IC15,
RTD_IC16,
RTD_IC17,
RTD_IC18,
SPI_MUX_BIT_1,
SPI_MUX_BIT_2,
SPI_MUX_BIT_3,
SPI_MUX_BIT_4,
SPI_MUX_BIT_5,
SPI_MUX_BIT_6
};
}
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */

View File

@ -0,0 +1,58 @@
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#include <OBSWConfig.h>
namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum switcherList {
Q7S,
PAYLOAD_PCDU_CH1,
RW,
TCS_BOARD_8V_HEATER_IN,
SUS_REDUNDANT,
DEPLOYMENT_MECHANISM,
PAYLOAD_PCDU_CH6,
ACS_BOARD_SIDE_B,
PAYLOAD_CAMERA,
TCS_BOARD_3V3,
SYRLINKS,
STAR_TRACKER,
MGT,
SUS_NOMINAL,
SOLAR_CELL_EXP,
PLOC,
ACS_BORAD_SIDE_A,
NUMBER_OF_SWITCHES
};
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
/* Output states after reboot of the PDUs */
static const uint8_t INIT_STATE_Q7S = ON;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
static const uint8_t INIT_STATE_RW = OFF;
#if TE0720 == 1
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
#else
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
#endif
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
static const uint8_t INIT_STATE_SYRLINKS = OFF;
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
static const uint8_t INIT_STATE_MGT = OFF;
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
static const uint8_t INIT_STATE_PLOC = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
}
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */

View File

@ -1,7 +1,7 @@
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#include <fsfw/events/fwSubsystemIdRanges.h>
#include <common/config/commonSubsystemIds.h>
#include <cstdint>
/**
@ -10,16 +10,7 @@
*/
namespace SUBSYSTEM_ID {
enum: uint8_t {
SUBSYSTE_ID_START = FW_SUBSYSTEM_ID_RANGE,
PUS_SERVICE_2,
PUS_SERVICE_3,
PUS_SERVICE_5,
PUS_SERVICE_6,
PUS_SERVICE_8,
PUS_SERVICE_23,
MGM_LIS3MDL,
DUMMY_DEVICE,
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
};
}

View File

@ -0,0 +1,264 @@
/**
* @brief Auto-generated event translation file. Contains 83 translations.
* @details
* Generated on: 2021-05-17 19:49:55
*/
#include "translateEvents.h"
const char *STORE_SEND_WRITE_FAILED_STRING = "STORE_SEND_WRITE_FAILED";
const char *STORE_WRITE_FAILED_STRING = "STORE_WRITE_FAILED";
const char *STORE_SEND_READ_FAILED_STRING = "STORE_SEND_READ_FAILED";
const char *STORE_READ_FAILED_STRING = "STORE_READ_FAILED";
const char *UNEXPECTED_MSG_STRING = "UNEXPECTED_MSG";
const char *STORING_FAILED_STRING = "STORING_FAILED";
const char *TM_DUMP_FAILED_STRING = "TM_DUMP_FAILED";
const char *STORE_INIT_FAILED_STRING = "STORE_INIT_FAILED";
const char *STORE_INIT_EMPTY_STRING = "STORE_INIT_EMPTY";
const char *STORE_CONTENT_CORRUPTED_STRING = "STORE_CONTENT_CORRUPTED";
const char *STORE_INITIALIZE_STRING = "STORE_INITIALIZE";
const char *INIT_DONE_STRING = "INIT_DONE";
const char *DUMP_FINISHED_STRING = "DUMP_FINISHED";
const char *DELETION_FINISHED_STRING = "DELETION_FINISHED";
const char *DELETION_FAILED_STRING = "DELETION_FAILED";
const char *AUTO_CATALOGS_SENDING_FAILED_STRING = "AUTO_CATALOGS_SENDING_FAILED";
const char *GET_DATA_FAILED_STRING = "GET_DATA_FAILED";
const char *STORE_DATA_FAILED_STRING = "STORE_DATA_FAILED";
const char *DEVICE_BUILDING_COMMAND_FAILED_STRING = "DEVICE_BUILDING_COMMAND_FAILED";
const char *DEVICE_SENDING_COMMAND_FAILED_STRING = "DEVICE_SENDING_COMMAND_FAILED";
const char *DEVICE_REQUESTING_REPLY_FAILED_STRING = "DEVICE_REQUESTING_REPLY_FAILED";
const char *DEVICE_READING_REPLY_FAILED_STRING = "DEVICE_READING_REPLY_FAILED";
const char *DEVICE_INTERPRETING_REPLY_FAILED_STRING = "DEVICE_INTERPRETING_REPLY_FAILED";
const char *DEVICE_MISSED_REPLY_STRING = "DEVICE_MISSED_REPLY";
const char *DEVICE_UNKNOWN_REPLY_STRING = "DEVICE_UNKNOWN_REPLY";
const char *DEVICE_UNREQUESTED_REPLY_STRING = "DEVICE_UNREQUESTED_REPLY";
const char *INVALID_DEVICE_COMMAND_STRING = "INVALID_DEVICE_COMMAND";
const char *MONITORING_LIMIT_EXCEEDED_STRING = "MONITORING_LIMIT_EXCEEDED";
const char *MONITORING_AMBIGUOUS_STRING = "MONITORING_AMBIGUOUS";
const char *FUSE_CURRENT_HIGH_STRING = "FUSE_CURRENT_HIGH";
const char *FUSE_WENT_OFF_STRING = "FUSE_WENT_OFF";
const char *POWER_ABOVE_HIGH_LIMIT_STRING = "POWER_ABOVE_HIGH_LIMIT";
const char *POWER_BELOW_LOW_LIMIT_STRING = "POWER_BELOW_LOW_LIMIT";
const char *SWITCH_WENT_OFF_STRING = "SWITCH_WENT_OFF";
const char *HEATER_ON_STRING = "HEATER_ON";
const char *HEATER_OFF_STRING = "HEATER_OFF";
const char *HEATER_TIMEOUT_STRING = "HEATER_TIMEOUT";
const char *HEATER_STAYED_ON_STRING = "HEATER_STAYED_ON";
const char *HEATER_STAYED_OFF_STRING = "HEATER_STAYED_OFF";
const char *TEMP_SENSOR_HIGH_STRING = "TEMP_SENSOR_HIGH";
const char *TEMP_SENSOR_LOW_STRING = "TEMP_SENSOR_LOW";
const char *TEMP_SENSOR_GRADIENT_STRING = "TEMP_SENSOR_GRADIENT";
const char *COMPONENT_TEMP_LOW_STRING = "COMPONENT_TEMP_LOW";
const char *COMPONENT_TEMP_HIGH_STRING = "COMPONENT_TEMP_HIGH";
const char *COMPONENT_TEMP_OOL_LOW_STRING = "COMPONENT_TEMP_OOL_LOW";
const char *COMPONENT_TEMP_OOL_HIGH_STRING = "COMPONENT_TEMP_OOL_HIGH";
const char *TEMP_NOT_IN_OP_RANGE_STRING = "TEMP_NOT_IN_OP_RANGE";
const char *FDIR_CHANGED_STATE_STRING = "FDIR_CHANGED_STATE";
const char *FDIR_STARTS_RECOVERY_STRING = "FDIR_STARTS_RECOVERY";
const char *FDIR_TURNS_OFF_DEVICE_STRING = "FDIR_TURNS_OFF_DEVICE";
const char *MONITOR_CHANGED_STATE_STRING = "MONITOR_CHANGED_STATE";
const char *VALUE_BELOW_LOW_LIMIT_STRING = "VALUE_BELOW_LOW_LIMIT";
const char *VALUE_ABOVE_HIGH_LIMIT_STRING = "VALUE_ABOVE_HIGH_LIMIT";
const char *VALUE_OUT_OF_RANGE_STRING = "VALUE_OUT_OF_RANGE";
const char *SWITCHING_TM_FAILED_STRING = "SWITCHING_TM_FAILED";
const char *CHANGING_MODE_STRING = "CHANGING_MODE";
const char *MODE_INFO_STRING = "MODE_INFO";
const char *FALLBACK_FAILED_STRING = "FALLBACK_FAILED";
const char *MODE_TRANSITION_FAILED_STRING = "MODE_TRANSITION_FAILED";
const char *CANT_KEEP_MODE_STRING = "CANT_KEEP_MODE";
const char *OBJECT_IN_INVALID_MODE_STRING = "OBJECT_IN_INVALID_MODE";
const char *FORCING_MODE_STRING = "FORCING_MODE";
const char *MODE_CMD_REJECTED_STRING = "MODE_CMD_REJECTED";
const char *HEALTH_INFO_STRING = "HEALTH_INFO";
const char *CHILD_CHANGED_HEALTH_STRING = "CHILD_CHANGED_HEALTH";
const char *CHILD_PROBLEMS_STRING = "CHILD_PROBLEMS";
const char *OVERWRITING_HEALTH_STRING = "OVERWRITING_HEALTH";
const char *TRYING_RECOVERY_STRING = "TRYING_RECOVERY";
const char *RECOVERY_STEP_STRING = "RECOVERY_STEP";
const char *RECOVERY_DONE_STRING = "RECOVERY_DONE";
const char *RF_AVAILABLE_STRING = "RF_AVAILABLE";
const char *RF_LOST_STRING = "RF_LOST";
const char *BIT_LOCK_STRING = "BIT_LOCK";
const char *BIT_LOCK_LOST_STRING = "BIT_LOCK_LOST";
const char *FRAME_PROCESSING_FAILED_STRING = "FRAME_PROCESSING_FAILED";
const char *CLOCK_SET_STRING = "CLOCK_SET";
const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE";
const char *TEST_STRING = "TEST";
const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER";
const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE";
const char *ACK_FAILURE_STRING = "ACK_FAILURE";
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
const char *CRC_FAILURE_EVENT_STRING = "CRC_FAILURE_EVENT";
const char * translateEvents(Event event) {
switch( (event & 0xffff) ) {
case(2200):
return STORE_SEND_WRITE_FAILED_STRING;
case(2201):
return STORE_WRITE_FAILED_STRING;
case(2202):
return STORE_SEND_READ_FAILED_STRING;
case(2203):
return STORE_READ_FAILED_STRING;
case(2204):
return UNEXPECTED_MSG_STRING;
case(2205):
return STORING_FAILED_STRING;
case(2206):
return TM_DUMP_FAILED_STRING;
case(2207):
return STORE_INIT_FAILED_STRING;
case(2208):
return STORE_INIT_EMPTY_STRING;
case(2209):
return STORE_CONTENT_CORRUPTED_STRING;
case(2210):
return STORE_INITIALIZE_STRING;
case(2211):
return INIT_DONE_STRING;
case(2212):
return DUMP_FINISHED_STRING;
case(2213):
return DELETION_FINISHED_STRING;
case(2214):
return DELETION_FAILED_STRING;
case(2215):
return AUTO_CATALOGS_SENDING_FAILED_STRING;
case(2600):
return GET_DATA_FAILED_STRING;
case(2601):
return STORE_DATA_FAILED_STRING;
case(2800):
return DEVICE_BUILDING_COMMAND_FAILED_STRING;
case(2801):
return DEVICE_SENDING_COMMAND_FAILED_STRING;
case(2802):
return DEVICE_REQUESTING_REPLY_FAILED_STRING;
case(2803):
return DEVICE_READING_REPLY_FAILED_STRING;
case(2804):
return DEVICE_INTERPRETING_REPLY_FAILED_STRING;
case(2805):
return DEVICE_MISSED_REPLY_STRING;
case(2806):
return DEVICE_UNKNOWN_REPLY_STRING;
case(2807):
return DEVICE_UNREQUESTED_REPLY_STRING;
case(2808):
return INVALID_DEVICE_COMMAND_STRING;
case(2809):
return MONITORING_LIMIT_EXCEEDED_STRING;
case(2810):
return MONITORING_AMBIGUOUS_STRING;
case(4201):
return FUSE_CURRENT_HIGH_STRING;
case(4202):
return FUSE_WENT_OFF_STRING;
case(4204):
return POWER_ABOVE_HIGH_LIMIT_STRING;
case(4205):
return POWER_BELOW_LOW_LIMIT_STRING;
case(4300):
return SWITCH_WENT_OFF_STRING;
case(5000):
return HEATER_ON_STRING;
case(5001):
return HEATER_OFF_STRING;
case(5002):
return HEATER_TIMEOUT_STRING;
case(5003):
return HEATER_STAYED_ON_STRING;
case(5004):
return HEATER_STAYED_OFF_STRING;
case(5200):
return TEMP_SENSOR_HIGH_STRING;
case(5201):
return TEMP_SENSOR_LOW_STRING;
case(5202):
return TEMP_SENSOR_GRADIENT_STRING;
case(5901):
return COMPONENT_TEMP_LOW_STRING;
case(5902):
return COMPONENT_TEMP_HIGH_STRING;
case(5903):
return COMPONENT_TEMP_OOL_LOW_STRING;
case(5904):
return COMPONENT_TEMP_OOL_HIGH_STRING;
case(5905):
return TEMP_NOT_IN_OP_RANGE_STRING;
case(7101):
return FDIR_CHANGED_STATE_STRING;
case(7102):
return FDIR_STARTS_RECOVERY_STRING;
case(7103):
return FDIR_TURNS_OFF_DEVICE_STRING;
case(7201):
return MONITOR_CHANGED_STATE_STRING;
case(7202):
return VALUE_BELOW_LOW_LIMIT_STRING;
case(7203):
return VALUE_ABOVE_HIGH_LIMIT_STRING;
case(7204):
return VALUE_OUT_OF_RANGE_STRING;
case(7301):
return SWITCHING_TM_FAILED_STRING;
case(7400):
return CHANGING_MODE_STRING;
case(7401):
return MODE_INFO_STRING;
case(7402):
return FALLBACK_FAILED_STRING;
case(7403):
return MODE_TRANSITION_FAILED_STRING;
case(7404):
return CANT_KEEP_MODE_STRING;
case(7405):
return OBJECT_IN_INVALID_MODE_STRING;
case(7406):
return FORCING_MODE_STRING;
case(7407):
return MODE_CMD_REJECTED_STRING;
case(7506):
return HEALTH_INFO_STRING;
case(7507):
return CHILD_CHANGED_HEALTH_STRING;
case(7508):
return CHILD_PROBLEMS_STRING;
case(7509):
return OVERWRITING_HEALTH_STRING;
case(7510):
return TRYING_RECOVERY_STRING;
case(7511):
return RECOVERY_STEP_STRING;
case(7512):
return RECOVERY_DONE_STRING;
case(7900):
return RF_AVAILABLE_STRING;
case(7901):
return RF_LOST_STRING;
case(7902):
return BIT_LOCK_STRING;
case(7903):
return BIT_LOCK_LOST_STRING;
case(7905):
return FRAME_PROCESSING_FAILED_STRING;
case(8900):
return CLOCK_SET_STRING;
case(8901):
return CLOCK_SET_FAILURE_STRING;
case(9700):
return TEST_STRING;
case(10600):
return CHANGE_OF_SETUP_PARAMETER_STRING;
case(11101):
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case(11102):
return ACK_FAILURE_STRING;
case(11103):
return EXE_FAILURE_STRING;
case(11104):
return CRC_FAILURE_EVENT_STRING;
default:
return "UNKNOWN_EVENT";
}
return 0;
}

View File

@ -1,10 +1,3 @@
/*
* translateEvent.h
*
* Created on: 28 May 2019
* Author: Robin
*/
#ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
#define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
@ -12,5 +5,4 @@
const char * translateEvents(Event event);
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */

View File

@ -0,0 +1,7 @@
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
INCLUDES += $(CURRENTPATH)

View File

@ -1,5 +1,5 @@
#include "MissionMessageTypes.h"
#include <fsfw/ipc/CommandMessage.h>
#include <hosted/fsfwconfig/ipc/MissionMessageTypes.h>
void messagetypes::clearMissionMessage(CommandMessage* message) {
switch(message->getMessageType()) {

View File

@ -11,7 +11,7 @@ class CommandMessage;
* <fsfw/ipc/FwMessageTypes.h>
* @param message Generic Command Message
*/
namespace messagetypes{
namespace messagetypes {
enum MESSAGE_TYPE {
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
};

View File

@ -2,15 +2,11 @@
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#include <cstdint>
#include <commonObjects.h>
// The objects will be instantiated in the ID order
namespace objects {
enum sourceObjects: uint32_t {
/* First Byte 0x50-0x52 reserved for PUS Services **/
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
PUS_PACKET_DISTRIBUTOR = 0x50000200,
UDP_BRIDGE = 0x50000300,
UDP_POLLING_TASK = 0x50000400,
PUS_SERVICE_3 = 0x51000300,
PUS_SERVICE_5 = 0x51000400,
@ -19,7 +15,6 @@ namespace objects {
PUS_SERVICE_23 = 0x51002300,
PUS_SERVICE_201 = 0x51020100,
TIME_STAMPER = 0x52000001,
TM_FUNNEL = 0x52000002,
/* Test Task */

View File

@ -0,0 +1,109 @@
/**
* @brief Auto-generated object translation file.
* @details
* Contains 31 translations.
* Generated on: 2021-05-17 19:12:49
*/
#include "translateObjects.h"
const char *TEST_TASK_STRING = "TEST_TASK";
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *PUS_SERVICE_3_STRING = "PUS_SERVICE_3";
const char *PUS_SERVICE_5_STRING = "PUS_SERVICE_5";
const char *PUS_SERVICE_6_STRING = "PUS_SERVICE_6";
const char *PUS_SERVICE_8_STRING = "PUS_SERVICE_8";
const char *PUS_SERVICE_23_STRING = "PUS_SERVICE_23";
const char *PUS_SERVICE_201_STRING = "PUS_SERVICE_201";
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *FSFW_OBJECTS_START_STRING = "FSFW_OBJECTS_START";
const char *PUS_SERVICE_1_VERIFICATION_STRING = "PUS_SERVICE_1_VERIFICATION";
const char *PUS_SERVICE_2_DEVICE_ACCESS_STRING = "PUS_SERVICE_2_DEVICE_ACCESS";
const char *PUS_SERVICE_3_HOUSEKEEPING_STRING = "PUS_SERVICE_3_HOUSEKEEPING";
const char *PUS_SERVICE_5_EVENT_REPORTING_STRING = "PUS_SERVICE_5_EVENT_REPORTING";
const char *PUS_SERVICE_8_FUNCTION_MGMT_STRING = "PUS_SERVICE_8_FUNCTION_MGMT";
const char *PUS_SERVICE_9_TIME_MGMT_STRING = "PUS_SERVICE_9_TIME_MGMT";
const char *PUS_SERVICE_17_TEST_STRING = "PUS_SERVICE_17_TEST";
const char *PUS_SERVICE_20_PARAMETERS_STRING = "PUS_SERVICE_20_PARAMETERS";
const char *PUS_SERVICE_200_MODE_MGMT_STRING = "PUS_SERVICE_200_MODE_MGMT";
const char *HEALTH_TABLE_STRING = "HEALTH_TABLE";
const char *MODE_STORE_STRING = "MODE_STORE";
const char *EVENT_MANAGER_STRING = "EVENT_MANAGER";
const char *INTERNAL_ERROR_REPORTER_STRING = "INTERNAL_ERROR_REPORTER";
const char *TC_STORE_STRING = "TC_STORE";
const char *TM_STORE_STRING = "TM_STORE";
const char *IPC_STORE_STRING = "IPC_STORE";
const char *TIME_STAMPER_STRING = "TIME_STAMPER";
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *NO_OBJECT_STRING = "NO_OBJECT";
const char* translateObject(object_id_t object) {
switch( (object & 0xFFFFFFFF) ) {
case 0x42694269:
return TEST_TASK_STRING;
case 0x4400AFFE:
return DUMMY_HANDLER_STRING;
case 0x49000001:
return ARDUINO_COM_IF_STRING;
case 0x51000300:
return PUS_SERVICE_3_STRING;
case 0x51000400:
return PUS_SERVICE_5_STRING;
case 0x51000500:
return PUS_SERVICE_6_STRING;
case 0x51000800:
return PUS_SERVICE_8_STRING;
case 0x51002300:
return PUS_SERVICE_23_STRING;
case 0x51020100:
return PUS_SERVICE_201_STRING;
case 0x52000002:
return TM_FUNNEL_STRING;
case 0x53000000:
return FSFW_OBJECTS_START_STRING;
case 0x53000001:
return PUS_SERVICE_1_VERIFICATION_STRING;
case 0x53000002:
return PUS_SERVICE_2_DEVICE_ACCESS_STRING;
case 0x53000003:
return PUS_SERVICE_3_HOUSEKEEPING_STRING;
case 0x53000005:
return PUS_SERVICE_5_EVENT_REPORTING_STRING;
case 0x53000008:
return PUS_SERVICE_8_FUNCTION_MGMT_STRING;
case 0x53000009:
return PUS_SERVICE_9_TIME_MGMT_STRING;
case 0x53000017:
return PUS_SERVICE_17_TEST_STRING;
case 0x53000020:
return PUS_SERVICE_20_PARAMETERS_STRING;
case 0x53000200:
return PUS_SERVICE_200_MODE_MGMT_STRING;
case 0x53010000:
return HEALTH_TABLE_STRING;
case 0x53010100:
return MODE_STORE_STRING;
case 0x53030000:
return EVENT_MANAGER_STRING;
case 0x53040000:
return INTERNAL_ERROR_REPORTER_STRING;
case 0x534f0100:
return TC_STORE_STRING;
case 0x534f0200:
return TM_STORE_STRING;
case 0x534f0300:
return IPC_STORE_STRING;
case 0x53500010:
return TIME_STAMPER_STRING;
case 0x53ffffff:
return FSFW_OBJECTS_END_STRING;
case 0xCAFECAFE:
return DUMMY_INTERFACE_STRING;
case 0xFFFFFFFF:
return NO_OBJECT_STRING;
default:
return "UNKNOWN_OBJECT";
}
return 0;
}

View File

@ -1,16 +1,8 @@
/*
* translateObjects.h
*
* Created on: 28 May 2019
* Author: Robin
*/
#ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_
#define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/objectmanager/SystemObjectIF.h>
const char* translateObject(object_id_t object);
#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */

View File

@ -1,6 +1,7 @@
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
#define CONFIG_RETURNVALUES_CLASSIDS_H_
#include "commonClassIds.h"
#include <fsfw/returnvalues/FwClassIds.h>
/**
@ -10,8 +11,7 @@
*/
namespace CLASS_ID {
enum {
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
MGM_LIS3MDL
CLASS_ID_START = COMMON_CLASS_ID_END,
};
}

View File

@ -1,7 +1,7 @@
#include <bsp_linux/InitMission.h>
#include <fsfw/tasks/TaskFactory.h>
#include <hosted/fsfwconfig/OBSWVersion.h>
#include "InitMission.h"
#include <OBSWVersion.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream>
#ifdef WIN32
@ -24,7 +24,7 @@ int main(void)
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
InitMission::initMission();
initmission::initMission();
for(;;) {
// suspend main thread by sleeping it.

View File

@ -1,159 +0,0 @@
#include <bsp_linux/InitMission.h>
#include <bsp_linux/ObjectFactory.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/datapool/DataPool.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h>
#include <iostream>
// This is configured for linux without \cr
#ifdef LINUX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR", false, false, true);
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF *objectManager = nullptr;
//Initialize Data Pool
DataPool dataPool(nullptr);
void InitMission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
objectManager = new ObjectManager(ObjectFactory::produce);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
/* This function creates and starts all tasks */
initTasks();
}
void InitMission::initTasks(){
/* TMTC Distribution */
PeriodicTaskIF* TmTcDistributor = TaskFactory::instance()->
createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.100, nullptr);
ReturnValue_t result = TmTcDistributor->addComponent(
objects::CCSDS_PACKET_DISTRIBUTOR);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = TmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = TmTcDistributor->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
/* UDP bridge */
PeriodicTaskIF* UdpBridgeTask = TaskFactory::instance()->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.2, nullptr);
result = UdpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* UdpPollingTask = TaskFactory::instance()->
createPeriodicTask("UDP_POLLING", 80,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr);
result = UdpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
/* PUS Services */
PeriodicTaskIF* PusVerification = TaskFactory::instance()->
createPeriodicTask("PUS_VERIF_1", 40,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = PusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* PusEvents = TaskFactory::instance()->
createPeriodicTask("PUS_VERIF_1", 60,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = PusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* PusHighPrio = TaskFactory::instance()->
createPeriodicTask("PUS_HIGH_PRIO", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.200, nullptr);
result = PusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = PusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* PusMedPrio = TaskFactory::instance()->
createPeriodicTask("PUS_HIGH_PRIO", 40,
PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.8, nullptr);
result = PusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = PusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* PusLowPrio = TaskFactory::instance()->
createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
1.6, nullptr);
result = PusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
#if ADD_TEST_CODE == 1
FixedTimeslotTaskIF* TestTimeslotTask = TaskFactory::instance()->
createFixedTimeslotTask("PST_TEST_TASK", 10,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = pst::pollingSequenceTestFunction(TestTimeslotTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::createTasks: Test PST initialization "
<< "failed!" << std::endl;
}
#endif
//Main thread sleep
sif::info << "Starting tasks.." << std::endl;
TmTcDistributor->startTask();
UdpBridgeTask->startTask();
UdpPollingTask->startTask();
PusVerification->startTask();
PusEvents->startTask();
PusHighPrio->startTask();
PusMedPrio->startTask();
PusLowPrio->startTask();
#if ADD_TEST_CODE == 1
TestTimeslotTask->startTask();
#endif
sif::info << "Tasks started.." << std::endl;
}

View File

@ -1,4 +0,0 @@
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
CSRC += $(wildcard $(CURRENTPATH)/*.c)
CSRC += $(wildcard $(CURRENTPATH)/boardconfig/*.c)

View File

@ -1,324 +0,0 @@
#include "ArduinoCookie.h"
#include "ArduinoComIF.h"
#include <fsfw/globalfunctions/DleEncoder.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <fsfw/globalfunctions/CRC.h>
#include <termios.h>
ArduinoCommInterface::ArduinoCommInterface(object_id_t setObjectId,
const char *serialDevice) :
spiMap(MAX_NUMBER_OF_SPI_DEVICES), rxBuffer(
MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true), SystemObject(setObjectId) {
initialized = false;
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
if (serialPort < 0) {
//configuration error
printf("Error %i from open: %s\n", errno, strerror(errno));
return;
}
struct termios tty;
memset(&tty, 0, sizeof tty);
// Read in existing settings, and handle any error
if (tcgetattr(serialPort, &tty) != 0) {
printf("Error %i from tcgetattr: %s\n", errno, strerror(errno));
return;
}
tty.c_cflag &= ~PARENB; // Clear parity bit, disabling parity
tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
tty.c_cflag |= CS8; // 8 bits per byte
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
tty.c_lflag &= ~ICANON; //Disable Canonical Mode
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
tty.c_cc[VTIME] = 0; // Non Blocking
tty.c_cc[VMIN] = 0;
cfsetispeed(&tty, B9600); //Baudrate
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
//printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
return;
}
initialized = true;
}
ArduinoCommInterface::~ArduinoCommInterface() {
::close(serialPort);
}
ReturnValue_t ArduinoCommInterface::open(Cookie **cookie, uint32_t address,
uint32_t maxReplyLen) {
//This is a hack, will be gone with https://egit.irs.uni-stuttgart.de/fsfw/fsfw/issues/19
switch ((address >> 8) & 0xff) {
case 0:
*cookie = new ArduinoCookie(ArduinoCookie::SPI, address, maxReplyLen);
spiMap.insert(address, (ArduinoCookie*) *cookie); //Yes, I *do* know that it is an ArduinoSpiCookie, I just new'd it
break;
default:
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t ArduinoCommInterface::reOpen(Cookie *cookie, uint32_t address,
uint32_t maxReplyLen) {
//too lazy right now will be irrelevant with https://egit.irs.uni-stuttgart.de/fsfw/fsfw/issues/19
return HasReturnvaluesIF::RETURN_FAILED;
}
void ArduinoCommInterface::close(Cookie *cookie) {
//too lazy as well, find the correct Map, delete it there, then the cookie...
}
ReturnValue_t ArduinoCommInterface::sendMessage(Cookie *cookie, uint8_t *data,
uint32_t len) {
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
if (arduinoCookie == NULL) {
return INVALID_COOKIE_TYPE;
}
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
len);
}
ReturnValue_t ArduinoCommInterface::getSendSuccess(Cookie *cookie) {
return RETURN_OK;
}
ReturnValue_t ArduinoCommInterface::requestReceiveMessage(Cookie *cookie) {
return RETURN_OK;
}
ReturnValue_t ArduinoCommInterface::readReceivedMessage(Cookie *cookie,
uint8_t **buffer, uint32_t *size) {
handleSerialPortRx();
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
if (arduinoCookie == NULL) {
return INVALID_COOKIE_TYPE;
}
*buffer = arduinoCookie->replyBuffer;
*size = arduinoCookie->receivedDataLen;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t ArduinoCommInterface::setAddress(Cookie *cookie,
uint32_t address) {
//not implemented
return RETURN_FAILED;
}
uint32_t ArduinoCommInterface::getAddress(Cookie *cookie) {
//not implemented
return 0;
}
ReturnValue_t ArduinoCommInterface::setParameter(Cookie *cookie,
uint32_t parameter) {
//not implemented
return RETURN_FAILED;
}
uint32_t ArduinoCommInterface::getParameter(Cookie *cookie) {
//not implemented
return 0;
}
ReturnValue_t ArduinoCommInterface::sendMessage(uint8_t command,
uint8_t address, const uint8_t *data, size_t dataLen) {
if (dataLen > UINT16_MAX) {
return TOO_MUCH_DATA;
}
//being conservative here
uint8_t sendBuffer[(dataLen + 6) * 2 + 2];
sendBuffer[0] = DleEncoder::STX;
uint8_t *currentPosition = sendBuffer + 1;
size_t remainingLen = sizeof(sendBuffer) - 1;
uint32_t encodedLen;
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
return result;
}
currentPosition += encodedLen;
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
&encodedLen, false);
if (result != RETURN_OK) {
return result;
}
currentPosition += encodedLen;
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
uint8_t temporaryBuffer[2];
//note to Lukas: yes we _could_ use Serialize here, but for 16 bit it is a bit too much...
temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
temporaryBuffer[1] = dataLen;
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
return result;
}
currentPosition += encodedLen;
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
//encoding the actual data
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
&encodedLen, false);
if (result != RETURN_OK) {
return result;
}
currentPosition += encodedLen;
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
uint16_t crc = CRC::crc16ccitt(&command, 1);
crc = CRC::crc16ccitt(&address, 1, crc);
//fortunately the length is still there
crc = CRC::crc16ccitt(temporaryBuffer, 2, crc);
crc = CRC::crc16ccitt(data, dataLen, crc);
temporaryBuffer[0] = crc >> 8;
temporaryBuffer[1] = crc;
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
remainingLen, &encodedLen, false);
if (result != RETURN_OK) {
return result;
}
currentPosition += encodedLen;
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
if (remainingLen > 0) {
*currentPosition = DleEncoder::ETX;
}
remainingLen -= 1;
encodedLen = sizeof(sendBuffer) - remainingLen;
ssize_t writtenlen = write(serialPort, sendBuffer, encodedLen);
if (writtenlen < 0) {
//we could try to find out what happened...
return RETURN_FAILED;
}
if (writtenlen != encodedLen) {
//the OS failed us, we do not try to block until everything is written, as
//we can not block the whole system here
return RETURN_FAILED;
}
return RETURN_OK;
}
void ArduinoCommInterface::handleSerialPortRx() {
uint32_t availableSpace = rxBuffer.availableWriteSpace();
uint8_t dataFromSerial[availableSpace];
ssize_t bytesRead = read(serialPort, dataFromSerial,
sizeof(dataFromSerial));
if (bytesRead < 0) {
return;
}
rxBuffer.writeData(dataFromSerial, bytesRead);
uint8_t dataReceivedSoFar[rxBuffer.maxSize()];
uint32_t dataLenReceivedSoFar = 0;
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
&dataLenReceivedSoFar);
//look for STX
size_t firstSTXinRawData = 0;
while ((firstSTXinRawData < dataLenReceivedSoFar)
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX)) {
firstSTXinRawData++;
}
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX) {
//there is no STX in our data, throw it away...
rxBuffer.deleteData(dataLenReceivedSoFar);
return;
}
uint8_t packet[MAX_PACKET_SIZE];
uint32_t packetLen;
uint32_t readSize;
ReturnValue_t result = DleEncoder::decode(
dataReceivedSoFar + firstSTXinRawData,
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
sizeof(packet), &packetLen);
size_t toDelete = firstSTXinRawData;
if (result == HasReturnvaluesIF::RETURN_OK) {
handlePacket(packet, packetLen);
//after handling the packet, we can delete it from the raw stream, it has been copied to packet
toDelete += readSize;
}
//remove Data which was processed
rxBuffer.deleteData(toDelete);
}
void ArduinoCommInterface::handlePacket(uint8_t *packet, size_t packetLen) {
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
if (crc != 0) {
//CRC error
return;
}
uint8_t command = packet[0];
uint8_t address = packet[1];
uint16_t size = (packet[2] << 8) + packet[3];
if (size != packetLen - 6) {
//Invalid Length
return;
}
switch (command) {
case ArduinoCookie::SPI: {
ArduinoCookie **itsComplicated;
ReturnValue_t result = spiMap.find(address, &itsComplicated);
if (result != RETURN_OK) {
//we do no know this address
return;
}
ArduinoCookie *theActualCookie = *itsComplicated;
if (packetLen > theActualCookie->maxReplySize + 6) {
packetLen = theActualCookie->maxReplySize + 6;
}
memcpy(theActualCookie->replyBuffer, packet + 4, packetLen - 6);
theActualCookie->receivedDataLen = packetLen - 6;
}
break;
default:
return;
}
}

View File

@ -1,73 +0,0 @@
//#ifndef MISSION_ARDUINOCOMMINTERFACE_H_
//#define MISSION_ARDUINOCOMMINTERFACE_H_
//
//#include <bits/stdint-uintn.h>
//#include <framework/container/FixedMap.h>
//#include <framework/container/SimpleRingBuffer.h>
//#include <framework/devicehandlers/DeviceCommunicationIF.h>
//#include <framework/returnvalues/HasReturnvaluesIF.h>
//#include <stddef.h>
//
//#include "../../framework/objectmanager/SystemObject.h"
//#include "ArduinoCookie.h"
//
////Forward declaration, so users don't peek
//class ArduinoCookie;
//
//class ArduinoComIF: public SystemObject,
// public DeviceCommunicationIF {
//public:
// static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
// static const uint8_t MAX_PACKET_SIZE = 64;
//
// static const uint8_t COMMAND_INVALID = -1;
// static const uint8_t COMMAND_SPI = 1;
//
// ArduinoComIF(object_id_t setObjectId, const char *serialDevice);
// virtual ~ArduinoComIF();
//
// virtual ReturnValue_t open(Cookie **cookie, uint32_t address,
// uint32_t maxReplyLen);
//
// virtual ReturnValue_t reOpen(Cookie *cookie, uint32_t address,
// uint32_t maxReplyLen);
//
// virtual void close(Cookie *cookie);
//
// //SHOULDDO can data be const?
// virtual ReturnValue_t sendMessage(Cookie *cookie, uint8_t *data,
// uint32_t len);
//
// virtual ReturnValue_t getSendSuccess(Cookie *cookie);
//
// virtual ReturnValue_t requestReceiveMessage(Cookie *cookie);
//
// virtual ReturnValue_t readReceivedMessage(Cookie *cookie, uint8_t **buffer,
// uint32_t *size);
//
// virtual ReturnValue_t setAddress(Cookie *cookie, uint32_t address);
//
// virtual uint32_t getAddress(Cookie *cookie);
//
// virtual ReturnValue_t setParameter(Cookie *cookie, uint32_t parameter);
//
// virtual uint32_t getParameter(Cookie *cookie);
//private:
// //remembering if the initialization in the ctor worked
// //if not, all calls are disabled
// bool initialized;
// int serialPort;
// //used to know where to put the data if a reply is received
// FixedMap<uint8_t, ArduinoCookie*> spiMap;
//
// SimpleRingBuffer rxBuffer;
//
// ReturnValue_t sendMessage(uint8_t command, uint8_t address,
// const uint8_t *data, size_t dataLen);
//
// void handleSerialPortRx();
//
// void handlePacket(uint8_t *packet, size_t packetLen);
//};
//
//#endif /* MISSION_ARDUINOCOMMINTERFACE_H_ */

View File

@ -1,12 +0,0 @@
//#include <mission/Arduino/ArduinoCookie.h>
//
//ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
// size_t maxReplySize) :
// command(protocol), address(address), receivedDataLen(0), maxReplySize(
// maxReplySize) {
// replyBuffer = new uint8_t[maxReplySize];
//}
//
//ArduinoCookie::~ArduinoCookie() {
// delete[] replyBuffer;
//}

View File

@ -1,25 +0,0 @@
//#ifndef MISSION_ARDUINO_ARDUINOCOOKIE_H_
//#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
//
//#include <framework/devicehandlers/Cookie.h>
//
//#include <stdint.h>
//#include <stdlib.h>
//
//class ArduinoCookie: public Cookie {
//public:
// enum Protocol_t {
// INVALID = 0, SPI = 1
// };
// ArduinoCookie(Protocol_t protocol, uint8_t address, size_t maxReplySize);
// virtual ~ArduinoCookie();
//
// uint8_t command;
// uint8_t address;
// uint8_t *replyBuffer;
// size_t receivedDataLen;
// size_t maxReplySize;
//
//};
//
//#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */

View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PUBLIC
InitMission.cpp
main.cpp
ObjectFactory.cpp
)
add_subdirectory(boardconfig)
add_subdirectory(boardtest)

View File

@ -0,0 +1,37 @@
FROM ubuntu:latest
# FROM alpine:latest
RUN apt-get update && apt-get install -y curl wget cmake g++
# Raspberry Pi rootfs
RUN mkdir -p /usr/rootfs; \
curl https://eive-cloud.irs.uni-stuttgart.de/index.php/s/kJe3nCnGPRGKFCz/download/rpi-rootfs.tar.gz /usr/rootfs \
| tar xvz -C /usr/rootfs
# Raspberry Pi toolchain
RUN mkdir -p /opt; \
cd /opt; \
wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz; \
tar xfz raspi-toolchain.tar.gz --strip-components=1 -C .; \
rm -rf raspi-toolchain.tar.gz
# RUN apk add cmake make g++
# Required for cmake build
ENV RASPBERRY_VERSION="4"
ENV RASPBIAN_ROOTFS="/usr/rootfs/rootfs"
ENV PATH=$PATH:"/opt/cross-pi-gcc/bin"
ENV CROSS_COMPILE="arm-linux-gnueabihf"
WORKDIR /usr/src/app
COPY . .
RUN set -ex; \
rm -rf build-rpi; \
mkdir build-rpi; \
cd build-rpi; \
cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux -DTGT_BSP="arm/raspberrypi" ..;
ENTRYPOINT ["cmake", "--build", "build-rpi"]
CMD ["-j"]
# CMD ["bash"]

View File

@ -0,0 +1,192 @@
#include "InitMission.h"
#include "ObjectFactory.h"
#include "objects/systemObjectList.h"
#include "OBSWConfig.h"
#include "pollingsequence/pollingSequenceFactory.h"
#include <mission/utility/InitMission.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream>
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR");
ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
}
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
if(factory == nullptr) {
/* Should never happen ! */
return;
}
#if OBSW_PRINT_MISSED_DEADLINES == 1
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
#else
void (*missedDeadlineFunc) (void) = nullptr;
#endif
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
ReturnValue_t result = tmTcDistributor->addComponent(
objects::CCSDS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
/* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
/* PUS Services */
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("INT_ERR_RPRT",
objects::INTERNAL_ERROR_REPORTER);
}
#if OBSW_ADD_TEST_PST == 1
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
result = pst::pstTest(pstTestTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
}
#endif /* RPI_TEST_ACS_BOARD == 1 */
PeriodicTaskIF* testTask = factory->createPeriodicTask(
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if RPI_ADD_SPI_TEST == 1
result = testTask->addComponent(objects::SPI_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif /* RPI_ADD_SPI_TEST == 1 */
#if RPI_ADD_GPIO_TEST == 1
result = testTask->addComponent(objects::LIBGPIOD_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
}
#endif /* RPI_ADD_GPIO_TEST == 1 */
#if RPI_ADD_UART_TEST == 1
result = testTask->addComponent(objects::UART_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
}
#endif /* RPI_ADD_GPIO_TEST == 1 */
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
pusVerification->startTask();
pusEvents->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if OBSW_ADD_TEST_PST == 1
pstTestTask->startTask();
#endif /* RPI_TEST_ACS_BOARD == 1 */
sif::info << "Tasks started.." << std::endl;
}

View File

@ -1,7 +1,7 @@
#ifndef BSP_LINUX_INITMISSION_H_
#define BSP_LINUX_INITMISSION_H_
namespace InitMission {
namespace initmission {
void initMission();
void initTasks();
};

View File

@ -0,0 +1,165 @@
#include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
#include <mission/devices/GPSHyperionHandler.h>
#include "ObjectFactory.h"
#include "objects/systemObjectList.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "OBSWConfig.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
#include "spiConf.h"
#include "linux/boardtest/LibgpiodTest.h"
#include "linux/boardtest/SpiTestClass.h"
#include "linux/boardtest/UartTestClass.h"
#include "mission/core/GenericFactory.h"
#include "mission/utility/TmFunnel.h"
#include "mission/devices/MGMHandlerLIS3MDL.h"
#include "mission/devices/MGMHandlerRM3100.h"
#include "mission/devices/GyroADIS16507Handler.h"
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include "fsfw/tmtcservices/CommandingServiceBase.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcpacket/pus/tm.h"
#include "fsfw/tasks/TaskFactory.h"
/* UDP server includes */
#include "fsfw/osal/common/UdpTmTcBridge.h"
#include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "fsfw_hal/linux/rpi/GpioRPi.h"
#include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/linux/spi/SpiCookie.h"
#include "fsfw_hal/linux/spi/SpiComIF.h"
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
GpioCookie* gpioCookie = nullptr;
static_cast<void>(gpioCookie);
#if RPI_ADD_SPI_TEST == 1
new SpiTestClass(objects::SPI_TEST, gpioIF);
#endif
#if RPI_ADD_UART_TEST == 1
new UartTestClass(objects::UART_TEST);
#else
new UartComIF(objects::UART_COM_IF);
#endif
#if RPI_LOOPBACK_TEST_GPIO == 1
GpioCookie* gpioCookieLoopback = new GpioCookie();
/* Loopback pins. Adapt according to setup */
gpioId_t gpioIdSender = gpioIds::TEST_ID_0;
int bcmPinSender = 26;
gpioId_t gpioIdReader = gpioIds::TEST_ID_1;
int bcmPinReader = 16;
gpio::createRpiGpioConfig(gpioCookieLoopback, gpioIdSender, bcmPinSender, "GPIO_LB_SENDER",
gpio::Direction::OUT, 0);
gpio::createRpiGpioConfig(gpioCookieLoopback, gpioIdReader, bcmPinReader, "GPIO_LB_READER",
gpio::Direction::IN, 0);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback);
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
new SpiComIF(objects::SPI_COM_IF, gpioIF);
std::string spiDev;
SpiCookie* spiCookie = nullptr;
static_cast<void>(spiCookie);
#if RPI_TEST_ACS_BOARD == 1
if(gpioCookie == nullptr) {
gpioCookie = new GpioCookie();
}
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
"MGM_0_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
"MGM_1_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
"MGM_2_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
"MGM_3_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
"GYRO_1_L3G", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_L3G", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookie);
spiDev = "/dev/spidev0.0";
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmLis3Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmRm3100Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie);
gyroL3gHandler->setStartUpImmediately();
#endif /* RPI_TEST_ACS_BOARD == 1 */
#if RPI_TEST_ADIS16507 == 1
if(gpioCookie == nullptr) {
gpioCookie = new GpioCookie();
}
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookie);
spiDev = "/dev/spidev0.0";
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
nullptr, nullptr);
auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
adisGyroHandler->setStartUpImmediately();
#endif /* RPI_TEST_ADIS16507 == 1 */
#if RPI_TEST_GPS_HANDLER == 1
UartCookie* uartCookie = new UartCookie(objects::GPS0_HANDLER, "/dev/serial0",
UartModes::CANONICAL, 9600, 1024);
uartCookie->setToFlushInput(true);
uartCookie->setReadCycles(6);
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
objects::UART_COM_IF, uartCookie);
gpsHandler->setStartUpImmediately();
#endif
}

View File

@ -1,17 +1,10 @@
/*
* ObjectFactory.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef BSP_LINUX_OBJECTFACTORY_H_
#define BSP_LINUX_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
void produce(void* args);
};
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */

View File

@ -0,0 +1,7 @@
target_sources(${TARGET_NAME} PRIVATE
print.c
)
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -1,4 +1,4 @@
#include "print.h"
#include <bsp_q7s/boardconfig/print.h>
#include <stdio.h>
void printChar(const char* character, bool errStream) {

View File

@ -0,0 +1,34 @@
#ifndef BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
#define BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
#include <cstdint>
#define RPI_ADD_GPIO_TEST 0
#define RPI_LOOPBACK_TEST_GPIO 0
#define RPI_TEST_ADIS16507 0
#define RPI_TEST_GPS_HANDLER 0
// Only one of those 2 should be enabled!
#define RPI_ADD_SPI_TEST 0
#if RPI_ADD_SPI_TEST == 0
#define RPI_TEST_ACS_BOARD 0
#endif
#define RPI_ADD_UART_TEST 1
#if RPI_ADD_UART_TEST == 1
#define RPI_TEST_GPS_DEVICE 0
#endif
/* Adapt these values accordingly */
namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 0;
static constexpr uint8_t MGM_1_BCM_PIN = 1;
static constexpr uint8_t MGM_2_BCM_PIN = 17;
static constexpr uint8_t MGM_3_BCM_PIN = 27;
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
static constexpr uint8_t GYRO_2_BCM_PIN = 4;
}
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */

View File

@ -0,0 +1,6 @@
target_sources(${TARGET_NAME} PRIVATE
)

View File

@ -1,28 +1,34 @@
#include "InitMission.h"
#include <OBSWVersion.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream>
#include <unistd.h>
#ifdef RASPBERRY_PI
static const char* const BOARD_NAME = "Raspberry Pi";
#elif defined(BEAGLEBONEBLACK)
static const char* const BOARD_NAME = "Beaglebone Black";
#else
static const char* const BOARD_NAME = "Unknown Board";
#endif
/**
* @brief This is the main program for the target hardware.
* @brief This is the main program and entry point for the Raspberry Pi.
* @return
*/
int main(void)
{
std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux " << " --" << std::endl;
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
InitMission::initMission();
initmission::initMission();
for(;;) {
// suspend main thread by sleeping it.
/* Suspend main thread by sleeping it. */
TaskFactory::delayTask(5000);
}
}

16
bsp_q7s/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
target_sources(${TARGET_NAME} PUBLIC
main.cpp
)
add_subdirectory(boardtest)
if(Q7S_SIMPLE_MODE)
add_subdirectory(simple)
else()
add_subdirectory(boardconfig)
add_subdirectory(comIF)
add_subdirectory(gpio)
add_subdirectory(core)
add_subdirectory(memory)
add_subdirectory(spiCallbacks)
endif()

35
bsp_q7s/Dockerfile Normal file
View File

@ -0,0 +1,35 @@
FROM ubuntu:latest
# FROM alpine:latest
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y curl cmake g++
# Q7S root filesystem, required for cross-compilation. Use IPv6 for curl
RUN mkdir -p /usr/rootfs; \
curl -6 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/dnfMy9kGpgynN6J/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
| tar xvz -C /usr/rootfs
# Q7S C++ cross-compiler. Use IPv6 for curl
RUN mkdir -p /usr/tools; \
curl -6 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/RMsbHydJc6PSqcz/download/gcc-arm-linux-gnueabi.tar.gz \
| tar xvz -C /usr/tools
# RUN apk add cmake make g++
# Required for cmake build
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
ENV PATH=$PATH:"/usr/tools/gcc-arm-linux-gnueabi/bin"
WORKDIR /usr/src/app
COPY . .
RUN set -ex; \
rm -rf build-q7s; \
mkdir build-q7s; \
cd build-q7s; \
cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux -DTGT_BSP="arm/q7s" ..;
ENTRYPOINT ["cmake", "--build", "build-q7s"]
CMD ["-j"]
# CMD ["bash"]

View File

@ -0,0 +1,7 @@
target_sources(${TARGET_NAME} PRIVATE
print.c
)
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -0,0 +1,38 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef __ETL_PROFILE_H__
#define __ETL_PROFILE_H__
#define ETL_CHECK_PUSH_POP
#define ETL_CPP11_SUPPORTED 1
#define ETL_NO_NULLPTR_SUPPORT 0
#endif

View File

@ -0,0 +1,14 @@
#ifndef LINUX_GCOV_H_
#define LINUX_GCOV_H_
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#ifdef GCOV
extern "C" void __gcov_flush();
#else
void __gcov_flush() {
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
"coverage information is desired.\n" << std::flush;
}
#endif
#endif /* LINUX_GCOV_H_ */

View File

@ -0,0 +1,14 @@
#include <bsp_q7s/boardconfig/print.h>
#include <stdio.h>
void printChar(const char* character, bool errStream) {
if(errStream) {
putc(*character, stderr);
return;
}
putc(*character, stdout);
}

View File

@ -0,0 +1,35 @@
#ifndef BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_
#define BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_
#include <cstdint>
#cmakedefine01 Q7S_SIMPLE_MODE
#define Q7S_SD_NONE 0
#define Q7S_SD_COLD_REDUNDANT 1
#define Q7S_SD_HOT_REDUNDANT 2
// The OBSW will perform different actions to set up the SD cards depending on the flag set here
// Set to Q7S_SD_NONE: Don't do anything
// Set to Q7S_COLD_REDUNDANT: On startup, get the prefered SD card, turn it on and mount it, and
// turn off the second SD card if it is on
// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them
#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT
#define Q7S_ADD_RTD_DEVICES 0
/* Only one of those 2 should be enabled! */
/* Add code for ACS board */
#define OBSW_ADD_ACS_BOARD 0
#if OBSW_ADD_ACS_BOARD == 0
#define Q7S_ADD_SPI_TEST 0
#endif
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
namespace config {
static const uint32_t SD_CARD_ACCESS_MUTEX_TIMEOUT = 50;
}
#endif /* BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ */

View File

@ -0,0 +1,8 @@
target_sources(${TARGET_NAME} PRIVATE
FileSystemTest.cpp
Q7STestTask.cpp
)

View File

@ -0,0 +1,21 @@
#include "FileSystemTest.h"
#include "fsfw/timemanager/Stopwatch.h"
#include <iostream>
#include <cstdlib>
FileSystemTest::FileSystemTest() {
using namespace std;
SdCard sdCard = SdCard::SDC0;
cout << "SD Card Test for SD card " << static_cast<int>(sdCard) << std::endl;
//Stopwatch stopwatch;
std::system("q7hw sd info all > /tmp/sd_status.txt");
//stopwatch.stop(true);
std::system("q7hw sd set 0 on > /tmp/sd_set.txt");
//stopwatch.stop(true);
std::system("q7hw sd set 0 off > /tmp/sd_set.txt");
//stopwatch.stop(true);
}
FileSystemTest::~FileSystemTest() {
}

View File

@ -0,0 +1,18 @@
#ifndef BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
#define BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
enum SdCard {
SDC0,
SDC1
};
class FileSystemTest {
public:
FileSystemTest();
virtual~ FileSystemTest();
private:
};
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */

View File

@ -0,0 +1,67 @@
#include "Q7STestTask.h"
#include "fsfw/timemanager/Stopwatch.h"
#include "fsfw/tasks/TaskFactory.h"
#include "bsp_q7s/memory/scratchApi.h"
#include <iostream>
#include <fstream>
#include <cstdio>
Q7STestTask::Q7STestTask(object_id_t objectId): TestTask(objectId) {
}
ReturnValue_t Q7STestTask::performOneShotAction() {
//sdCardTests();
testScratchApi();
return TestTask::performOneShotAction();
}
void Q7STestTask::sdCardTests() {
using namespace std;
Stopwatch stopwatch;
int result = std::system("q7hw sd info all > /tmp/sd_status.txt");
if(result != 0) {
sif::debug << "system call failed with " << result << endl;
}
ifstream sdStatus("/tmp/sd_status.txt");
string line;
uint8_t idx = 0;
while (std::getline(sdStatus, line)) {
std::istringstream iss(line);
string word;
while(iss >> word) {
if(word == "on") {
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
}
else if(word == "off") {
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
}
}
idx++;
}
std::remove("/tmp/sd_status.txt");
}
void Q7STestTask::fileTests() {
using namespace std;
ofstream testFile("/tmp/test.txt");
testFile << "Hallo Welt" << endl;
testFile.close();
system("echo \"Hallo Welt\" > /tmp/test2.txt");
system("echo \"Hallo Welt\"");
}
void Q7STestTask::testScratchApi() {
ReturnValue_t result = scratch::writeNumber("TEST", 1);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "Q7STestTask::scratchApiTest: Writing number failed" << std::endl;
}
int number = 0;
result = scratch::readNumber("TEST", number);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
}
}

View File

@ -0,0 +1,20 @@
#ifndef BSP_Q7S_BOARDTEST_Q7STESTTASK_H_
#define BSP_Q7S_BOARDTEST_Q7STESTTASK_H_
#include "test/testtasks/TestTask.h"
class Q7STestTask: public TestTask {
public:
Q7STestTask(object_id_t objectId);
private:
ReturnValue_t performOneShotAction() override;
void sdCardTests();
void fileTests();
void testScratchApi();
};
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */

View File

@ -0,0 +1,6 @@
target_sources(${TARGET_NAME} PRIVATE
)

View File

@ -0,0 +1,6 @@
target_sources(${TARGET_NAME} PRIVATE
CoreController.cpp
obsw.cpp
InitMission.cpp
ObjectFactory.cpp
)

View File

@ -0,0 +1,148 @@
#include "CoreController.h"
#include "q7sConfig.h"
#include "../memory/SdCardManager.h"
CoreController::CoreController(object_id_t objectId):
ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) {
}
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
return HasReturnvaluesIF::RETURN_OK;
}
void CoreController::performControlOperation() {
}
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return HasReturnvaluesIF::RETURN_OK;
}
LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) {
return nullptr;
}
ReturnValue_t CoreController::initialize() {
return sdCardInit();
}
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t CoreController::sdCardInit() {
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
sif::info << "No SD card initialization will be performed" << std::endl;
return HasReturnvaluesIF::RETURN_OK;
#else
SdCardManager* sdcMan = SdCardManager::instance();
// Create update status file
ReturnValue_t result = sdcMan->updateSdCardStateFile();
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Updating SD card state file failed"
<< std::endl;
}
auto sdStatus = std::pair<sd::SdStatus, sd::SdStatus>(sd::SdStatus::OFF, sd::SdStatus::OFF);
result = sdcMan->getSdCardActiveStatus(sdStatus);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Getting SD card activity status failed" << std::endl;
}
// Use a lambda to avoid duplicate code
auto setUpSdCard = [&](sd::SdCard sdCard, sd::SdStatus status, std::string sdString) {
std::string mountString;
if(sdCard == sd::SdCard::SLOT_0) {
mountString = SdCardManager::SD_0_MOUNT_POINT;
}
else {
mountString = SdCardManager::SD_1_MOUNT_POINT;
}
if(status == sd::SdStatus::OFF) {
sif::info << "Switching on and mounting SD card " << sdString << " at " <<
mountString << std::endl;
return sdcMan->switchOnSdCard(sdCard, true, &sdStatus);
}
else if(status == sd::SdStatus::ON) {
sif::info << "Mounting SD card " << sdString << " at " << mountString << std::endl;
return sdcMan->mountSdCard(sdCard);
}
else {
sif::info << "SD card " << sdString << " already on and mounted at " <<
mountString << std::endl;
return SdCardManager::ALREADY_MOUNTED;
}
};
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
result = sdcMan->getPreferredSdCard(preferredSdCard);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Could not get preferred SD card information from the scratch buffer"
<< std::endl;
}
std::string preferredString;
sd::SdStatus preferredStatus = sd::SdStatus::OFF;
sd::SdStatus otherStatus = sd::SdStatus::OFF;
std::string otherString;
sd::SdCard otherSdc = sd::SdCard::SLOT_0;
if(preferredSdCard == sd::SdCard::SLOT_0) {
preferredStatus = sdStatus.first;
preferredString = "0";
otherSdc = sd::SdCard::SLOT_1;
otherStatus = sdStatus.second;
otherString = "1";
}
else {
preferredString = "1";
preferredStatus = sdStatus.second;
otherStatus = sdStatus.first;
otherSdc = sd::SdCard::SLOT_0;
otherString = "0";
}
sif::info << "Cold redundant SD card configuration, preferred SD card " <<
preferredString << std::endl;
result = setUpSdCard(preferredSdCard, preferredStatus, preferredString);
if(result != SdCardManager::ALREADY_MOUNTED and result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Setting up preferred card " << otherString <<
" in cold redundant mode failed" << std::endl;
// Try other SD card and mark set up operation as failed
setUpSdCard(otherSdc, otherStatus, otherString);
result = HasReturnvaluesIF::RETURN_FAILED;
}
if(result != HasReturnvaluesIF::RETURN_FAILED and otherStatus != sd::SdStatus::OFF) {
sif::info << "Switching off secondary SD card " << otherString << std::endl;
// Switch off other SD card in cold redundant mode if setting up preferred one walked
// without issues
result = sdcMan->switchOffSdCard(otherSdc, otherStatus, &sdStatus);
if(result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_OFF) {
sif::warning << "Switching off secondary SD card " << otherString <<
" in cold redundant mode failed" << std::endl;
}
}
// Update status file
sdcMan->updateSdCardStateFile();
return HasReturnvaluesIF::RETURN_OK;
#elif Q7S_SD_CARD_CONFIG == Q7S_SD_HOT_REDUNDANT
sif::info << "Hot redundant SD card configuration" << std::endl;
setUpSdCard(sd::SdCard::SLOT_0, sdStatus.first, "0");
setUpSdCard(sd::SdCard::SLOT_1, sdStatus.second, "1");
// Update status file
sdcMan->updateSdCardStateFile();
return HasReturnvaluesIF::RETURN_OK;
#endif
#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */
}

View File

@ -0,0 +1,26 @@
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
#define BSP_Q7S_CORE_CORECONTROLLER_H_
#include "fsfw/controller/ExtendedControllerBase.h"
class CoreController: public ExtendedControllerBase {
public:
CoreController(object_id_t objectId);
ReturnValue_t initialize() override;
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
void performControlOperation() override;
private:
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode);
ReturnValue_t sdCardInit();
};
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */

View File

@ -0,0 +1,269 @@
#include "InitMission.h"
#include "ObjectFactory.h"
#include "OBSWConfig.h"
#include "pollingsequence/pollingSequenceFactory.h"
#include <mission/utility/InitMission.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream>
/* This is configured for linux without CR */
#ifdef LINUX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR", false, false, true);
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF *objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
}
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(factory == nullptr) {
/* Should never happen ! */
return;
}
#if OBSW_PRINT_MISSED_DEADLINES == 1
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
#else
void (*missedDeadlineFunc) (void) = nullptr;
#endif
PeriodicTaskIF* coreController = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = coreController->addComponent(objects::CORE_CONTROLLER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
}
/* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UDP_BRIDGE", objects::UDP_BRIDGE);
}
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UDP_POLLING", objects::UDP_POLLING_TASK);
}
#if TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
/* PUS Services */
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
}
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusEvents->addComponent(objects::EVENT_MANAGER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
}
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
}
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
}
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
#if TE0720 == 0
//TODO: Add handling of missed deadlines
/* Polling Sequence Table Default */
#if Q7S_ADD_SPI_TEST == 0
FixedTimeslotTaskIF* spiPst = factory->createFixedTimeslotTask(
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
#endif
FixedTimeslotTaskIF* uartPst = factory->createFixedTimeslotTask(
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
result = pst::pstUart(uartPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
FixedTimeslotTaskIF* gpioPst = factory->createFixedTimeslotTask(
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
result = pst::pstGpio(gpioPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
FixedTimeslotTaskIF* i2cPst = factory->createFixedTimeslotTask(
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
result = pst::pstI2c(i2cPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
FixedTimeslotTaskIF* gomSpacePstTask = factory->createFixedTimeslotTask(
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstGompaceCan(gomSpacePstTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
}
#else /* TE7020 == 0 */
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
missedDeadlineFunc);
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
}
#endif /* TE7020 == 1 */
#if OBSW_ADD_TEST_CODE == 1
PeriodicTaskIF* testTask = factory->createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#if Q7S_ADD_SPI_TEST == 1
result = testTask->addComponent(objects::SPI_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if TE0720 == 1 && TEST_LIBGPIOD == 1
result = testTask->addComponent(objects::LIBGPIOD_TEST);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
}
#endif /* TE0720 == 1 && TEST_LIBGPIOD == 1 */
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
coreController->startTask();
#if TE0720 == 0
uartPst->startTask();
gpioPst->startTask();
i2cPst->startTask();
#if Q7S_ADD_SPI_TEST == 0
gomSpacePstTask->startTask();
spiPst->startTask();
#endif /* Q7S_ADD_SPI_TEST == 0 */
#elif TE0720 == 1 && Q7S_ADD_SPI_TEST == 0
pollingSequenceTaskTE0720->startTask();
#endif
pusVerification->startTask();
pusEvents->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif
#if TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
sif::info << "Tasks started.." << std::endl;
}

View File

@ -0,0 +1,9 @@
#ifndef BSP_Q7S_INITMISSION_H_
#define BSP_Q7S_INITMISSION_H_
namespace initmission {
void initMission();
void initTasks();
};
#endif /* BSP_Q7S_INITMISSION_H_ */

View File

@ -0,0 +1,705 @@
#include <bsp_q7s/boardtest/Q7STestTask.h>
#include "ObjectFactory.h"
#include "OBSWConfig.h"
#include "tmtc/apid.h"
#include "devices/addresses.h"
#include "devices/gpioIds.h"
#include "tmtc/pusIds.h"
#include "devices/powerSwitcherList.h"
#include "spiConf.h"
#include "bsp_q7s/gpio/gpioCallbacks.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/spiCallbacks/rwSpiCallback.h"
#include <linux/devices/HeaterHandler.h>
#include <linux/devices/SolarArrayDeploymentHandler.h>
#include <linux/devices/devicedefinitions/SusDefinitions.h>
#include <linux/devices/SusHandler.h>
#include <linux/csp/CspCookie.h>
#include <linux/csp/CspComIF.h>
#include <mission/core/GenericFactory.h>
#include <mission/devices/PDU1Handler.h>
#include <mission/devices/PDU2Handler.h>
#include <mission/devices/ACUHandler.h>
#include <mission/devices/PCDUHandler.h>
#include <mission/devices/P60DockHandler.h>
#include <mission/devices/Tmp1075Handler.h>
#include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/IMTQHandler.h>
#include <mission/devices/SyrlinksHkHandler.h>
#include <mission/devices/MGMHandlerLIS3MDL.h>
#include <mission/devices/MGMHandlerRM3100.h>
#include <mission/devices/PlocHandler.h>
#include <mission/devices/RadiationSensorHandler.h>
#include <mission/devices/RwHandler.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
#include <mission/devices/devicedefinitions/PlocDefinitions.h>
#include <mission/devices/devicedefinitions/RadSensorDefinitions.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/devices/devicedefinitions/RwDefinitions.h>
#include <mission/utility/TmFunnel.h>
#include <linux/obc/CCSDSIPCoreBridge.h>
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/uart/UartCookie.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
#include <fsfw_hal/linux/i2c/I2cCookie.h>
#include <fsfw_hal/linux/i2c/I2cComIF.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/tmtcpacket/pus/tm.h>
/* UDP server includes */
#include <fsfw/osal/common/UdpTmTcBridge.h>
#include <fsfw/osal/common/UdpTcPollingTask.h>
#include <linux/boardtest/SpiTestClass.h>
#if TEST_LIBGPIOD == 1
#include <linux/boardtest/LibgpiodTest.h>
#endif
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
/* Communication interfaces */
new CspComIF(objects::CSP_COM_IF);
new I2cComIF(objects::I2C_COM_IF);
new UartComIF(objects::UART_COM_IF);
#if Q7S_ADD_SPI_TEST == 0
new SpiComIF(objects::SPI_COM_IF, gpioComIF);
#endif /* Q7S_ADD_SPI_TEST == 0 */
new CoreController(objects::CORE_CONTROLLER);
#if TE0720 == 1
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
#else
I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
#endif
/* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(
objects::TMP1075_HANDLER_1, objects::I2C_COM_IF,
i2cCookieTmp1075tcs1);
(void) tmp1075Handler_1;
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF,
i2cCookieTmp1075tcs2);
(void) tmp1075Handler_2;
#if TE0720 == 0
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH,
addresses::P60DOCK);
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH,
addresses::PDU1);
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH,
addresses::PDU2);
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH,
addresses::ACU);
/* Device Handler */
P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER,
objects::CSP_COM_IF, p60DockCspCookie);
PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER,
objects::CSP_COM_IF, pdu1CspCookie);
PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER,
objects::CSP_COM_IF, pdu2CspCookie);
ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER,
objects::CSP_COM_IF, acuCspCookie);
new PCDUHandler(objects::PCDU_HANDLER, 50);
/**
* Setting PCDU devices to mode normal immediately after start up because PCDU is always
* running.
*/
/** For now this needs to be commented out because there is no PCDU connected to the OBC */
// p60dockhandler->setModeNormal();
// pdu1handler->setModeNormal();
// pdu2handler->setModeNormal();
// acuhandler->setModeNormal();
(void) p60dockhandler;
(void) pdu1handler;
(void) pdu2handler;
(void) acuhandler;
/* Adding gpios for chip select decoding to the gpioComIf */
gpioCallbacks::initSpiCsDecoder(gpioComIF);
GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip5"), 19,
std::string("Chip Select Radiation Sensor"), gpio::OUT, 1);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor);
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED);
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = new GpioCallback(std::string("Chip select SUS 1"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 2"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 3"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 4"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 5"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 6"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 7"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 8"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 9"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 10"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 11"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 12"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio);
susgpio = new GpioCallback(std::string("Chip select SUS 13"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::MAX1227_SPI_FREQ);
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF, gpioIds::CS_SUS_1);
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF, gpioIds::CS_SUS_2);
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF, gpioIds::CS_SUS_3);
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF, gpioIds::CS_SUS_4);
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF, gpioIds::CS_SUS_5);
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF, gpioIds::CS_SUS_6);
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF, gpioIds::CS_SUS_7);
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF, gpioIds::CS_SUS_8);
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF, gpioIds::CS_SUS_9);
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF, gpioIds::CS_SUS_10);
new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11, gpioComIF, gpioIds::CS_SUS_11);
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF, gpioIds::CS_SUS_12);
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF, gpioIds::CS_SUS_13);
#if OBSW_ADD_ACS_BOARD == 1
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
GpiodRegular* gpio = nullptr;
gpio = new GpiodRegular(std::string("gpiochip5"), 1, std::string("CS_GYRO_0_ADIS"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 7, std::string("CS_GYRO_1_L3G"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 3, std::string("CS_GYRO_2_L3G"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_L3G_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 5, std::string("CS_MGM_0_LIS3_A"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 16, std::string("CS_MGM_1_RM3100_A"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip6"), 0, std::string("CS_MGM_2_LIS3_B"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 10, std::string("CS_MGM_3_RM3100_B"),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
gpioComIF->addGpios(gpioCookieAcsBoard);
std::string spiDev = "/dev/spidev2.0";
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmLis3Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
auto mgmLis3Handler2 = new MGMHandlerLIS3MDL(objects::MGM_2_LIS3_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmLis3Handler2->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmRm3100Handler->setStartUpImmediately();
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_3_RM3100_HANDLER,
objects::SPI_COM_IF, spiCookie);
mgmRm3100Handler->setStartUpImmediately();
//TODO: Adis Gyro (Gyro 0 Side A)
/* Gyro 1 Side A */
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie);
gyroL3gHandler->setStartUpImmediately();
/* Gyro 2 Side B */
spiCookie = new SpiCookie(addresses::GYRO_2_L3G, gpioIds::GYRO_2_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_L3G_HANDLER, objects::SPI_COM_IF,
spiCookie);
gyroL3gHandler->setStartUpImmediately();
#endif
GpioCookie* heaterGpiosCookie = new GpioCookie;
/* Pin H2-11 on stack connector */
GpiodRegular* gpioConfigHeater0 = new GpiodRegular(std::string("gpiochip7"), 6,
std::string("Heater0"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
/* Pin H2-12 on stack connector */
GpiodRegular* gpioConfigHeater1 = new GpiodRegular(std::string("gpiochip7"), 12,
std::string("Heater1"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
/* Pin H2-13 on stack connector */
GpiodRegular* gpioConfigHeater2 = new GpiodRegular(std::string("gpiochip7"), 7,
std::string("Heater2"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2);
GpiodRegular* gpioConfigHeater3 = new GpiodRegular(std::string("gpiochip7"), 5,
std::string("Heater3"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3);
GpiodRegular* gpioConfigHeater4 = new GpiodRegular(std::string("gpiochip7"), 3,
std::string("Heater4"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4);
GpiodRegular* gpioConfigHeater5 = new GpiodRegular(std::string("gpiochip7"), 0,
std::string("Heater5"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5);
GpiodRegular* gpioConfigHeater6 = new GpiodRegular(std::string("gpiochip7"), 1,
std::string("Heater6"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6);
GpiodRegular* gpioConfigHeater7 = new GpiodRegular(std::string("gpiochip7"), 11,
std::string("Heater7"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN);
GpioCookie* solarArrayDeplCookie = new GpioCookie;
GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular(std::string("gpiochip7"), 4,
std::string("DeplSA1"), gpio::OUT, 0);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0);
GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular(std::string("gpiochip7"), 2,
std::string("DeplSA2"), gpio::OUT, 0);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1);
//TODO: Find out burn time. For now set to 1000 ms.
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
solarArrayDeplCookie, objects::PCDU_HANDLER, pcduSwitches::DEPLOYMENT_MECHANISM,
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER,
std::string("/dev/ttyUL0"), UartModes::NON_CANONICAL, 38400, SYRLINKS::MAX_REPLY_SIZE);
syrlinksUartCookie->setParityEven();
SyrlinksHkHandler* syrlinksHkHandler = new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER,
objects::UART_COM_IF, syrlinksUartCookie);
syrlinksHkHandler->setModeNormal();
#if Q7S_ADD_RTD_DEVICES == 1
GpioCookie* rtdGpioCookie = new GpioCookie;
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC3, gpioRtdIc3);
GpioCallback* gpioRtdIc4 = new GpioCallback(std::string("Chip select RTD IC4"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC4, gpioRtdIc4);
GpioCallback* gpioRtdIc5 = new GpioCallback(std::string("Chip select RTD IC5"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC5, gpioRtdIc5);
GpioCallback* gpioRtdIc6 = new GpioCallback(std::string("Chip select RTD IC6"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC6, gpioRtdIc6);
GpioCallback* gpioRtdIc7 = new GpioCallback(std::string("Chip select RTD IC7"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC7, gpioRtdIc7);
GpioCallback* gpioRtdIc8 = new GpioCallback(std::string("Chip select RTD IC8"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC8, gpioRtdIc8);
GpioCallback* gpioRtdIc9 = new GpioCallback(std::string("Chip select RTD IC9"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC9, gpioRtdIc9);
GpioCallback* gpioRtdIc10 = new GpioCallback(std::string("Chip select RTD IC10"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC10, gpioRtdIc10);
GpioCallback* gpioRtdIc11 = new GpioCallback(std::string("Chip select RTD IC11"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC11, gpioRtdIc11);
GpioCallback* gpioRtdIc12 = new GpioCallback(std::string("Chip select RTD IC12"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC12, gpioRtdIc12);
GpioCallback* gpioRtdIc13 = new GpioCallback(std::string("Chip select RTD IC13"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC13, gpioRtdIc13);
GpioCallback* gpioRtdIc14 = new GpioCallback(std::string("Chip select RTD IC14"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC14, gpioRtdIc14);
GpioCallback* gpioRtdIc15 = new GpioCallback(std::string("Chip select RTD IC15"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC15, gpioRtdIc15);
GpioCallback* gpioRtdIc16 = new GpioCallback(std::string("Chip select RTD IC16"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC16, gpioRtdIc16);
GpioCallback* gpioRtdIc17 = new GpioCallback(std::string("Chip select RTD IC17"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC17, gpioRtdIc17);
GpioCallback* gpioRtdIc18 = new GpioCallback(std::string("Chip select RTD IC18"), gpio::OUT, 1,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC18, gpioRtdIc18);
gpioComIF->addGpios(rtdGpioCookie);
SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC3, gpioIds::RTD_IC3,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_3, 2000000);
SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC4, gpioIds::RTD_IC4,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC5, gpioIds::RTD_IC5,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC6, gpioIds::RTD_IC6,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC7, gpioIds::RTD_IC7,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC8, gpioIds::RTD_IC8,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC9, gpioIds::RTD_IC9,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC10, gpioIds::RTD_IC10,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC11, gpioIds::RTD_IC11,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC12, gpioIds::RTD_IC12,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC13, gpioIds::RTD_IC13,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC14, gpioIds::RTD_IC14,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC15, gpioIds::RTD_IC15,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 3900000);
SpiCookie* spiRtdIc16 = new SpiCookie(addresses::RTD_IC16, gpioIds::RTD_IC16,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc17 = new SpiCookie(addresses::RTD_IC17, gpioIds::RTD_IC17,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
SpiCookie* spiRtdIc18 = new SpiCookie(addresses::RTD_IC18, gpioIds::RTD_IC18,
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
spi::SpiModes::MODE_1, 2000000);
Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3, objects::SPI_COM_IF, spiRtdIc3, 0); // 0 is switchId
Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4, objects::SPI_COM_IF, spiRtdIc4, 0);
Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5, objects::SPI_COM_IF, spiRtdIc5, 0);
Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6, objects::SPI_COM_IF, spiRtdIc6, 0);
Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7, objects::SPI_COM_IF, spiRtdIc7, 0);
Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8, objects::SPI_COM_IF, spiRtdIc8, 0);
Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9, objects::SPI_COM_IF, spiRtdIc9, 0);
Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC10, objects::SPI_COM_IF, spiRtdIc10, 0);
Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC11, objects::SPI_COM_IF, spiRtdIc11, 0);
Max31865PT1000Handler* rtdIc12 = new Max31865PT1000Handler(objects::RTD_IC12, objects::SPI_COM_IF, spiRtdIc12, 0);
Max31865PT1000Handler* rtdIc13 = new Max31865PT1000Handler(objects::RTD_IC13, objects::SPI_COM_IF, spiRtdIc13, 0);
Max31865PT1000Handler* rtdIc14 = new Max31865PT1000Handler(objects::RTD_IC14, objects::SPI_COM_IF, spiRtdIc14, 0);
Max31865PT1000Handler* rtdIc15 = new Max31865PT1000Handler(objects::RTD_IC15, objects::SPI_COM_IF, spiRtdIc15, 0);
Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16, objects::SPI_COM_IF, spiRtdIc16, 0);
Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17, objects::SPI_COM_IF, spiRtdIc17, 0);
Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0);
(void) rtdIc3;
(void) rtdIc4;
(void) rtdIc5;
(void) rtdIc6;
(void) rtdIc7;
(void) rtdIc8;
(void) rtdIc9;
(void) rtdIc10;
(void) rtdIc11;
(void) rtdIc12;
(void) rtdIc13;
(void) rtdIc14;
(void) rtdIc15;
(void) rtdIc16;
(void) rtdIc17;
(void) rtdIc18;
#endif /* Q7S_ADD_RTD_DEVICES == 1 */
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
std::string("/dev/i2c-0"));
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
UartCookie* plocUartCookie = new UartCookie(objects::RW1, std::string("/dev/ttyUL3"),
UartModes::NON_CANONICAL, 115200, PLOC::MAX_REPLY_SIZE);
new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF, plocUartCookie);
GpioCookie* gpioCookieRw = new GpioCookie;
GpioCallback* csRw1 = new GpioCallback(std::string("Chip select reaction wheel 1"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1);
GpioCallback* csRw2 = new GpioCallback(std::string("Chip select reaction wheel 2"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2);
GpioCallback* csRw3 = new GpioCallback(std::string("Chip select reaction wheel 3"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3);
GpioCallback* csRw4 = new GpioCallback(std::string("Chip select reaction wheel 4"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
GpiodRegular* enRw1 = new GpiodRegular(std::string("gpiochip5"), 7,
std::string("Enable reaction wheel 1"), gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
GpiodRegular* enRw2 = new GpiodRegular(std::string("gpiochip5"), 3,
std::string("Enable reaction wheel 2"), gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
GpiodRegular* enRw3 = new GpiodRegular(std::string("gpiochip5"), 11,
std::string("Enable reaction wheel 3"), gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3);
GpiodRegular* enRw4 = new GpiodRegular(std::string("gpiochip5"), 6,
std::string("Enable reaction wheel 4"), gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4);
/**
* This GPIO is only internally connected to the SPI MUX module and responsible to disconnect
* the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core.
* Per default the PS SPI is selected (EMIO = 0).
*/
GpiodRegular* spiMux = new GpiodRegular(std::string("gpiochip11"), 54,
std::string("EMIO 0 SPI Mux"), gpio::OUT, 0);
gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux);
gpioComIF->addGpios(gpioCookieRw);
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, "/dev/spidev3.0",
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rw2SpiCookie = new SpiCookie(addresses::RW2, gpioIds::CS_RW2, "/dev/spidev3.0",
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rw3SpiCookie = new SpiCookie(addresses::RW3, gpioIds::CS_RW3, "/dev/spidev3.0",
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rw4SpiCookie = new SpiCookie(addresses::RW4, gpioIds::CS_RW4, "/dev/spidev3.0",
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
nullptr);
auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF,
gpioIds::EN_RW1);
rw1SpiCookie->setCallbackArgs(rwHandler1);
auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF,
gpioIds::EN_RW2);
rw2SpiCookie->setCallbackArgs(rwHandler2);
auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF,
gpioIds::EN_RW3);
rw3SpiCookie->setCallbackArgs(rwHandler3);
auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF,
gpioIds::EN_RW4);
rw4SpiCookie->setCallbackArgs(rwHandler4);
#endif /* TE0720 == 0 */
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
new Q7STestTask(objects::TEST_TASK);
#endif
#if TE0720 == 1 && TEST_LIBGPIOD == 1
/* Configure MIO0 as input */
GpiodRegular gpioConfigMio0(std::string("gpiochip0"), 0,
std::string("MIO0"), gpio::IN, 0);
GpioCookie* gpioCookie = new GpioCookie;
gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#endif
#if TE0720 == 1 && TEST_SUS_HANDLER == 1
GpioCookie* gpioCookieSus = new GpioCookie;
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
std::string("Chip Select Sus Sensor"), gpio::OUT, 1);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus);
gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus = new SpiCookie(addresses::SUS_1, std::string("/dev/spidev1.0"),
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
gpioIds::CS_SUS_1);
#endif
#if TE0720 == 1 && TEST_CCSDS_BRIDGE == 1
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
GpiodRegular* papbBusyN = new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_N"));
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
GpiodRegular* papbEmpty = new GpiodRegular(std::string("gpiochip0"), 1,
std::string("Chip Select Sus Sensor"));
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
gpioComIF->addGpios(gpioCookieCcsdsIp);
new CCSDSIPCoreBridge(objects::CCSDS_IP_CORE_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE, gpioComIF, std::string("/dev/uio0"),
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
#endif
#if TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1
GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
std::string("Chip select radiation sensor"), gpio::OUT, 1);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor);
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED);
RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
objects::SPI_COM_IF, spiCookieRadSensor);
radSensor->setStartUpImmediately();
#endif
#if TE0720 == 1 && TEST_PLOC_HANDLER == 1
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
PLOC::MAX_REPLY_SIZE);
/* Testing PlocHandler on TE0720-03-1CFA */
PlocHandler* plocHandler = new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF,
plocUartCookie);
plocHandler->setStartUpImmediately();
#endif
#if TE0720 == 1 && TE0720_HEATER_TEST == 1
/* Configuration for MIO0 on TE0720-03-1CFA */
GpiodRegular* heaterGpio = new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0);
GpioCookie* gpioCookie = new GpioCookie;
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
#endif
#if Q7S_ADD_SPI_TEST == 1
new SpiTestClass(objects::SPI_TEST, gpioComIF);
#endif
}

View File

@ -0,0 +1,9 @@
#ifndef BSP_Q7S_OBJECTFACTORY_H_
#define BSP_Q7S_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce(void* args);
};
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */

25
bsp_q7s/core/obsw.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "obsw.h"
#include "OBSWVersion.h"
#include "InitMission.h"
#include "fsfw/tasks/TaskFactory.h"
#include <iostream>
int obsw::obsw() {
std::cout << "-- EIVE OBSW --" << std::endl;
#if TE0720 == 0
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
#else
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
#endif
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission();
for(;;) {
/* Suspend main thread by sleeping it. */
TaskFactory::delayTask(5000);
}
return 0;
}

10
bsp_q7s/core/obsw.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef BSP_Q7S_CORE_OBSW_H_
#define BSP_Q7S_CORE_OBSW_H_
namespace obsw {
int obsw();
};
#endif /* BSP_Q7S_CORE_OBSW_H_ */

View File

@ -0,0 +1,3 @@
target_sources(${TARGET_NAME} PRIVATE
gpioCallbacks.cpp
)

View File

@ -0,0 +1,338 @@
#include "gpioCallbacks.h"
#include <devices/gpioIds.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
namespace gpioCallbacks {
GpioIF* gpioComInterface;
void initSpiCsDecoder(GpioIF* gpioComIF) {
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
gpioComInterface = gpioComIF;
GpioCookie* spiMuxGpios = new GpioCookie;
/** Setting mux bit 1 to low will disable IC21 on the interface board */
GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13,
std::string("SPI Mux Bit 1"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1);
/** Setting mux bit 2 to low disables IC1 on the TCS board */
GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("gpiochip7"), 14,
std::string("SPI Mux Bit 2"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2);
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("gpiochip7"), 15,
std::string("SPI Mux Bit 3"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3);
/** The following gpios can take arbitrary initial values */
GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("gpiochip7"), 16,
std::string("SPI Mux Bit 4"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4);
GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("gpiochip7"), 17,
std::string("SPI Mux Bit 5"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5);
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 18,
std::string("SPI Mux Bit 6"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6);
GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17,
std::string("EN_RW_CS"), gpio::OUT, 1);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value,
void* args) {
if (gpioComInterface == nullptr) {
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl;
return;
}
/* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) {
return;
}
if (value == 1) {
disableAllDecoder();
}
else if (value == 0) {
switch (gpioId) {
case(gpioIds::RTD_IC3): {
enableDecoderTcsIc1();
selectY7();
break;
}
case(gpioIds::RTD_IC4): {
enableDecoderTcsIc1();
selectY6();
break;
}
case(gpioIds::RTD_IC5): {
enableDecoderTcsIc1();
selectY5();
break;
}
case(gpioIds::RTD_IC6): {
enableDecoderTcsIc1();
selectY4();
break;
}
case(gpioIds::RTD_IC7): {
enableDecoderTcsIc1();
selectY3();
break;
}
case(gpioIds::RTD_IC8): {
enableDecoderTcsIc1();
selectY2();
break;
}
case(gpioIds::RTD_IC9): {
enableDecoderTcsIc1();
selectY1();
break;
}
case(gpioIds::RTD_IC10): {
enableDecoderTcsIc1();
selectY0();
break;
}
case(gpioIds::RTD_IC11): {
enableDecoderTcsIc2();
selectY7();
break;
}
case(gpioIds::RTD_IC12): {
enableDecoderTcsIc2();
selectY6();
break;
}
case(gpioIds::RTD_IC13): {
enableDecoderTcsIc2();
selectY5();
break;
}
case(gpioIds::RTD_IC14): {
enableDecoderTcsIc2();
selectY4();
break;
}
case(gpioIds::RTD_IC15): {
enableDecoderTcsIc2();
selectY3();
break;
}
case(gpioIds::RTD_IC16): {
enableDecoderTcsIc2();
selectY2();
break;
}
case(gpioIds::RTD_IC17): {
enableDecoderTcsIc2();
selectY1();
break;
}
case(gpioIds::RTD_IC18): {
enableDecoderTcsIc2();
selectY0();
break;
}
case(gpioIds::CS_SUS_1): {
enableDecoderInterfaceBoardIc1();
selectY0();
break;
}
case(gpioIds::CS_SUS_2): {
enableDecoderInterfaceBoardIc1();
selectY1();
break;
}
case(gpioIds::CS_SUS_3): {
enableDecoderInterfaceBoardIc2();
selectY0();
break;
}
case(gpioIds::CS_SUS_4): {
enableDecoderInterfaceBoardIc2();
selectY1();
break;
}
case(gpioIds::CS_SUS_5): {
enableDecoderInterfaceBoardIc2();
selectY2();
break;
}
case(gpioIds::CS_SUS_6): {
enableDecoderInterfaceBoardIc1();
selectY2();
break;
}
case(gpioIds::CS_SUS_7): {
enableDecoderInterfaceBoardIc1();
selectY3();
break;
}
case(gpioIds::CS_SUS_8): {
enableDecoderInterfaceBoardIc2();
selectY3();
break;
}
case(gpioIds::CS_SUS_9): {
enableDecoderInterfaceBoardIc1();
selectY4();
break;
}
case(gpioIds::CS_SUS_10): {
enableDecoderInterfaceBoardIc1();
selectY5();
break;
}
case(gpioIds::CS_SUS_11): {
enableDecoderInterfaceBoardIc2();
selectY4();
break;
}
case(gpioIds::CS_SUS_12): {
enableDecoderInterfaceBoardIc2();
selectY5();
break;
}
case(gpioIds::CS_SUS_13): {
enableDecoderInterfaceBoardIc1();
selectY6();
break;
}
case(gpioIds::CS_RW1): {
enableRwDecoder();
selectY0();
break;
}
case(gpioIds::CS_RW2): {
enableRwDecoder();
selectY1();
break;
}
case(gpioIds::CS_RW3): {
enableRwDecoder();
selectY2();
break;
}
case(gpioIds::CS_RW4): {
enableRwDecoder();
selectY3();
break;
}
default:
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
}
else {
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
}
}
void enableDecoderTcsIc1() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
}
void enableDecoderTcsIc2() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
}
void enableDecoderInterfaceBoardIc1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
}
void enableDecoderInterfaceBoardIc2() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
}
void enableRwDecoder() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::EN_RW_CS);
}
void selectY0() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
}
void selectY1() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
}
void selectY2() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
}
void selectY3() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
}
void selectY4() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
}
void selectY5() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
}
void selectY6() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
}
void selectY7() {
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
}
void disableAllDecoder() {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
}
}

View File

@ -0,0 +1,67 @@
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
#define LINUX_GPIO_GPIOCALLBACKS_H_
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
#include <fsfw_hal/common/gpio/GpioIF.h>
namespace gpioCallbacks {
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board and the interface board.
*/
void initSpiCsDecoder(GpioIF* gpioComIF);
/**
* @brief This function implements the decoding to multiply gpios by using the decoder
* chips SN74LVC138APWR on the TCS board and the interface board.
*/
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args);
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the TCS board which is named to IC1 in the schematic.
*/
void enableDecoderTcsIc1();
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the TCS board which is named to IC2 in the schematic.
*/
void enableDecoderTcsIc2();
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC21 in the schematic.
*/
void enableDecoderInterfaceBoardIc1();
/**
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
* on the inteface board board which is named to IC22 in the schematic.
*/
void enableDecoderInterfaceBoardIc2();
/**
* @brief Enables the reaction wheel chip select decoder (IC3).
*/
void enableRwDecoder();
/**
* @brief This function disables all decoder.
*/
void disableAllDecoder();
/** The following functions enable the appropriate channel of the currently enabled decoder */
void selectY0();
void selectY1();
void selectY2();
void selectY3();
void selectY4();
void selectY5();
void selectY6();
void selectY7();
}
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */

23
bsp_q7s/main.cpp Normal file
View File

@ -0,0 +1,23 @@
#include "q7sConfig.h"
#if Q7S_SIMPLE_MODE == 0
#include "core/obsw.h"
#else
#include "simple/simple.h"
#endif
#include <iostream>
/**
* @brief This is the main program for the target hardware.
* @return
*/
int main(void)
{
using namespace std;
#if Q7S_SIMPLE_MODE == 0
return obsw::obsw();
#else
return simple::simple();
#endif
}

View File

@ -0,0 +1,5 @@
target_sources(${TARGET_NAME} PRIVATE
FileSystemHandler.cpp
SdCardManager.cpp
scratchApi.cpp
)

View File

@ -0,0 +1,184 @@
#include "FileSystemHandler.h"
#include "fsfw/tasks/TaskFactory.h"
#include "fsfw/memory/GenericFileSystemMessage.h"
#include "fsfw/ipc/QueueFactory.h"
#include <filesystem>
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler):
SystemObject(fileSystemHandler) {
mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE);
}
FileSystemHandler::~FileSystemHandler() {
QueueFactory::instance()->deleteMessageQueue(mq);
}
ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
while(true) {
try {
fileSystemHandlerLoop();
}
catch(std::bad_alloc& e) {
// Restart OBSW, hints at a memory leak
sif::error << "Allocation error in FileSystemHandler::performOperation"
<< e.what() << std::endl;
// TODO: If we trigger an event, it might not get sent because were restarting
// Set up an error file or a special flag in the scratch buffer.
// TODO: CoreController: Implement function to restart OBC
}
}
}
void FileSystemHandler::fileSystemHandlerLoop() {
CommandMessage filemsg;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
while(true) {
if(opCounter % 5 == 0) {
fileSystemCheckup();
}
result = mq->receiveMessage(&filemsg);
if(result == MessageQueueIF::EMPTY) {
break;
}
else if(result != HasReturnvaluesIF::RETURN_FAILED) {
sif::warning << "FileSystemHandler::performOperation: Message reception failed!"
<< std::endl;
break;
}
Command_t command = filemsg.getCommand();
switch(command) {
case(GenericFileSystemMessage::CMD_CREATE_DIRECTORY): {
break;
}
case(GenericFileSystemMessage::CMD_CREATE_FILE): {
break;
}
}
opCounter++;
}
// This task will have a low priority and will run permanently in the background
// so we will just run in a permanent loop here and check file system
// messages permanently
TaskFactory::instance()->delayTask(1000);
}
void FileSystemHandler::fileSystemCheckup() {
SdCardManager::SdStatusPair statusPair;
sdcMan->getSdCardActiveStatus(statusPair);
sd::SdCard preferredSdCard;
sdcMan->getPreferredSdCard(preferredSdCard);
if((preferredSdCard == sd::SdCard::SLOT_0) and
(statusPair.first == sd::SdStatus::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
}
if((preferredSdCard == sd::SdCard::SLOT_1) and
(statusPair.second == sd::SdStatus::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
}
else {
std::string sdString;
if(preferredSdCard == sd::SdCard::SLOT_0) {
sdString = "0";
}
else {
sdString = "1";
}
sif::warning << "FileSystemHandler::performOperation: Inconsistent" <<
" state detected. Preferred SD card is " << sdString <<
" but does not appear to be mounted. Attempting fix.." << std::endl;
// This function will appear to fix the inconsistent state
ReturnValue_t result = sdcMan->sanitizeState(&preferredSdCard, &statusPair);
if(result != HasReturnvaluesIF::RETURN_OK) {
// Oh no.
// TODO: Trigger medium severity event
sif::error << "Fix failed" << std::endl;
}
}
}
MessageQueueId_t FileSystemHandler::getCommandQueue() const {
return mq->getId();
}
ReturnValue_t FileSystemHandler::initialize() {
sdcMan = SdCardManager::instance();
sd::SdCard preferredSdCard;
ReturnValue_t result = sdcMan->getPreferredSdCard(preferredSdCard);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
if(preferredSdCard == sd::SdCard::SLOT_0) {
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
}
else if(preferredSdCard == sd::SdCard::SLOT_1) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const char *filename,
const uint8_t *data, size_t size, uint16_t packetNumber, void *args) {
// A double slash between repo and filename should not be an issue, so add it in any case
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
std::string(filename);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const char *filename,
const uint8_t *data, size_t size, void *args) {
// A double slash between repo and filename should not be an issue, so add it in any case
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
std::string(filename);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::deleteFile(const char *repositoryPath, const char *filename,
void *args) {
// A double slash between repo and filename should not be an issue, so add it in any case
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
std::string(filename);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, void *args) {
std::string fullPath = currentMountPrefix + std::string(repositoryPath);
if(std::filesystem::exists(fullPath)) {
return DIRECTORY_ALREADY_EXISTS;
}
if(std::filesystem::create_directory(fullPath)) {
return HasReturnvaluesIF::RETURN_OK;
}
sif::warning << "Creating directory " << fullPath << " failed" << std::endl;
return GENERIC_FILE_ERROR;
}
ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
bool deleteRecurively, void *args) {
std::string fullPath = currentMountPrefix + std::string(repositoryPath);
if(not std::filesystem::exists(fullPath)) {
return DIRECTORY_DOES_NOT_EXIST;
}
std::error_code err;
if(not deleteRecurively) {
if(std::filesystem::remove(fullPath, err)) {
return HasReturnvaluesIF::RETURN_OK;
}
else {
// Check error code. Most probably denied permissions because folder is not empty
}
}
else {
if(std::filesystem::remove_all(fullPath, err)) {
return HasReturnvaluesIF::RETURN_OK;
}
else {
// Check error code
}
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,56 @@
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
#include "SdCardManager.h"
#include "OBSWConfig.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/memory/HasFileSystemIF.h"
#include <string>
class FileSystemHandler: public SystemObject,
public ExecutableObjectIF,
public HasFileSystemIF {
public:
FileSystemHandler(object_id_t fileSystemHandler);
virtual~ FileSystemHandler();
ReturnValue_t performOperation(uint8_t) override;
ReturnValue_t initialize() override;
/**
* Function to get the MessageQueueId_t of the implementing object
* @return MessageQueueId_t of the object
*/
MessageQueueId_t getCommandQueue() const override;
private:
MessageQueueIF* mq = nullptr;
std::string currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
static constexpr uint32_t FS_MAX_QUEUE_SIZE = config::OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE;
SdCardManager* sdcMan = nullptr;
uint8_t opCounter = 0;
void fileSystemHandlerLoop();
void fileSystemCheckup();
ReturnValue_t appendToFile(const char* repositoryPath,
const char* filename, const uint8_t* data, size_t size,
uint16_t packetNumber, void* args = nullptr) override;
ReturnValue_t createFile(const char* repositoryPath,
const char* filename, const uint8_t* data = nullptr,
size_t size = 0, void* args = nullptr) override;
ReturnValue_t deleteFile(const char* repositoryPath,
const char* filename, void* args = nullptr) override;
ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) override;
ReturnValue_t removeDirectory(const char* repositoryPath, bool deleteRecurively = false,
void* args = nullptr) override;
};
#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */

View File

@ -0,0 +1,333 @@
#include "SdCardManager.h"
#include "scratchApi.h"
#include "linux/utility/utility.h"
#include "fsfw/ipc/MutexFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include <fstream>
#include <memory>
#include <filesystem>
SdCardManager* SdCardManager::factoryInstance = nullptr;
SdCardManager::SdCardManager() {
}
SdCardManager::~SdCardManager() {
}
void SdCardManager::create() {
if(factoryInstance == nullptr) {
factoryInstance = new SdCardManager();
}
}
SdCardManager* SdCardManager::instance() {
SdCardManager::create();
return SdCardManager::factoryInstance;
}
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
SdStatusPair* statusPair) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(statusPair == nullptr) {
statusPair = std::make_unique<SdStatusPair>().get();
result = getSdCardActiveStatus(*statusPair);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
// Not allowed, this function turns on one SD card
if(sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
sd::SdStatus targetStatus;
if(sdCard == sd::SdCard::SLOT_0) {
targetStatus = statusPair->first;
}
else if(sdCard == sd::SdCard::SLOT_1) {
targetStatus = statusPair->second;
}
auto switchCall = [&]() {
if(targetStatus == sd::SdStatus::ON) {
if(not doMountSdCard) {
return ALREADY_ON;
}
else {
return mountSdCard(sdCard);
}
}
else if(targetStatus == sd::SdStatus::MOUNTED) {
return ALREADY_MOUNTED;
}
else if(targetStatus == sd::SdStatus::OFF) {
return setSdCardState(sdCard, true);
}
else {
return HasReturnvaluesIF::RETURN_FAILED;
}
};
result = switchCall();
if(result != HasReturnvaluesIF::RETURN_OK or not doMountSdCard) {
return result;
}
return mountSdCard(sdCard);
}
ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard,
SdStatusPair* statusPair) {
std::pair<sd::SdStatus, sd::SdStatus> active;
ReturnValue_t result = getSdCardActiveStatus(active);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
// Not allowed, this function turns off one SD card
if(sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
if(sdCard == sd::SdCard::SLOT_0) {
if(active.first == sd::SdStatus::OFF) {
return ALREADY_OFF;
}
}
else if(sdCard == sd::SdCard::SLOT_1) {
if(active.second == sd::SdStatus::OFF) {
return ALREADY_OFF;
}
}
if(doUnmountSdCard) {
result = unmountSdCard(sdCard);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
return setSdCardState(sdCard, false);
}
ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
using namespace std;
string sdstring = "";
string statestring = "";
if(sdCard == sd::SdCard::SLOT_0) {
sdstring = "0";
}
else if(sdCard == sd::SdCard::SLOT_1) {
sdstring = "1";
}
if(on) {
statestring = "on";
}
else {
statestring = "off";
}
ostringstream command;
command << "q7hw sd set " << sdstring << " " << statestring;
int result = system(command.str().c_str());
if(result == 0) {
return HasReturnvaluesIF::RETURN_OK;
}
sif::warning << "SdCardManager::setSdCardState: system call failed with code " <<
result << std::endl;
return SYSTEM_CALL_ERROR;
}
ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatusPair& active) {
using namespace std;
if(not filesystem::exists(SD_STATE_FILE)) {
return STATUS_FILE_NEXISTS;
}
// Now the file should exist in any case. Still check whether it exists.
fstream sdStatus(SD_STATE_FILE);
if (not sdStatus.good()) {
return STATUS_FILE_NEXISTS;
}
string line;
uint8_t idx = 0;
sd::SdCard currentSd = sd::SdCard::SLOT_0;
// Process status file line by line
while (std::getline(sdStatus, line)) {
processSdStatusLine(active, line, idx, currentSd);
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
using namespace std;
if(sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
string mountDev;
string mountPoint;
if(sdCard == sd::SdCard::SLOT_0) {
mountDev = SD_0_DEV_NAME;
mountPoint = SD_0_MOUNT_POINT;
}
else if(sdCard == sd::SdCard::SLOT_1) {
mountDev = SD_1_DEV_NAME;
mountPoint = SD_1_MOUNT_POINT;
}
if(not filesystem::exists(mountDev)) {
sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to"
" turn on the SD card" << std::endl;
return MOUNT_ERROR;
}
string sdMountCommand = "mount " + mountDev + " " + mountPoint;
int result = system(sdMountCommand.c_str());
if (result != 0) {
utility::handleSystemError(result, "SdCardManager::mountSdCard");
return SYSTEM_CALL_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
using namespace std;
if(sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
string mountPoint;
if(sdCard == sd::SdCard::SLOT_0) {
mountPoint = SD_0_MOUNT_POINT;
}
else if(sdCard == sd::SdCard::SLOT_1) {
mountPoint = SD_1_MOUNT_POINT;
}
if(filesystem::is_empty(mountPoint)) {
// The mount point will always exist, but if it is empty, that is strong hint that
// the SD card was not mounted properly. Still proceed with operation.
sif::warning << "SdCardManager::unmountSdCard: Mount point is empty!" << std::endl;
}
string sdUnmountCommand = "umount " + mountPoint;
int result = system(sdUnmountCommand.c_str());
if (result != 0) {
utility::handleSystemError(result, "SdCardManager::unmountSdCard");
return SYSTEM_CALL_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SdCardManager::sanitizeState(sd::SdCard* prefSdCard, SdStatusPair* statusPair) {
if(prefSdCard == nullptr) {
prefSdCard = std::make_unique<sd::SdCard>(sd::SdCard::SLOT_0).get();
getPreferredSdCard(*prefSdCard);
}
if(statusPair == nullptr) {
statusPair = std::make_unique<SdStatusPair>().get();
getSdCardActiveStatus(*statusPair);
}
auto sanitizerFunc = [&](sd::SdCard prefSdCard) {
if(statusPair->first == sd::SdStatus::ON) {
return mountSdCard(prefSdCard);
}
else {
return switchOnSdCard(prefSdCard, true, statusPair);
}
};
return sanitizerFunc(*prefSdCard);
}
void SdCardManager::processSdStatusLine(std::pair<sd::SdStatus, sd::SdStatus> &active,
std::string& line, uint8_t& idx, sd::SdCard& currentSd) {
using namespace std;
istringstream iss(line);
string word;
bool slotLine = false;
bool mountLine = false;
while(iss >> word) {
if (word == "Slot") {
slotLine = true;
}
if(word == "Mounted") {
mountLine = true;
}
if(slotLine) {
if (word == "1:") {
currentSd = sd::SdCard::SLOT_1;
}
if(word == "on") {
if(currentSd == sd::SdCard::SLOT_0) {
active.first = sd::SdStatus::ON;
}
else {
active.second = sd::SdStatus::ON;
}
}
else if (word == "off") {
if(currentSd == sd::SdCard::SLOT_0) {
active.first = sd::SdStatus::OFF;
}
else {
active.second = sd::SdStatus::OFF;
}
}
}
if(mountLine) {
if(currentSd == sd::SdCard::SLOT_0) {
active.first = sd::SdStatus::MOUNTED;
}
else {
active.second = sd::SdStatus::MOUNTED;
}
}
if(idx > 5) {
sif::warning << "SdCardManager::sdCardActive: /tmp/sd_status.txt has more than 6 "
"lines and might be invalid!" << std::endl;
}
}
idx++;
}
ReturnValue_t SdCardManager::getPreferredSdCard(sd::SdCard& sdCard) const {
uint8_t prefSdCard = 0;
ReturnValue_t result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdCard);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
sdCard = static_cast<sd::SdCard>(prefSdCard);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
if(sdCard == sd::SdCard::BOTH) {
return HasReturnvaluesIF::RETURN_FAILED;
}
return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard));
}
ReturnValue_t SdCardManager::updateSdCardStateFile() {
// Use q7hw utility and pipe the command output into the state file
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
int result = std::system(updateCmd.c_str());
if(result == 0) {
return HasReturnvaluesIF::RETURN_OK;
}
sif::warning << "SdCardManager::updateSdCardStateFile: system call failed with code " <<
result << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -0,0 +1,159 @@
#ifndef BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
#define BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
#include "definitions.h"
#include "returnvalues/classIds.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include <cstdint>
#include <utility>
#include <string>
class MutexIF;
/**
* @brief Manages handling of SD cards like switching them on or off or getting the current
* state
*/
class SdCardManager {
friend class SdCardAccess;
public:
using SdStatusPair = std::pair<sd::SdStatus, sd::SdStatus>;
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
static constexpr ReturnValue_t ALREADY_ON =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t ALREADY_MOUNTED =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
static constexpr ReturnValue_t ALREADY_OFF =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 11);
static constexpr ReturnValue_t MOUNT_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 12);
static constexpr ReturnValue_t UNMOUNT_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14);
// C++17 does not support constexpr std::string yet
static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1";
static constexpr char SD_1_DEV_NAME[] = "/dev/mmcblk1p1";
static constexpr char SD_0_MOUNT_POINT[] = "/mnt/sd0";
static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1";
static constexpr char SD_STATE_FILE[] = "/tmp/sd_status.txt";
virtual ~SdCardManager();
static void create();
/**
* Returns the single instance of the SD card manager.
*/
static SdCardManager* instance();
/**
* Set the preferred SD card which will determine which SD card will be used as the primary
* SD card in hot redundant and cold redundant mode. This function will not switch the
* SD cards which are currently on and mounted, this needs to be implemented by
* an upper layer by using #switchOffSdCard , #switchOnSdCard and #updateSdCardStateFile
* @param sdCard
* @return
*/
ReturnValue_t setPreferredSdCard(sd::SdCard sdCard);
/**
* Get the currently configured preferred SD card
* @param sdCard
* @return
*/
ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const;
/**
* Switch on the specified SD card.
* @param sdCard
* @param doMountSdCard Mount the SD card after switching it on, which is necessary
* to use it
* @param statusPair If the status pair is already available, it can be passed here
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error
*/
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
SdStatusPair* statusPair = nullptr);
/**
* Switch off the specified SD card.
* @param sdCard
* @param doUnmountSdCard Unmount the SD card before switching the card off, which makes
* the operation safer
* @param statusPair If the status pair is already available, it can be passed here
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error
*/
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
SdStatusPair* statusPair = nullptr);
/**
* Update the state file or creates one if it does not exist. You need to call this
* function before calling #sdCardActive
* @return - RETURN_OK if the state file was updated successfully
* - SYSTEM_CALL_ERROR if the call to create the status file failed
*/
ReturnValue_t updateSdCardStateFile();
/**
* Get the state of the SD cards. If the state file does not exist, this function will
* take care of updating it. If it does not, the function will use the state file to get
* the status of the SD cards and set the field of the provided boolean pair.
* @param active Pair of booleans, where the first entry is the state of the first SD card
* and the second one the state of the second SD card
* @return - RETURN_OK if the state was read successfully
* - STATUS_FILE_FORMAT_INVALID if there was an issue with the state file. The user
* should call #updateSdCardStateFile again in that case
* - STATUS_FILE_NEXISTS if the status file does not exist
*/
ReturnValue_t getSdCardActiveStatus(SdStatusPair& active);
/**
* Mount the specified SD card. This is necessary to use it.
* @param sdCard
* @return
*/
ReturnValue_t mountSdCard(sd::SdCard sdCard);
/**
* Unmount the specified SD card. This is recommended before switching it off. The SD card
* can't be used after it has been unmounted.
* @param sdCard
* @return
*/
ReturnValue_t unmountSdCard(sd::SdCard sdCard);
/**
* In case that there is a discrepancy between the preferred SD card and the currently
* mounted one, this function will sanitize the state by attempting to mount the
* currently preferred SD card. If the caller already has state information, it can be
* passed into the function.
* @param prefSdCard Preferred SD card captured with #getPreferredSdCard
* @param statusPair Current SD card status capture with #getSdCardActiveStatus
* @throws std::bad_alloc if one of the two arguments was a nullptr and an allocation failed
* @return
*/
ReturnValue_t sanitizeState(sd::SdCard* prefSdCard = nullptr,
SdStatusPair* statusPair = nullptr);
private:
SdCardManager();
ReturnValue_t setSdCardState(sd::SdCard sdCard, bool on);
void processSdStatusLine(SdStatusPair& active, std::string& line, uint8_t& idx,
sd::SdCard& currentSd);
static SdCardManager* factoryInstance;
};
#endif /* BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_ */

View File

@ -0,0 +1,25 @@
#ifndef BSP_Q7S_MEMORY_DEFINITIONS_H_
#define BSP_Q7S_MEMORY_DEFINITIONS_H_
#include <cstdint>
namespace sd {
enum SdStatus: uint8_t {
OFF = 0,
ON = 1,
// A mounted SD card is on as well
MOUNTED = 2
};
enum SdCard: uint8_t {
SLOT_0,
SLOT_1,
BOTH
};
}
#endif /* BSP_Q7S_MEMORY_DEFINITIONS_H_ */

View File

@ -0,0 +1,12 @@
#include "scratchApi.h"
ReturnValue_t scratch::writeString(std::string name, std::string string) {
std::ostringstream oss;
oss << "xsc_scratch write " << name << " \"" << string << "\"";
int result = std::system(oss.str().c_str());
if(result != 0) {
utility::handleSystemError(result, "scratch::String");
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,72 @@
#ifndef BSP_Q7S_MEMORY_SCRATCHAPI_H_
#define BSP_Q7S_MEMORY_SCRATCHAPI_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "linux/utility/utility.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <type_traits>
#include <cstdlib>
/**
* @brief API for the scratch buffer
*/
namespace scratch {
static constexpr char PREFERED_SDC_KEY[] = "PREFSD";
namespace {
static uint8_t counter = 0;
}
template<typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
inline ReturnValue_t writeNumber(std::string name, T num) noexcept {
std::ostringstream oss;
oss << "xsc_scratch write " << name << " " << num;
int result = std::system(oss.str().c_str());
if(result != 0) {
utility::handleSystemError(result, "scratch::writeNumber");
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
template<typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
inline ReturnValue_t readNumber(std::string name, T& num) noexcept {
using namespace std;
string filename = "/tmp/sro" + std::to_string(counter++);
ostringstream oss;
oss << "xsc_scratch read " << name << " > " << filename;
int result = std::system(oss.str().c_str());
if(result != 0) {
utility::handleSystemError(result, "scratch::writeNumber");
return HasReturnvaluesIF::RETURN_FAILED;
}
ifstream file(filename);
string line;
if (not std::getline(file, line)) {
return HasReturnvaluesIF::RETURN_FAILED;
}
size_t pos = line.find("=");
std::string valueAsString = line.substr(pos + 1);
try {
num = std::stoi(valueAsString);
}
catch(std::invalid_argument& e) {
sif::warning << "scratch::readNumber: stoi call failed with " << e.what() << std::endl;
}
std::remove(filename.c_str());
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t writeString(std::string name, std::string string);
}
#endif /* BSP_Q7S_MEMORY_SCRATCHAPI_H_ */

View File

@ -0,0 +1,3 @@
target_sources(${TARGET_NAME} PRIVATE
simple.cpp
)

17
bsp_q7s/simple/simple.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "simple.h"
#include "q7sConfig.h"
#if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1
#include "../boardtest/FileSystemTest.h"
#endif
int simple::simple() {
cout << "-- Q7S Simple Application --" << endl;
#if Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST == 1
{
FileSystemTest fileSystemTest;
}
#endif
return 0;
}

10
bsp_q7s/simple/simple.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef BSP_Q7S_SIMPLE_SIMPLE_H_
#define BSP_Q7S_SIMPLE_SIMPLE_H_
namespace simple {
int simple();
}
#endif /* BSP_Q7S_SIMPLE_SIMPLE_H_ */

View File

@ -0,0 +1,9 @@
#include <bsp_q7s/spi/Q7sSpiComIF.h>
Q7sSpiComIF::Q7sSpiComIF(object_id_t objectId, GpioIF* gpioComIF) :
SpiComIF(objectId, gpioComIF) {
}
Q7sSpiComIF::~Q7sSpiComIF() {
}

33
bsp_q7s/spi/Q7sSpiComIF.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef BSP_Q7S_SPI_Q7SSPICOMIF_H_
#define BSP_Q7S_SPI_Q7SSPICOMIF_H_
#include <fsfw_hal/linux/spi/SpiComIF.h>
/**
* @brief This additional communication interface is required because the SPI busses behind the
* devices "/dev/spi2.0" and "dev/spidev3.0" are multiplexed to one SPI interface.
* This was necessary because the processing system spi (/dev/spi2.0) does not support
* frequencies lower than 650 kHz. To reach lower frequencies also the CPU frequency must
* be reduced which leads to other effects compromising kernel drivers.
* The nano avionics reaction wheels require a spi frequency between 150 kHz and 300 kHz
* why an additional AXI SPI core has been implemented in the programmable logic. However,
* the spi frequency of the AXI SPI core is not configurable during runtime. Therefore,
* this communication interface multiplexes either the hard-wired SPI or the AXI SPI to
* the SPI interface. The multiplexing is performed via a GPIO connected to a VHDL
* module responsible for switching between the to SPI peripherals.
*/
class Q7sSpiComIF: public SpiComIF {
public:
/**
* @brief Constructor
*
* @param objectId
* @param gpioComIF
* @param gpioSwitchId The gpio ID of the GPIO connected to the SPI mux module in the PL.
*/
Q7sSpiComIF(object_id_t objectId, GpioIF* gpioComIF, gpioId_t gpioSwitchId);
virtual ~Q7sSpiComIF();
};
#endif /* BSP_Q7S_SPI_Q7SSPICOMIF_H_ */

Some files were not shown because too many files have changed in this diff Show More