Compare commits

..

365 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
e4a715e24c ploc build for q7s 2021-04-24 14:22:22 +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
5d4c2bd521 plocHandler wip 2021-04-12 10:16:59 +02:00
400f60c7be plocHandler wip 2021-04-11 12:04:13 +02:00
699b4a0eb9 ploc handler wip 2021-03-29 14:37:52 +02: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
7f8720706e added etl 2021-03-04 18:31:10 +01:00
239 changed files with 15070 additions and 3570 deletions

6
.dockerignore Normal file
View File

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

13
.gitignore vendored
View File

@ -1,15 +1,9 @@
_obj
_bin
_dep
/build*
Debug
Debug*
Release
Release*
MinSizeRel
MinSizeRel*
RelWithDebInfo
RelWithDebInfo*
.settings
.metadata
@ -17,6 +11,9 @@ RelWithDebInfo*
.cproject
__pycache__
.idea
!misc/eclipse/**/.cproject
!misc/eclipse/**/.project
/eive_obsw cmake debug/
generators/*.db

10
.gitmodules vendored
View File

@ -9,13 +9,13 @@
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
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/modgen"]
path = generators/modgen
url = https://git.ksat-stuttgart.de/source/modgen.git
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

View File

@ -15,11 +15,19 @@ cmake_minimum_required(VERSION 3.13)
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()
@ -43,6 +51,7 @@ 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)
@ -50,6 +59,7 @@ 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)
@ -57,7 +67,7 @@ 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 TRUE)
set(ADD_LINUX_FILES False)
# Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc.
@ -65,12 +75,15 @@ 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")
set(ROOT_CONFIG_FOLDER TRUE)
set(FSFW_CONFIG_PATH "fsfwconfig")
set(ADD_LINUX_FILES TRUE)
set(ADD_CSP_LIB TRUE)
set(FSFW_HAL_ADD_LINUX ON)
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")
@ -78,6 +91,10 @@ if(TGT_BSP)
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()
@ -85,6 +102,22 @@ 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")
@ -95,11 +128,6 @@ set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
# Add executable
add_executable(${TARGET_NAME})
# Add subdirectories
if(ROOT_CONFIG_FOLDER)
add_subdirectory(${FSFW_CONFIG_PATH})
endif()
if(ADD_CSP_LIB)
add_subdirectory(${CSP_LIB_PATH})
endif()
@ -112,27 +140,34 @@ if(ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${LWGPS_LIB_PATH})
add_subdirectory(${BSP_PATH})
add_subdirectory(${FSFW_PATH})
add_subdirectory(${MISSION_PATH})
add_subdirectory(${TEST_PATH})
add_subdirectory(${FSFW_HAL_LIB_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)
# Add libraries for all sources.
target_link_libraries(${TARGET_NAME} PRIVATE
${LIB_FSFW_NAME}
${LIB_OS_NAME}
${LIB_LWGPS_NAME}
${LIB_FSFW_HAL_NAME}
)
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
@ -150,6 +185,7 @@ endif()
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR}
)
@ -221,8 +257,3 @@ add_custom_command(
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
set_build_type()

443
README.md
View File

@ -1,19 +1,26 @@
# <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 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 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
* 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 on a host system. All host code is contained in the `bsp_hosted` folder
@ -28,32 +35,74 @@ The CMake build system can be used to generate build systems as well (see helper
- 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
# Setting up development environment
### Installing Vivado the the Xilinx development tools
## Installing Vivado the the Xilinx development tools
It's also possible to perform debugging with a normal Eclipse installation by installing
the TCF plugin. Still, it is necessary to install Vivado to get the toolchain for generating
C++ applications. Alternatively you can download the toolchain
[from the cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486).
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.
* 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/vivado-edition.png" width="50%"> <br>
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/vivado-edition.png" width="50%"> <br>
<img src="./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/vivado-hl-design.png" width="50%"> <br>
<img src="./doc/img/xilinx-install.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
* Add path of linux cross-compiler to permanent environment variables (`.profile` file in Linux):
* 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 CMake and MSYS2 on Windows
### 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
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/rfoaistRd67yBbH/download/gcc-arm-linux-gnueabi-win.zip
```
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.
@ -63,7 +112,7 @@ C++ applications. Alternatively you can download the toolchain
3. Run the following commands in MinGW64
```sh
pacman -Syuuu
pacman -Syu
```
It is recommended to install the full base development toolchain
@ -78,7 +127,7 @@ C++ applications. Alternatively you can download the toolchain
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
## Installing CMake on Linux
1. Run the following command
@ -89,11 +138,19 @@ C++ applications. Alternatively you can download the toolchain
## 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 [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486). Download it and unzip it somewhere in the Xilinx installation folder.
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
# Building the software with CMake
When using Windows, run theses steps in MSYS2.
@ -116,18 +173,30 @@ When using Windows, run theses steps in MSYS2.
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 `Debug` folder.
Navigate into the `eive_obsw` folder first.
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
./create_cmake_debug.sh
./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
@ -194,7 +263,7 @@ IP address and path settings differ from machine to machine.
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
# Debugging the software via Flatsat PC
Open SSH connection to flatsat PC:
@ -233,7 +302,8 @@ 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.
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
@ -253,12 +323,14 @@ To launch application from Xilinx SDK setup port fowarding on the development ma
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 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, the host must be set to localhost instead of the IP address of the Q7S.
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
# Transfering files via SCP
To transfer files from the local machine to the Q7S, use port forwarding
@ -266,7 +338,7 @@ To transfer files from the local machine to the Q7S, use port forwarding
ssh -L 1535:192.168.133.10:22 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
```
Then you can copy an `example` file like this
An `example` file can be copied like this
```sh
scp -P 1535 example root@localhost:/tmp
@ -277,16 +349,16 @@ 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
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
# 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.
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
@ -304,11 +376,13 @@ the parition needs to be mounted.
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]
@ -325,8 +399,8 @@ the parition needs to be mounted.
[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.
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'
```
@ -344,37 +418,14 @@ the parition needs to be mounted.
```sh
systemctl status example
```
More detailed information about the used q7s commands can be found in the Q7S user manual.
### Bringing up 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
````
For Q7S use this:
````
cansend can0 5A1#11.22.33.44.55.66.77.88
````
Turn loopback mode on:
````
ip link set can0 type can bitrate 1000000 loopback on
````
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.
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:
@ -399,58 +450,27 @@ required for some framework components. The recommended values for the new messa
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.
```sh
sudo nano /etc/sysctl.conf
```
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).
Append at end:
```sh
fs/mqueue/msg_max = <newMsgMaxLen>
```
Apply changes with:
```sh
sudo sysctl -p
```
## Flight Software Framework (FSFW)
A possible solution which only persists for the current session is
```sh
echo <newMsgMax> | sudo tee /proc/sys/fs/mqueue/msg_max
```
An EIVE fork of the FSFW is submodules into this repository.
To add the master upstream branch and merge changes and updates from it
into the fork, run the following command in the fsfw folder first:
```sh
git remote add upstream https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git
git remote update --prune
```
After that, an update can be merged by running
```sh
git merge upstream/master
```
Alternatively, changes from other upstreams (forks) and branches can be merged like that in
the same way.
## PCDU
# PCDU
Connect to serial console of P60 Dock
````
@ -475,10 +495,11 @@ p60-dock # param get out_en[0]
GET out_en[0] = 1
````
## Debugging the software (when workstation is directly conncected to Q7S)
# 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
@ -526,8 +547,81 @@ GET out_en[0] = 1
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.
```sh
pacman -S mingw-w64-x86_64-cppcheck
```
On Ubuntu, install with
```sh
sudo apt-get install cppcheck
```
You can use the Eclipse integration or you can perform the scanning manually from the command line.
CMake will be used for this.
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.
```sh
cppcheck --project=compile_commands.json --xml 2> report.xml
```
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
@ -558,7 +652,84 @@ gpioget <gpiogroup> <offset>
Example to get state:
gpioget gpiochip7 14
## Running the EIVE OBSW on a Raspberry Pi
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
````
For Q7S use this:
````
cansend can0 5A1#11.22.33.44.55.66.77.88
````
Turn loopback mode on:
````
ip link set can0 type can bitrate 1000000 loopback on
````
Reading data from CAN:
````
candump can0
````
## Useful Q7S Linux Commands
Display currently running image:
```sh
xsc_boot_copy
```
Rebooting currently running image:
```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.
@ -574,9 +745,21 @@ sudo apt-get install gpiod libgpiod-dev
to install the required GPIO libraries before cloning the system root folder.
## Special notes on Eclipse
# Flight Software Framework (FSFW)
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.
An EIVE fork of the FSFW is submodules into this repository.
To add the master upstream branch and merge changes and updates from it
into the fork, run the following command in the fsfw folder first:
```sh
git remote add upstream https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git
git remote update --prune
```
After that, an update can be merged by running
```sh
git merge upstream/master
```
Alternatively, changes from other upstreams (forks) and branches can be merged like that in the same way.

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"]

View File

@ -32,9 +32,9 @@ ObjectManagerIF *objectManager = 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);
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();

View File

@ -14,7 +14,7 @@
#include <fsfw/osal/common/UdpTcPollingTask.h>
#include <fsfw/osal/common/UdpTmTcBridge.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/tmtcpacket/pus/tm.h>
#if OBSW_ADD_TEST_CODE == 1
@ -33,16 +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 UdpTmTcBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
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

@ -6,5 +6,16 @@ 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

@ -7,18 +7,18 @@
//! 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
#define FSFW_CPP_OSTREAM_ENABLED 1
//! More FSFW related printouts depending on level. Useful for development.
#define FSFW_VERBOSE_LEVEL 1
#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
#define FSFW_DISABLE_PRINTOUT 0
#endif
//! Can be used to disable the ANSI color sequences for C stdio.
#define FSFW_COLORED_OUTPUT 1
#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
@ -26,7 +26,7 @@
//! 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 0
#define FSFW_OBJ_EVENT_TRANSLATION 1
#if FSFW_OBJ_EVENT_TRANSLATION == 1
//! Specify whether info events are printed too.
@ -43,10 +43,17 @@
//! 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 eight byte CDC
//! short timestamp.
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8;
//! 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;
@ -55,11 +62,14 @@ 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
//! simulataneously. This will increase the required RAM for
//! 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

@ -1,12 +0,0 @@
#ifndef FSFWCONFIG_OBSWVERSION_H_
#define FSFWCONFIG_OBSWVERSION_H_
const char* const SW_NAME = "eive";
#define SW_VERSION 1
#define SW_SUBVERSION 0
#define SW_SUBSUBVERSION 0
#endif /* FSFWCONFIG_OBSWVERSION_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,17 +10,7 @@
*/
namespace SUBSYSTEM_ID {
enum: uint8_t {
SUBSYSTEM_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,
MGM_RM3100,
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

@ -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,
@ -27,21 +23,6 @@ namespace objects {
DUMMY_INTERFACE = 0xCAFECAFE,
DUMMY_HANDLER = 0x4400AFFE,
/* 0x44 ('D') for device handlers */
P60DOCK_HANDLER = 0x44000001,
PDU1_HANDLER = 0x44000002,
PDU2_HANDLER = 0x44000003,
ACU_HANDLER = 0x44000004,
TMP1075_HANDLER_1 = 0x44000005,
TMP1075_HANDLER_2 = 0x44000006,
MGM_0_LIS3_HANDLER = 0x4400007,
MGM_1_RM3100_HANDLER = 0x44000008,
MGM_2_LIS3_HANDLER = 0x44000009,
MGM_3_RM3100_HANDLER = 0x44000010,
GYRO_0_ADIS_HANDLER = 0x44000011,
GYRO_1_L3G_HANDLER = 0x44000012,
GYRO_2_L3G_HANDLER = 0x44000013,
/* 0x49 ('I') for Communication Interfaces **/
ARDUINO_COM_IF = 0x49000001
};

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,9 +11,7 @@
*/
namespace CLASS_ID {
enum {
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
MGM_LIS3MDL,
MGM_RM3100
CLASS_ID_START = COMMON_CLASS_ID_END,
};
}

View File

@ -6,9 +6,3 @@ target_sources(${TARGET_NAME} PUBLIC
add_subdirectory(boardconfig)
add_subdirectory(boardtest)
add_subdirectory(gpio)

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

@ -1,9 +1,9 @@
#include "InitMission.h"
#include "ObjectFactory.h"
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/OBSWConfig.h>
#include <fsfwconfig/pollingsequence/pollingSequenceFactory.h>
#include "objects/systemObjectList.h"
#include "OBSWConfig.h"
#include "pollingsequence/pollingSequenceFactory.h"
#include <mission/utility/InitMission.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
@ -26,9 +26,9 @@ ObjectManagerIF *objectManager = 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);
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
@ -117,6 +117,10 @@ void initmission::initTasks() {
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);
@ -124,11 +128,16 @@ void initmission::initTasks() {
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 RPI_TEST_ACS_BOARD == 1
FixedTimeslotTaskIF* acsTask = factory->createFixedTimeslotTask(
"ACS_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
result = pst::pollingSequenceAcsTest(acsTask);
#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;
}
@ -154,6 +163,12 @@ void initmission::initTasks() {
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();
@ -170,8 +185,8 @@ void initmission::initTasks() {
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */
#if RPI_TEST_ACS_BOARD == 1
acsTask->startTask();
#if OBSW_ADD_TEST_PST == 1
pstTestTask->startTask();
#endif /* RPI_TEST_ACS_BOARD == 1 */
sif::info << "Tasks started.." << std::endl;
}

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

@ -5,6 +5,3 @@ target_sources(${TARGET_NAME} PRIVATE
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -6,9 +6,19 @@
#define RPI_ADD_GPIO_TEST 0
#define RPI_LOOPBACK_TEST_GPIO 0
/* Only one of those 2 should be enabled! */
#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 {

View File

@ -5,6 +5,14 @@
#include <iostream>
#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 and entry point for the Raspberry Pi.
* @return
@ -12,7 +20,7 @@
int main(void)
{
std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux (Raspberry Pi) --" << 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;

View File

@ -1,14 +1,16 @@
target_sources(${TARGET_NAME} PUBLIC
InitMission.cpp
main.cpp
ObjectFactory.cpp
)
add_subdirectory(boardconfig)
add_subdirectory(comIF)
add_subdirectory(devices)
add_subdirectory(boardtest)
add_subdirectory(gpio)
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

@ -5,6 +5,3 @@ target_sources(${TARGET_NAME} PRIVATE
target_include_directories(${TARGET_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)

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

@ -1,13 +0,0 @@
#ifndef BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_
#define BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_
#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
#define Q7S_ADD_SPI_TEST 0
#endif /* BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ */

View File

@ -1,4 +1,6 @@
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

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

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

@ -1,6 +1,7 @@
#include "InitMission.h"
#include "ObjectFactory.h"
#include <OBSWConfig.h>
#include "OBSWConfig.h"
#include "pollingsequence/pollingSequenceFactory.h"
#include <mission/utility/InitMission.h>
@ -11,7 +12,7 @@
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <fsfwconfig/pollingsequence/pollingSequenceFactory.h>
#include <iostream>
/* This is configured for linux without CR */
@ -30,11 +31,12 @@ ServiceInterfaceStream sif::error("ERROR", true, false, true);
ObjectManagerIF *objectManager = 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);
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
sif::info << "Initializing all objects.." << std::endl;
objectManager->initialize();
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
@ -42,6 +44,7 @@ void initmission::initMission() {
void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if(factory == nullptr) {
/* Should never happen ! */
return;
@ -52,11 +55,18 @@ void initmission::initTasks() {
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);
ReturnValue_t result = tmTcDistributor->addComponent(
objects::CCSDS_PACKET_DISTRIBUTOR);
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
}
@ -83,6 +93,15 @@ void initmission::initTasks() {
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);
@ -93,10 +112,14 @@ void initmission::initTasks() {
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
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);
@ -134,28 +157,59 @@ void initmission::initTasks() {
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 * pollingSequenceTableTaskDefault = factory->createFixedTimeslotTask(
"PST_TASK_DEFAULT", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
FixedTimeslotTaskIF* spiPst = factory->createFixedTimeslotTask(
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
missedDeadlineFunc);
result = pst::pollingSequenceInitDefault(pollingSequenceTableTaskDefault);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
#endif
#if TE0720 == 0
FixedTimeslotTaskIF* gomSpacePstTask = factory->
createFixedTimeslotTask("GS_PST_TASK", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE*8, 3.0, missedDeadlineFunc);
result = pst::gomspacePstInit(gomSpacePstTask);
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;
}
#endif
#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(
@ -183,13 +237,19 @@ void initmission::initTasks() {
tmTcDistributor->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
coreController->startTask();
#if TE0720 == 0
gomSpacePstTask->startTask();
#endif
uartPst->startTask();
gpioPst->startTask();
i2cPst->startTask();
#if Q7S_ADD_SPI_TEST == 0
pollingSequenceTableTaskDefault->startTask();
gomSpacePstTask->startTask();
spiPst->startTask();
#endif /* Q7S_ADD_SPI_TEST == 0 */
#elif TE0720 == 1 && Q7S_ADD_SPI_TEST == 0
pollingSequenceTaskTE0720->startTask();
#endif
pusVerification->startTask();
@ -201,5 +261,9 @@ void initmission::initTasks() {
#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

@ -1,15 +1,23 @@
#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 <devices/spi.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/devices/HeaterHandler.h>
#include <bsp_q7s/devices/SolarArrayDeploymentHandler.h>
#include <bsp_q7s/gpio/gpioCallbacks.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>
@ -20,22 +28,24 @@
#include <mission/devices/Tmp1075Handler.h>
#include <mission/devices/Max31865PT1000Handler.h>
#include <mission/devices/IMTQHandler.h>
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
#include <mission/devices/SyrlinksHkHandler.h>
#include <mission/devices/MGMHandlerLIS3MDL.h>
#include <mission/devices/MGMHandlerRM3100.h>
#include <mission/devices/GyroL3GD20Handler.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 <linux/csp/CspCookie.h>
#include <linux/csp/CspComIF.h>
#include <linux/uart/UartComIF.h>
#include <linux/uart/UartCookie.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>
@ -46,7 +56,7 @@
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/tmtcpacket/pus/tm.h>
/* UDP server includes */
#include <fsfw/osal/common/UdpTmTcBridge.h>
@ -76,9 +86,20 @@ void Factory::setStaticFrameworkObjectIds() {
void ObjectFactory::produce(){
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,
@ -91,27 +112,16 @@ void ObjectFactory::produce(){
I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2,
TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1"));
#endif
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
/* Temperature sensors */
Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler(
objects::TMP1075_HANDLER_1, objects::I2C_COM_IF,
i2cCookieTmp1075tcs1);
tmp1075Handler_1->setStartUpImmediately();
(void) tmp1075Handler_1;
Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler(
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF,
i2cCookieTmp1075tcs2);
tmp1075Handler_2->setStartUpImmediately();
GpioCookie* heaterGpiosCookie = new GpioCookie;
(void) tmp1075Handler_2;
#if TE0720 == 0
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH,
@ -147,16 +157,127 @@ void ObjectFactory::produce(){
(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_1_ADIS"),
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_2_L3G"),
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_3_L3G"),
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);
@ -164,7 +285,7 @@ void ObjectFactory::produce(){
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegular(std::string("gpiochip5"), 17, std::string("CS_MGM_1_RM3100_A"),
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);
@ -197,13 +318,31 @@ void ObjectFactory::produce(){
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);
@ -256,8 +395,8 @@ void ObjectFactory::produce(){
solarArrayDeplCookie, objects::PCDU_HANDLER, pcduSwitches::DEPLOYMENT_MECHANISM,
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
UartCookie* syrlinksUartCookie = new UartCookie(
std::string("/dev/ttyUL0"), 38400, SYRLINKS::MAX_REPLY_SIZE);
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,
@ -267,61 +406,60 @@ void ObjectFactory::produce(){
#if Q7S_ADD_RTD_DEVICES == 1
GpioCookie* rtdGpioCookie = new GpioCookie;
gpioCallbacks::initTcsBoardDecoder(gpioComIF);
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC3, gpioRtdIc3);
GpioCallback* gpioRtdIc4 = new GpioCallback(std::string("Chip select RTD IC4"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC4, gpioRtdIc4);
GpioCallback* gpioRtdIc5 = new GpioCallback(std::string("Chip select RTD IC5"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC5, gpioRtdIc5);
GpioCallback* gpioRtdIc6 = new GpioCallback(std::string("Chip select RTD IC6"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC6, gpioRtdIc6);
GpioCallback* gpioRtdIc7 = new GpioCallback(std::string("Chip select RTD IC7"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC7, gpioRtdIc7);
GpioCallback* gpioRtdIc8 = new GpioCallback(std::string("Chip select RTD IC8"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC8, gpioRtdIc8);
GpioCallback* gpioRtdIc9 = new GpioCallback(std::string("Chip select RTD IC9"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC9, gpioRtdIc9);
GpioCallback* gpioRtdIc10 = new GpioCallback(std::string("Chip select RTD IC10"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC10, gpioRtdIc10);
GpioCallback* gpioRtdIc11 = new GpioCallback(std::string("Chip select RTD IC11"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC11, gpioRtdIc11);
GpioCallback* gpioRtdIc12 = new GpioCallback(std::string("Chip select RTD IC12"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC12, gpioRtdIc12);
GpioCallback* gpioRtdIc13 = new GpioCallback(std::string("Chip select RTD IC13"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC13, gpioRtdIc13);
GpioCallback* gpioRtdIc14 = new GpioCallback(std::string("Chip select RTD IC14"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC14, gpioRtdIc14);
GpioCallback* gpioRtdIc15 = new GpioCallback(std::string("Chip select RTD IC15"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC15, gpioRtdIc15);
GpioCallback* gpioRtdIc16 = new GpioCallback(std::string("Chip select RTD IC16"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC16, gpioRtdIc16);
GpioCallback* gpioRtdIc17 = new GpioCallback(std::string("Chip select RTD IC17"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC17, gpioRtdIc17);
GpioCallback* gpioRtdIc18 = new GpioCallback(std::string("Chip select RTD IC18"), gpio::OUT, 1,
&gpioCallbacks::tcsBoardDecoderCallback, gpioComIF);
&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_1, 2000000);
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);
@ -357,7 +495,7 @@ void ObjectFactory::produce(){
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, 2000000);
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);
@ -384,8 +522,6 @@ void ObjectFactory::produce(){
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);
// rtdIc10->setStartUpImmediately();
// rtdIc4->setStartUpImmediately();
(void) rtdIc3;
(void) rtdIc4;
@ -406,16 +542,90 @@ void ObjectFactory::produce(){
#endif /* Q7S_ADD_RTD_DEVICES == 1 */
#endif /* TE0720 == 0 */
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE,
objects::TC_STORE);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
std::string("/dev/i2c-0"));
IMTQHandler* imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
imtqHandler->setStartUpImmediately();
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 */
@ -424,16 +634,72 @@ void ObjectFactory::produce(){
GpioCookie* gpioCookie = new GpioCookie;
gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#elif TE0720 == 1
#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 gpioConfigForDummyHeater(std::string("gpiochip0"), 0,
std::string("Heater0"), gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN);
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

@ -3,7 +3,7 @@
namespace ObjectFactory {
void setStatics();
void produce();
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

@ -10,31 +10,32 @@ namespace gpioCallbacks {
GpioIF* gpioComInterface;
void initTcsBoardDecoder(GpioIF* gpioComIF) {
void initSpiCsDecoder(GpioIF* gpioComIF) {
ReturnValue_t result;
if (gpioComIF == nullptr) {
sif::debug << "initTcsBoardDecoder: Invalid gpioComIF" << std::endl;
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
return;
}
gpioComInterface = gpioComIF;
GpioCookie* spiMuxGpios = new GpioCookie;
/**
* Initial values of the spi mux gpios can all be set to an arbitrary value expect for spi mux
* bit 1. Setting spi mux bit 1 to high will pull all decoder outputs to high voltage level.
*/
/** 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, 1);
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);
@ -44,178 +45,294 @@ void initTcsBoardDecoder(GpioIF* gpioComIF) {
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 << "initTcsBoardDecoder: Failed to add mux bit gpios to gpioComIF"
<< std::endl;
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return;
}
}
void tcsBoardDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value,
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value,
void* args) {
if (gpioComInterface == nullptr) {
sif::debug << "tcsBoardDecoderCallback: No gpioComIF specified. Call initTcsBoardDecoder "
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
<< "to specify gpioComIF" << std::endl;
return;
}
/* Read is not supported by the callback function */
/* Reading is not supported by the callback function */
if (gpioOp == gpio::GpioOperation::READ) {
return;
}
if (value == 1) {
/* This will pull all 16 decoder outputs to high */
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
disableAllDecoder();
}
else if (value == 0) {
switch (gpioId) {
case(gpioIds::RTD_IC3): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY7();
break;
}
case(gpioIds::RTD_IC4): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY6();
break;
}
case(gpioIds::RTD_IC5): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY5();
break;
}
case(gpioIds::RTD_IC6): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY4();
break;
}
case(gpioIds::RTD_IC7): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY3();
break;
}
case(gpioIds::RTD_IC8): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY2();
break;
}
case(gpioIds::RTD_IC9): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY1();
break;
}
case(gpioIds::RTD_IC10): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc1();
selectY0();
break;
}
case(gpioIds::RTD_IC11): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY7();
break;
}
case(gpioIds::RTD_IC12): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY6();
break;
}
case(gpioIds::RTD_IC13): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY5();
break;
}
case(gpioIds::RTD_IC14): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY4();
break;
}
case(gpioIds::RTD_IC15): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY3();
break;
}
case(gpioIds::RTD_IC16): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY2();
break;
}
case(gpioIds::RTD_IC17): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
enableDecoderTcsIc2();
selectY1();
break;
}
case(gpioIds::RTD_IC18): {
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
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 << "tcsBoardDecoderCallback: Invalid gpioid " << gpioId << std::endl;
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
}
}
else {
sif::debug << "tcsBoardDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
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

@ -9,15 +9,59 @@ namespace gpioCallbacks {
/**
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
* the TCS Board.
* the TCS Board and the interface board.
*/
void initTcsBoardDecoder(GpioIF* gpioComIF);
void initSpiCsDecoder(GpioIF* gpioComIF);
/**
* @brief This function implements the decoding to multiply gpios by using the two decoder
* chips SN74LVC138APWR on the TCS board.
* @brief This function implements the decoding to multiply gpios by using the decoder
* chips SN74LVC138APWR on the TCS board and the interface board.
*/
void tcsBoardDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args);
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_ */

View File

@ -1,29 +1,23 @@
#include "InitMission.h"
#include <OBSWVersion.h>
#include <fsfw/tasks/TaskFactory.h>
#include "q7sConfig.h"
#if Q7S_SIMPLE_MODE == 0
#include "core/obsw.h"
#else
#include "simple/simple.h"
#endif
#include <iostream>
#include <unistd.h>
/**
* @brief This is the main program for the target hardware.
* @return
*/
int main(void)
{
std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << 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();
for(;;) {
/* Suspend main thread by sleeping it. */
TaskFactory::delayTask(5000);
}
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_ */

View File

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

View File

@ -0,0 +1,236 @@
#include <bsp_q7s/spiCallbacks/rwSpiCallback.h>
#include <fsfw/serviceinterface/ServiceInterface.h>
#include <mission/devices/RwHandler.h>
#include <fsfw_hal/linux/spi/SpiCookie.h>
#include <fsfw_hal/linux/UnixFileGuard.h>
#include "devices/gpioIds.h"
namespace rwSpiCallback {
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
size_t sendLen, void* args) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
if(handler == nullptr) {
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
uint8_t writeBuffer[2];
uint8_t writeSize = 0;
int fileDescriptor = 0;
std::string device = cookie->getSpiDevice();
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback: ");
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
return SpiComIF::OPENING_FILE_FAILED;
}
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
uint32_t spiSpeed = 0;
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF* gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0;
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
if(mutex == nullptr or gpioIF == nullptr) {
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
result = mutex->lockMutex(timeoutType, timeoutMs);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
return result;
}
/** Disconnect PS SPI peripheral and select AXI SPI core */
if(gpioIF->pullHigh(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio high" << std::endl;
}
/** Sending frame start sign */
writeBuffer[0] = 0x7E;
writeSize = 1;
// Pull SPI CS low. For now, no support for active high given
if(gpioId != gpio::NO_GPIO) {
if(gpioIF->pullLow(gpioId) != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
}
}
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::SPI_WRITE_FAILURE;
}
/** Encoding and sending command */
size_t idx = 0;
while(idx < sendLen) {
switch(*(sendData + idx)) {
case 0x7E:
writeBuffer[0] = 0x7D;
writeBuffer[1] = 0x5E;
writeSize = 2;
break;
case 0x7D:
writeBuffer[0] = 0x7D;
writeBuffer[1] = 0x5D;
writeSize = 2;
break;
default:
writeBuffer[0] = *(sendData + idx);
writeSize = 1;
break;
}
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::SPI_WRITE_FAILURE;
}
idx++;
}
/** Sending frame end sign */
writeBuffer[0] = 0x7E;
writeSize = 1;
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::SPI_WRITE_FAILURE;
}
uint8_t* rxBuf = nullptr;
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
if(result != HasReturnvaluesIF::RETURN_OK) {
closeSpi(gpioId, gpioIF, mutex);
return result;
}
size_t replyBufferSize = cookie->getMaxBufferSize();
/** There must be a delay of 20 ms after sending the command */
usleep(RwDefinitions::SPI_REPLY_DELAY);
/**
* The reaction wheel responds with empty frames while preparing the reply data.
* However, receiving more than 5 empty frames will be interpreted as an error.
*/
uint8_t byteRead = 0;
for (int idx = 0; idx < 10; idx++) {
if(read(fileDescriptor, &byteRead, 1) != 1) {
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::SPI_READ_FAILURE;
}
if (byteRead != 0x7E) {
break;
}
if (idx == 9) {
sif::error << "rwSpiCallback::spiCallback: Empty frame timeout" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::NO_REPLY;
}
}
size_t decodedFrameLen = 0;
while(decodedFrameLen < replyBufferSize) {
/** First byte already read in */
if (decodedFrameLen != 0) {
byteRead = 0;
if(read(fileDescriptor, &byteRead, 1) != 1) {
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
result = RwHandler::SPI_READ_FAILURE;
break;
}
}
if (byteRead == 0x7E) {
/** Reached end of frame */
break;
}
else if (byteRead == 0x7D) {
if(read(fileDescriptor, &byteRead, 1) != 1) {
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
result = RwHandler::SPI_READ_FAILURE;
break;
}
if (byteRead == 0x5E) {
*(rxBuf + decodedFrameLen) = 0x7E;
decodedFrameLen++;
continue;
}
else if (byteRead == 0x5D) {
*(rxBuf + decodedFrameLen) = 0x7D;
decodedFrameLen++;
continue;
}
else {
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
closeSpi(gpioId, gpioIF, mutex);
result = RwHandler::INVALID_SUBSTITUTE;
break;
}
}
else {
*(rxBuf + decodedFrameLen) = byteRead;
decodedFrameLen++;
continue;
}
/**
* There might be the unlikely case that each byte in a get-telemetry reply has been
* replaced by its substitute. Than the next byte must correspond to the end sign 0x7E.
* Otherwise there might be something wrong.
*/
if (decodedFrameLen == replyBufferSize) {
if(read(fileDescriptor, &byteRead, 1) != 1) {
sif::error << "rwSpiCallback::spiCallback: Failed to read last byte" << std::endl;
result = RwHandler::SPI_READ_FAILURE;
break;
}
if (byteRead != 0x7E) {
sif::error << "rwSpiCallback::spiCallback: Missing end sign 0x7E" << std::endl;
decodedFrameLen--;
result = RwHandler::MISSING_END_SIGN;
break;
}
}
result = HasReturnvaluesIF::RETURN_OK;
}
cookie->assignTransferSize(decodedFrameLen);
closeSpi(gpioId, gpioIF, mutex);
return result;
}
void closeSpi (gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
if(gpioId != gpio::NO_GPIO) {
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
}
}
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;;
}
/** Route SPI interface again to PS SPI peripheral */
if(gpioIF->pullLow(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio low" << std::endl;
}
}
}

View File

@ -0,0 +1,44 @@
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
#define BSP_Q7S_RW_SPI_CALLBACK_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
namespace rwSpiCallback {
/**
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
* receive the replies.
*
* @details The data to sent are additionally encoded according to the HDLC framing defined in the
* datasheet of the reaction wheels:
* https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/
* Arbeitsdaten/08_Used%20Components/Nanoavionics_Reactionwheels&fileid=181622
* Each command entails exactly one reply which will also be read in and decoded by this
* function.
* Because the reaction wheels require a spi clock frequency of maximum 300 kHZ and minimum
* 150 kHz which is not supported by the processing system SPI peripheral an AXI SPI core
* has been implemented in the programmable logic. This AXI SPI core works with a fixed
* frequency of 250 kHz.
* To allow the parallel usage of the same physical SPI bus, a VHDL module has been
* implemented which is able to disconnect the hard-wired SPI peripheral of the PS and
* route the AXI SPI to the SPI lines.
* To switch between the to SPI peripherals, an EMIO is used which will also be controlled
* by this function.
*/
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
size_t sendLen, void* args);
/**
* @brief This function closes a spi session. Pulls the chip select to high an releases the
* mutex.
* @param gpioId Gpio ID of chip select
* @param gpioIF Pointer to gpio interface to drive the chip select
* @param mutex The spi mutex
*/
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
}
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */

View File

@ -1,125 +0,0 @@
#include "ObjectFactory.h"
#include <fsfwconfig/objects/systemObjectList.h>
#include <fsfwconfig/devices/addresses.h>
#include <fsfwconfig/devices/gpioIds.h>
#include <fsfwconfig/OBSWConfig.h>
#include <fsfwconfig/tmtc/apid.h>
#include <fsfwconfig/tmtc/pusIds.h>
#include <fsfwconfig/devices/spi.h>
#include <linux/boardtest/LibgpiodTest.h>
#include <linux/boardtest/SpiTestClass.h>
#include <mission/devices/GyroL3GD20Handler.h>
#include <mission/core/GenericFactory.h>
#include <mission/utility/TmFunnel.h>
#include <mission/devices/MGMHandlerLIS3MDL.h>
#include <mission/devices/MGMHandlerRM3100.h>
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/tasks/TaskFactory.h>
/* UDP server includes */
#include <fsfw/osal/common/UdpTmTcBridge.h>
#include <fsfw/osal/common/UdpTcPollingTask.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;
LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects();
new UdpTmTcBridge(objects::UDP_BRIDGE,
objects::CCSDS_PACKET_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
#if RPI_ADD_SPI_TEST == 1
new SpiTestClass(objects::SPI_TEST, gpioIF);
#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);
#if RPI_TEST_ACS_BOARD == 1
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
"MGM_0_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
"MGM_1_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
"MGM_2_LIS3", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
"MGM_3_RM3100", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
"GYRO_1_L3G", gpio::Direction::OUT, 1);
gpio::createRpiGpioConfig(gpioCookieAcsBoard, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN,
"GYRO_2_L3G", gpio::Direction::OUT, 1);
gpioIF->addGpios(gpioCookieAcsBoard);
std::string spiDev = "/dev/spidev0.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_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 */
}

View File

@ -0,0 +1,98 @@
# BBB_ROOTFS should point to the local directory which contains all the
# libraries and includes from the target raspi.
# The following command can be used to do this, replace <ip-address> and the
# local <rootfs-path> accordingly:
# rsync -vR --progress -rl --delete-after --safe-links pi@<ip-address>:/{lib,usr,opt/vc/lib} <rootfs-path>
# RASPBIAN_ROOTFS needs to be passed to the CMake command or defined in the
# application CMakeLists.txt before loading the toolchain file.
# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command
if(NOT DEFINED ENV{BBB_ROOTFS})
message(FATAL_ERROR
"Define the BBB_ROOTFS variable to point to the Beagle Bone Black rootfs."
)
else()
set(SYSROOT_PATH "$ENV{BBB_ROOTFS}" CACHE FILEPATH "BBB root filesystem path")
message(STATUS "Beagle Bone Black sysroot: ${SYSROOT_PATH}")
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})
set(CROSS_COMPILE "arm-linux-gnueabihf")
message(STATUS
"No CROSS_COMPILE environmental variable set, using default ARM linux "
"cross compiler name ${CROSS_COMPILE}"
)
else()
set(CROSS_COMPILE "$ENV{CROSS_COMPILE}")
message(STATUS
"Using environmental variable CROSS_COMPILE as cross-compiler: "
"$ENV{CROSS_COMPILE}"
)
endif()
message(STATUS "Using sysroot path: ${SYSROOT_PATH}")
set(CROSS_COMPILE_CC "${CROSS_COMPILE}-gcc")
set(CROSS_COMPILE_CXX "${CROSS_COMPILE}-g++")
set(CROSS_COMPILE_LD "${CROSS_COMPILE}-ld")
set(CROSS_COMPILE_AR "${CROSS_COMPILE}-ar")
set(CROSS_COMPILE_RANLIB "${CROSS_COMPILE}-ranlib")
set(CROSS_COMPILE_STRIP "${CROSS_COMPILE}-strip")
set(CROSS_COMPILE_NM "${CROSS_COMPILE}-nm")
set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy")
set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size")
# At the very least, cross compile gcc and g++ have to be set!
find_program (CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED)
find_program (CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT "${SYSROOT_PATH}")
# Define name of the target system
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "arm")
# Define the compiler
set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC})
set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX})
# List of library dirs where LD has to look. Pass them directly through gcc.
# LD_LIBRARY_PATH is not evaluated by arm-*-ld
set(LIB_DIRS
"${SYSROOT_PATH}/lib/${CROSS_COMPILE}"
"${SYSROOT_PATH}/usr/local/lib"
"${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}"
"${SYSROOT_PATH}/usr/lib"
)
# You can additionally check the linker paths if you add the
# flags ' -Xlinker --verbose'
set(COMMON_FLAGS "-I${SYSROOT_PATH}/usr/include")
foreach(LIB ${LIB_DIRS})
set(COMMON_FLAGS "${COMMON_FLAGS} -L${LIB} -Wl,-rpath-link,${LIB}")
endforeach()
set(CMAKE_PREFIX_PATH
"${CMAKE_PREFIX_PATH}"
"${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}"
)
set(CMAKE_C_FLAGS
"-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard ${COMMON_FLAGS}"
CACHE STRING "Flags for Beagle Bone Black"
)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}"
CACHE STRING "Flags for Beagle Bone Black"
)
set(CMAKE_FIND_ROOT_PATH
"${CMAKE_INSTALL_PREFIX};${CMAKE_PREFIX_PATH};${CMAKE_SYSROOT}"
)
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View File

@ -53,8 +53,8 @@ endif()
if(TGT_BSP)
if (${TGT_BSP} MATCHES "arm/raspberrypi")
set(BSP_PATH "bsp_rpi")
if (${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/beagleboneblack")
set(BSP_PATH "bsp_linux_board")
elseif(${TGT_BSP} MATCHES "arm/q7s")
set(BSP_PATH "bsp_q7s")
else()

View File

@ -11,7 +11,6 @@ endif()
# Disable compiler checks for cross-compiling.
if(${OS_FSFW} STREQUAL linux AND TGT_BSP)
if(${TGT_BSP} MATCHES "arm/q7s")
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake"
@ -38,7 +37,7 @@ if(${OS_FSFW} STREQUAL linux AND TGT_BSP)
else()
message(STATUS "Setting RASPBERRY_VERSION to ${RASPBERRY_VERSION}")
set(RASPBERRY_VERSION ${RASPBERRY_VERSION} CACHE STRING "Raspberry Pi version")
set(ENV{RASPBERRY_VERSION} ${RASPBERRY_VERSION})
set(ENV{RASPBERRY_VERSION} ${RASPBERRY_VERSION})
endif()
else()
message(STATUS
@ -51,7 +50,14 @@ if(${OS_FSFW} STREQUAL linux AND TGT_BSP)
"${CMAKE_SCRIPT_PATH}/RPiCrossCompileConfig.cmake"
PARENT_SCOPE
)
else()
elseif(${TGT_BSP} MATCHES "arm/beagleboneblack")
if(LINUX_CROSS_COMPILE)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/BBBCrossCompileConfig.cmake"
PARENT_SCOPE
)
endif()
else()
message(WARNING "Target BSP (TGT_BSP) ${TGT_BSP} unknown!")
endif()
endif()

View File

@ -6,7 +6,7 @@ if(NOT DEFINED ENV{Q7S_SYSROOT})
# "point to the raspbian rootfs."
# )
else()
set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}")
set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE PATH "Q7S root filesystem path")
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})

View File

@ -25,7 +25,7 @@ if(NOT DEFINED ENV{RASPBIAN_ROOTFS})
"point to the raspbian rootfs."
)
else()
set(SYSROOT_PATH "$ENV{RASPBIAN_ROOTFS}")
set(SYSROOT_PATH "$ENV{RASPBIAN_ROOTFS}" CACHE FILEPATH "RPi root filesystem path")
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})

View File

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/scripts.iml" filepath="$PROJECT_DIR$/.idea/scripts.iml" />
</modules>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="b7804b00-6384-4363-ae17-406610449420" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
</component>
<component name="ProjectId" id="1mFLMh77EFiQ6e8GGJM4DSy44LC" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
</component>
<component name="RunManager">
<configuration name="cmake_build_config" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="scripts" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/cmake_build_config.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.cmake_build_config" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="b7804b00-6384-4363-ae17-406610449420" name="Default Changelist" comment="" />
<created>1609084345199</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1609084345199</updated>
<workItem from="1609084346343" duration="6791000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/scripts$cmake_build_config.coverage" NAME="cmake_build_config Coverage Results" MODIFIED="1609089450693" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
</project>

View File

@ -15,8 +15,10 @@ if [ "${counter}" -ge 5 ];then
fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
tgt_bsp="arm/beagleboneblack"
build_generator=""
builddir="build-Debug-BBB"
defines="LINUX_CROSS_COMPILE=OFF"
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
# Could be other OS but this works for now.
@ -24,4 +26,5 @@ else
build_generator="Unix Makefiles"
fi
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l "${builddir}" -d "${defines}"

View File

@ -0,0 +1,3 @@
export PATH=$PATH:"$HOME/beaglebone/<cross_compiler_path>/bin"
export CROSS_COMPILE="arm-linux-gnueabihf"
export BBB_ROOTFS="${HOME}/raspberrypi/rootfs"

View File

@ -15,9 +15,10 @@ if [ "${counter}" -ge 5 ];then
fi
os_fsfw="linux"
tgt_bsp="arm/raspberrypi"
tgt_bsp="arm/beagleboneblack"
build_generator=""
build_dir="Debug-RPi"
builddir="build-Debug-BBB"
defines="LINUX_CROSS_COMPILE=ON"
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
# Could be other OS but this works for now.
@ -26,4 +27,4 @@ else
fi
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l"${build_dir}"
-l "${builddir}" -d "${defines}"

View File

@ -15,8 +15,10 @@ if [ "${counter}" -ge 5 ];then
fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
tgt_bsp="arm/beagleboneblack"
build_generator=""
builddir="build-Release-BBB"
defines="LINUX_CROSS_COMPILE=ON"
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
# Could be other OS but this works for now.
@ -24,4 +26,5 @@ else
build_generator="Unix Makefiles"
fi
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l "${builddir}" -d "${defines}"

View File

@ -15,9 +15,10 @@ if [ "${counter}" -ge 5 ];then
fi
os_fsfw="linux"
tgt_bsp="arm/raspberrypi"
tgt_bsp="arm/beagleboneblack"
build_generator=""
build_dir="RelWithDeb-RPi"
builddir="build-Release-BBB"
defines="LINUX_CROSS_COMPILE=ON"
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
# Could be other OS but this works for now.
@ -25,5 +26,5 @@ else
build_generator="Unix Makefiles"
fi
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" -t "${tgt_bsp}" \
-l"${build_dir}"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l "${builddir}" -d "${defines}"

2
cmake/scripts/Host/create_cmake_debug_cfg.sh Normal file → Executable file
View File

@ -15,7 +15,7 @@ if [ "${counter}" -ge 5 ];then
fi
build_generator=""
build_dir="Debug-Host"
build_dir="build-Debug-Host"
os_fsfw="host"
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"

View File

@ -1,20 +0,0 @@
#!/bin/sh
counter=0
while [ ${counter} -lt 5 ]
do
cd ..
if [ -f "cmake_build_config.py" ];then
break
fi
counter=$((counter=counter + 1))
done
if [ "${counter}" -ge 5 ];then
echo "create_cmake_cfg.sh not found in upper directories!"
exit 1
fi
build_generator="Unix Makefiles"
os_fsfw="linux"
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size"

View File

@ -16,10 +16,17 @@ fi
build_generator="Unix Makefiles"
os_fsfw="linux"
builddir="RelWithDeb-Linux"
builddir="build-Debug-Host"
if [ "${OS}" = "Windows_NT" ]; then
python="py"
# Could be other OS but this works for now.
else
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
# Use this if commands are added which should not be printed
# set +x

View File

@ -16,10 +16,16 @@ fi
build_generator="Unix Makefiles"
os_fsfw="linux"
builddir="Debug-Linux"
builddir="build-Release-Host"
if [ "${OS}" = "Windows_NT" ]; then
python="py"
# Could be other OS but this works for now.
else
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}"
# Use this if commands are added which should not be printed
# set +x

View File

@ -14,12 +14,19 @@ if [ "${counter}" -ge 5 ];then
exit 1
fi
build_generator="Unix Makefiles"
build_generator="Ninja"
os_fsfw="linux"
builddir="Release-Linux"
builddir="build-Debug-Host"
if [ "${OS}" = "Windows_NT" ]; then
python="py"
# Could be other OS but this works for now.
else
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
# Use this if commands are added which should not be printed
# set +x

View File

@ -0,0 +1,35 @@
#!/bin/sh
counter=0
while [ ${counter} -lt 5 ]
do
cd ..
if [ -f "cmake_build_config.py" ];then
break
fi
counter=$((counter=counter + 1))
done
if [ "${counter}" -ge 5 ];then
echo "cmake_build_config.py not found in upper directories!"
exit 1
fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
build_dir="build-Debug-Q7S"
build_generator=""
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
python="py"
# Could be other OS but this works for now.
else
build_generator="Unix Makefiles"
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l"${build_dir}"
# set +x

View File

@ -16,12 +16,19 @@ fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
build_dir="build-Debug-Q7S"
build_generator=""
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
python="py"
# Could be other OS but this works for now.
else
build_generator="Unix Makefiles"
python="python3"
fi
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" -t "${tgt_bsp}"
echo "Running command (without the leading +):"
set -x # Print command
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l"${build_dir}"
# set +x

View File

@ -0,0 +1,33 @@
#!/bin/sh
counter=0
while [ ${counter} -lt 5 ]
do
cd ..
if [ -f "cmake_build_config.py" ];then
break
fi
counter=$((counter=counter + 1))
done
if [ "${counter}" -ge 5 ];then
echo "cmake_build_config.py not found in upper directories!"
exit 1
fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
build_dir="build-Debug-Q7S"
build_generator="Ninja"
if [ "${OS}" = "Windows_NT" ]; then
python="py"
# Could be other OS but this works for now.
else
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l"${build_dir}"
# set +x

View File

@ -0,0 +1,35 @@
#!/bin/sh
counter=0
while [ ${counter} -lt 5 ]
do
cd ..
if [ -f "cmake_build_config.py" ];then
break
fi
counter=$((counter=counter + 1))
done
if [ "${counter}" -ge 5 ];then
echo "cmake_build_config.py not found in upper directories!"
exit 1
fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
build_dir="build-Simple-Q7S"
build_generator=""
definitions="Q7S_SIMPLE_MODE=On"
if [ "${OS}" = "Windows_NT" ]; then
build_generator="MinGW Makefiles"
python="py"
# Could be other OS but this works for now.
else
build_generator="Unix Makefiles"
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l "${build_dir}" -d "${definitions}"
# set +x

View File

@ -0,0 +1,34 @@
#!/bin/sh
counter=0
while [ ${counter} -lt 5 ]
do
cd ..
if [ -f "cmake_build_config.py" ];then
break
fi
counter=$((counter=counter + 1))
done
if [ "${counter}" -ge 5 ];then
echo "cmake_build_config.py not found in upper directories!"
exit 1
fi
os_fsfw="linux"
tgt_bsp="arm/q7s"
build_dir="build-Simple-Q7S"
build_generator="Ninja"
definitions="Q7S_SIMPLE_MODE=On"
if [ "${OS}" = "Windows_NT" ]; then
python="py"
# Could be other OS but this works for now.
else
python="python3"
fi
echo "Running command (without the leading +):"
set -x # Print command
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
-l "${build_dir}" -d "${definitions}"
# set +x

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