Compare commits
655 Commits
v4.0.0
...
mueller/dh
Author | SHA1 | Date | |
---|---|---|---|
5ff28ff562 | |||
fcdb90ff0a | |||
8d1777fa0c | |||
e10e71cee9 | |||
d675a789a2 | |||
6b8c83be29 | |||
093052604a | |||
192255df1c | |||
bdd79d060d | |||
c756297e5c | |||
3a47062f2a | |||
0f27c7e7e7 | |||
20d42add03 | |||
6c2b5ab39e | |||
a7039bad41 | |||
6605ffb6b1 | |||
e2e0190cae | |||
fd278e410b | |||
ff4cbea571 | |||
8c8d1cfa84 | |||
7c59df3f1c | |||
217276d50c | |||
d2ac3603a5 | |||
f63f3fa564 | |||
fc34d56239 | |||
221361eb9c | |||
7f9269b387 | |||
4224c3d009 | |||
62fe75ee40 | |||
adcc375f25 | |||
94a718ff19 | |||
4a10f76784 | |||
57ce5d1f34 | |||
90963b3940 | |||
71ed95b09a | |||
7ac4f1c64d | |||
9d64b96e9a | |||
5de2c6af66 | |||
ca2efb6021 | |||
3b000d924a | |||
deeeef553b | |||
0e7ec79af9 | |||
d3cabd8984 | |||
8efe85cb15 | |||
b28c26b288 | |||
8b4253bc46 | |||
e6957de166 | |||
cc56b00df3 | |||
43048c852a | |||
19817bd3a5 | |||
1db04cf20c | |||
52ee50ba8c | |||
96f092ef75 | |||
4a4d23573d | |||
47e148af8f | |||
c9bec03f00 | |||
6c5c59cad8 | |||
03e12a2388 | |||
5355e63711 | |||
b11cdf6184 | |||
dc31358d52 | |||
e7d9979078 | |||
88ebb67c8d | |||
b827bd8370 | |||
8f07133e2c | |||
f11433e50f | |||
edc5a314b8 | |||
f80be9e9fa | |||
f3af88ae40 | |||
380f1d0206 | |||
54fc35eae7 | |||
05d4162f5b | |||
e030878023 | |||
180210dc38 | |||
2a34c831b1 | |||
c96e304b68 | |||
3708df2423 | |||
b809f90e72 | |||
f2bf4b463e | |||
8e05fc0417 | |||
ddad97033d | |||
42a1d6cccd | |||
9bbe1dc716 | |||
74794bb71b | |||
6f751c2cf9 | |||
9a2e68b37e | |||
91067cde98 | |||
428018e4f1 | |||
8b6dd3f868 | |||
f6ede7cd3e | |||
4da18172b3 | |||
6e5239e9a0 | |||
78b09ed0c9 | |||
fdf35232ee | |||
8465670374 | |||
3b23fb77b4 | |||
6f7be281ef | |||
3686bbc486 | |||
ecac08814e | |||
e8b8fff0b5 | |||
4d34f93cfc | |||
adbf375f38 | |||
2e42f53682 | |||
c519b70302 | |||
45ee307bc4 | |||
8a2068aca6 | |||
aa60484111 | |||
e99c7f3824 | |||
2ee3ef1f1d | |||
ce48827ee5 | |||
0d80fad685 | |||
c6253bf0dd | |||
93933dee02 | |||
0e49640306 | |||
32fea9838e | |||
0519083894 | |||
14bac9a418 | |||
3bef73708f | |||
fef6ddceff | |||
5a9db72814 | |||
5cccd5caba | |||
7de56f189b | |||
df97bbc691 | |||
2d2f65bf89 | |||
3e9ae62b28 | |||
2ebefdffae | |||
45792e86b9 | |||
541f563683 | |||
28ea71a077 | |||
a044d7d724 | |||
687700cee8 | |||
732b615cb3 | |||
394ce2ec3e | |||
dde96ae220 | |||
c3aaab4b93 | |||
edf1d5ae8d | |||
690991b4b5 | |||
1a294e6a13 | |||
8c4e34153b | |||
b60e4bcb90 | |||
b18410aa63 | |||
7f57a8784a | |||
4b33aa8262 | |||
d47a908117 | |||
fce95e04a8 | |||
fc742e4270 | |||
b5183a19fc | |||
ca453a8f16 | |||
b7c0c07141 | |||
0158102f11 | |||
69859fdbc9 | |||
90bccc744e | |||
ab89108c55 | |||
a682bbe400 | |||
e67fc2ab0d | |||
71ce966531 | |||
6b0f4a159f | |||
4a06b558c1 | |||
6d921f03fd | |||
65bc8213fe | |||
a0ee86ace8 | |||
a07a368272 | |||
cb8a4bbbec | |||
17f54006b8 | |||
395cf9cfa7 | |||
a3c0b441ec | |||
b4132800ae | |||
ad53b48fcb | |||
dee40f9079 | |||
92ec24352f | |||
3f9e459f48 | |||
e0c7f8d51d | |||
eb79386c92 | |||
4542f31c40 | |||
689fb378d8 | |||
98b711a872 | |||
800aa131fa | |||
6983980304 | |||
7c0ba59993 | |||
28873fc87b | |||
24e849ed9c | |||
d8985c141e | |||
7602b15256 | |||
d1a82bceed | |||
7292b02907 | |||
347714d53a | |||
f230fa1617 | |||
93615b100c | |||
e18d3d559e | |||
08ff061d07 | |||
cc351c1066 | |||
664a548c53 | |||
e9895559a3 | |||
eda5b8f593 | |||
e03f55604a | |||
51d7df2dba | |||
12046a2db6 | |||
21eb386f3c | |||
ade36e65c6 | |||
103661facc | |||
ae2f7219fd | |||
4fba2704aa | |||
161dbde0d7 | |||
2fa4fd61d0 | |||
bf673c56c6 | |||
c697d0f8ab | |||
c7cf8e710d | |||
7dddcdfd55 | |||
261eea381e | |||
e59f1f26bf | |||
f7cde80088 | |||
e60a665de4 | |||
34658ef7db | |||
940fd6f465 | |||
f288d5120d | |||
5a425a1c58 | |||
5e62258aa6 | |||
0b53b4873f | |||
8e2597f609 | |||
dac700b80a | |||
d0fc360697 | |||
576414438c | |||
13cda86d23 | |||
e1dd27b9dd | |||
8e9d4b451c | |||
d871f55a89 | |||
816550b69c | |||
7fee852dbd | |||
1e7032f89c | |||
f0debecbbc | |||
ef9d7aa7d3 | |||
b8fd2db434 | |||
878e32cbe8 | |||
4821706561 | |||
1611a4e1f0 | |||
eed6a64597 | |||
5736023ffa | |||
8a12a5097e | |||
87e4a57ef7 | |||
0375ee1881 | |||
c8e034d975 | |||
e98aa005cb | |||
52310f7d32 | |||
e3d1308205 | |||
970f039e85 | |||
99c72fd00b | |||
2708b71d77 | |||
5a4539def4 | |||
13a34cd677 | |||
811287aac8 | |||
23fb06578b | |||
c86e99e6dc | |||
4092de911c | |||
00952e15b0 | |||
6366283ce2 | |||
01ebf0f4d3 | |||
99fe6487c8 | |||
d4a6f987bc | |||
57bac4f262 | |||
cfa6843c8f | |||
b6b3221b22 | |||
8dc640c162 | |||
deee4c43c0 | |||
ad0b6f1ed1 | |||
ec03a674bd | |||
9e3d5b6a0c | |||
994c7299b9 | |||
57a830cb46 | |||
ff40a71582 | |||
271057ca6b | |||
861335212e | |||
038e47a46e | |||
c215508a12 | |||
ccadbb5942 | |||
171c48495c | |||
a83b86ccd2 | |||
2e4b9bcd7c | |||
3046822e88 | |||
6442dd0c38 | |||
9b6fa646ed | |||
e77bde459b | |||
2d9d83a1c5 | |||
c561271070 | |||
70d4fc1e0a | |||
b8cfb36426 | |||
e5c140e0ae | |||
b99160e850 | |||
c4c340fde1 | |||
9a4c7589cc | |||
d11f898f70 | |||
e1604b292c | |||
34e124f2db | |||
e05c72b062 | |||
377c3325d2 | |||
2ca8523215 | |||
25775614de | |||
efb3d982f3 | |||
0410ecd9e3 | |||
dd986fefd3 | |||
b38329aa0e | |||
0fe1b70bae | |||
c5b4499d98 | |||
458aa5c265 | |||
4499c9bf04 | |||
eb0223bc51 | |||
be6a492022 | |||
d8bd08dd8c | |||
18c2847b08 | |||
d45cda93b2 | |||
3448292e8a | |||
d983305ea5 | |||
c83cc492c0 | |||
ece32f88f4 | |||
dd9e28fca1 | |||
46cfe65321 | |||
7b7f5d7e0a | |||
fd112ed597 | |||
96eb8fc21f | |||
88fa4f1d9d | |||
5989c88c88 | |||
da8a108cb7 | |||
75132c1e39 | |||
eb494707af | |||
736f8d0238 | |||
f1acf8e18b | |||
281f91ec5d | |||
15352b539d | |||
4015e85506 | |||
aacaf52fd9 | |||
118f1da8dd | |||
89f83f4e3d | |||
39b7976056 | |||
8b0508d50a | |||
8a40878eb5 | |||
220469a2dd | |||
83de5b4ec1 | |||
fe1c51ae6d | |||
10cc954d27 | |||
73ff9b97db | |||
b0d71597f0 | |||
226f28dc7b | |||
7afe30ea88 | |||
6308427d03 | |||
398d04dc50 | |||
80a5ed3c5b | |||
5d5a355110 | |||
c78b7c432b | |||
6bfdace512 | |||
16e55a98ce | |||
79f17843d8 | |||
e5e163bdbf | |||
4e4820af05 | |||
637512ad77 | |||
a4bd5a2aaa | |||
a943e4eebb | |||
cb0c80d8dc | |||
3332f68ce7 | |||
2fbf847367 | |||
54feb77770 | |||
1a07864a5f | |||
3e9d6bdbb9 | |||
c295539c79 | |||
57e6c46e72 | |||
cddf16f941 | |||
a3dee05fe3 | |||
a3617cad11 | |||
8edf4c3c8d | |||
7801c6effe | |||
8cc94a55ab | |||
b62c19a364 | |||
daffb6b666 | |||
7cfb1e6076 | |||
cc36baff78 | |||
4c65109ac0 | |||
861bd15eda | |||
7b979eadff | |||
16714ceb40 | |||
fea301bcc9 | |||
77450eb4b7 | |||
28015c4735 | |||
7d61e67d20 | |||
afcbc8be0a | |||
7a2269262b | |||
9731dc1e61 | |||
bf2e0f2d73 | |||
e98857fab4 | |||
29b0a352fc | |||
8642b13fd1 | |||
6aa72892ed | |||
70f0a72f1b | |||
b5d890eedd | |||
50b1b48678 | |||
0e0dbc74aa | |||
8c34051d8b | |||
b00d83cb1a | |||
17e609c3a5 | |||
64f0166b64 | |||
c80f06fbcb | |||
70eb8325a0 | |||
8e4ad10627 | |||
496bc665d6 | |||
2c8531ea48 | |||
d3e7037759 | |||
e796f82203 | |||
5b7ca8c13c | |||
0aee86442e | |||
951c077abc | |||
031739ef51 | |||
b94685e045 | |||
572d602b72 | |||
88051c9302 | |||
80be937d9d | |||
d62ee6a611 | |||
91ef4ff30b | |||
b8516b15cb | |||
755dcf66a3 | |||
4032228005 | |||
50ce13d596 | |||
68302e7c5e | |||
ac5a54b5da | |||
b7ffd2653b | |||
29015b340b | |||
64274acbeb | |||
ff98c42514 | |||
126ac52975 | |||
70d3197212 | |||
dd90980520 | |||
18f9958332 | |||
68231db9a1 | |||
85e849ca00 | |||
617d41c7d5 | |||
cccdced74d | |||
750369b0a6 | |||
539e01deee | |||
4079edc80e | |||
a569990ca2 | |||
9c7eba4431 | |||
513ae9dc10 | |||
effecd4662 | |||
b951cb736a | |||
7e1aed6ad9 | |||
07155e2546 | |||
8c6c8ad3c0 | |||
352ab43c1f | |||
35f257800e | |||
07f5dbb9ac | |||
97e98eae24 | |||
5ac88f2b15 | |||
7a5ce57bbc | |||
b03a6684f9 | |||
afce942bf8 | |||
7c2e50b665 | |||
c04ca704d2 | |||
6aa54fe1d4 | |||
a1d7a56dfa | |||
cb78fefbb3 | |||
c55925959b | |||
4f0669c574 | |||
f0d996ffd2 | |||
d0b7c22afc | |||
a18bc15cbb | |||
f4d05c2c9c | |||
d1151ca707 | |||
82f46992f6 | |||
4ed9cc933f | |||
7af1c86f1c | |||
bd0b7aa230 | |||
72e0938f9a | |||
dd1b0a9380 | |||
9947a648df | |||
c0f80680ef | |||
7761b66fe2 | |||
acc4c8d975 | |||
fe739aa81a | |||
adfefdd93f | |||
afe006e234 | |||
95f018a0b0 | |||
8c2105ae0a | |||
ed2c2af4a0 | |||
17771c0497 | |||
82df132e7d | |||
a02619e5a2 | |||
a011e70665 | |||
c05184e1c4 | |||
4dee913d51 | |||
b2252bdc0b | |||
7e61ce1ed2 | |||
b764194ed0 | |||
2d0e4ba951 | |||
0d549b687d | |||
738f572043 | |||
cab508fd64 | |||
c7daf697a8 | |||
c20be13733 | |||
fcb6437388 | |||
6c1db8473b | |||
b42987059a | |||
82fc7f33a8 | |||
bfa77cf810 | |||
a3930dafc5 | |||
4f9797af3b | |||
1a530633ca | |||
8037e8074b | |||
d07e0e5576 | |||
5525466b52 | |||
c2a89bf709 | |||
8dd0b2608d | |||
05495077ec | |||
8ff9eadf30 | |||
082c86ea18 | |||
2800d6f28c | |||
b4effe7a46 | |||
e6e71436c2 | |||
4be45adae6 | |||
a887f852c8 | |||
0d7d2203d2 | |||
cde184f428 | |||
0b3255e463 | |||
df3794dfd8 | |||
b7a316008a | |||
d02d5c351d | |||
f598f7030f | |||
631a531212 | |||
febecd4b30 | |||
964e311d8b | |||
d43caa8296 | |||
916ed3f56a | |||
23af170229 | |||
b32d1da421 | |||
6f0362b956 | |||
665d8cd479 | |||
10398855a9 | |||
70f575396d | |||
ad57e6713e | |||
d0fec93dc3 | |||
59ab54b2fb | |||
7095999bd2 | |||
7ffb4107d2 | |||
d9d9a28ef8 | |||
23f8e5cb41 | |||
879223f38f | |||
d95582b81b | |||
8a44c498c5 | |||
c60aa68d00 | |||
a891769a02 | |||
df97c582d7 | |||
9ce59d3c75 | |||
a0dfdfab2c | |||
3e17011087 | |||
f441505476 | |||
7c64797f03 | |||
e08bdd3e35 | |||
d2dd16aef3 | |||
b7a617dab3 | |||
bc95e7c886 | |||
fca43b3d34 | |||
48c5c3fbd5 | |||
b694aea100 | |||
6998626ad4 | |||
24ad858b64 | |||
288d453978 | |||
522cbc7f3d | |||
ce5bcc5897 | |||
97c93afeff | |||
8704b9ab06 | |||
5a1585bd00 | |||
5d6de90859 | |||
378c6c8006 | |||
f4922a8686 | |||
0bdcb40609 | |||
e684680d60 | |||
aa5d1042f0 | |||
14ac852b7e | |||
6b1a81ee92 | |||
3779b44813 | |||
949549178a | |||
7daa9812ff | |||
ca508bfe61 | |||
345a799031 | |||
445d5dd6f0 | |||
238baa8597 | |||
7932afc315 | |||
d1e3dc4d49 | |||
77e5fba7fd | |||
ca70c8c614 | |||
14620fdd72 | |||
89c1878622 | |||
d6856fc54a | |||
e5a9cab34e | |||
a4f97a7ba7 | |||
8b1af232c3 | |||
983fa346b3 | |||
32f420c4f0 | |||
41a82e923c | |||
5ddac36314 | |||
d06eecf9b0 | |||
5912ddd2a2 | |||
7db11588b4 | |||
c88b931ef1 | |||
10ffa2f44a | |||
dbe31dd339 | |||
14b44f8bb2 | |||
117747970d | |||
c6540650e2 | |||
f659f13759 | |||
95078e1103 | |||
8920255565 | |||
2d12618c96 | |||
68ca6fd122 | |||
33e9592659 | |||
19d217e3b9 | |||
af286d3bc6 | |||
20928732ec | |||
a8426750f2 | |||
2635f39344 | |||
89327463e3 | |||
cf45eca100 | |||
c0fa365f8f | |||
9d9f19781d | |||
f4520ea346 | |||
bbacdc5cac | |||
a6c0f3fef5 | |||
0e8328fca3 | |||
1ef3dae72e | |||
32381a7872 | |||
09815f5cce | |||
f6357b4531 | |||
a10e5c6ed4 | |||
d6d13eec95 | |||
457bc6609e | |||
e75155c329 | |||
d4e48006f2 | |||
d6508e23b6 | |||
2cb254a556 | |||
f99f5ed730 | |||
5f7e384442 | |||
56d0c8c616 | |||
5ff0f8ea10 | |||
fdc8a3d4f7 | |||
e5e85bcff9 | |||
4862edfdb5 | |||
a50b52df51 | |||
eac7e6db07 | |||
0c4835bfb5 | |||
aebd4817b8 | |||
9c2ceb4a9f | |||
68ace0b74a | |||
d119479c0a | |||
6739890d53 | |||
90b8ad1e6d | |||
025f79fcb4 | |||
6fb64f9ada | |||
2f1b923009 | |||
45ea09291a | |||
b7f3eff742 |
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,6 +1,14 @@
|
|||||||
|
# PyCharm and CLion
|
||||||
|
/.idea/*
|
||||||
|
!/.idea/runConfigurations
|
||||||
|
!/.idea/cmake.xml
|
||||||
|
!/.idea/codeStyles
|
||||||
|
|
||||||
|
# Eclipse
|
||||||
.cproject
|
.cproject
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.metadata
|
.metadata
|
||||||
|
|
||||||
/build*
|
/build*
|
||||||
|
/cmake-build*
|
||||||
|
14
.idea/codeStyles/Project.xml
generated
Normal file
14
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<clangFormatSettings>
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</clangFormatSettings>
|
||||||
|
<codeStyleSettings language="CMake">
|
||||||
|
<indentOptions>
|
||||||
|
<option name="INDENT_SIZE" value="2" />
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="0" />
|
||||||
|
<option name="TAB_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
185
CHANGELOG.md
185
CHANGELOG.md
@ -8,6 +8,191 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
# [v6.0.0]
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
|
||||||
|
constants.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- DHB TM handler `handleDeviceTM` renamed to `handleDeviceTm` and now takes
|
||||||
|
`util::DataWrapper` as the data input argument. This allows more flexibility in the possible
|
||||||
|
types of telemetry.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/669
|
||||||
|
- Add `util::DataWrapper` class inside the `util` module. This is a tagged union which allows
|
||||||
|
to specify raw data either as a classic C-style raw pointer and size or as a `SerializeIF`
|
||||||
|
pointer.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/668
|
||||||
|
- Add new `UnsignedByteField` class
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/660
|
||||||
|
|
||||||
|
# [v5.0.0] 25.07.2022
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Renamed auto-formatting script to `auto-formatter.sh` and made it more robust.
|
||||||
|
If `cmake-format` is installed, it will also auto-format the `CMakeLists.txt` files now.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/625
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/626
|
||||||
|
- Bump C++ required version to C++17. Every project which uses the FSFW and every modern
|
||||||
|
compiler supports it
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622
|
||||||
|
- New CMake option `FSFW_HAL_LINUX_ADD_LIBGPIOD` to specifically exclude `gpiod` code.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
|
||||||
|
- HAL Devicehandlers: Periodic printout is run-time configurable now
|
||||||
|
- `oneShotAction` flag in the `TestTask` class is not static anymore
|
||||||
|
- `SimpleRingBuffer::writeData` now checks if the amount is larger than the total size of the
|
||||||
|
Buffer and rejects such writeData calls with `returnvalue::FAILED`
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/586
|
||||||
|
- Major update for version handling, using `git describe` to fetch version information with git.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/601
|
||||||
|
- Add helper functions provided by [`cmake-modules`](https://github.com/bilke/cmake-modules)
|
||||||
|
manually now. Those should not change too often and only a small subset is needed
|
||||||
|
- Separate folder for easier update and for distinction
|
||||||
|
- LICENSE file included
|
||||||
|
- use `int` for version numbers to allow unset or uninitialized version
|
||||||
|
- Initialize Version object with numbers set to -1
|
||||||
|
- Instead of hardcoding the git hash, it is now retrieved from git
|
||||||
|
- `Version` now allows specifying additional version information like the git SHA1 hash and the
|
||||||
|
versions since the last tag
|
||||||
|
- Additional information is set to the last part of the git describe output for `FSFW_VERSION` now.
|
||||||
|
- Version still need to be hand-updated if the FSFW is not included as a submodule for now.
|
||||||
|
- IPC Message Queue Handling: Allow passing an optional `MqArgs` argument into the MessageQueue
|
||||||
|
creation call. It allows passing context information and an arbitrary user argument into
|
||||||
|
the message queue. Also streamlined and simplified `MessageQueue` implementation for all OSALs
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/583
|
||||||
|
- Internal API change: Moved the `fsfw_hal` to the `src` folder and integration and internal
|
||||||
|
tests part of `fsfw_tests` to `src`. Unittests are now in a dedicated folder called `unittests`
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/653
|
||||||
|
|
||||||
|
### Task Module Refactoring
|
||||||
|
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/636
|
||||||
|
|
||||||
|
**Refactoring general task code**
|
||||||
|
|
||||||
|
- There was a lot of duplicate/boilerplate code inside the individual task IF OSAL implementations.
|
||||||
|
Remove it by introducing base classes `PeriodicTaskBase` and `FixedTimeslotTaskBase`.
|
||||||
|
|
||||||
|
**Refactor PeriodicTaskIF**
|
||||||
|
|
||||||
|
- Convert `virtual ReturnValue_t addComponent(object_id_t object)` to
|
||||||
|
`virtual ReturnValue_t addComponent(object_id_t object, uint8_t opCode = 0)`, allowing to pass
|
||||||
|
the operation code passed to `performOperation`. Updated API taking
|
||||||
|
an `ExecutableObjectIF` accordingly
|
||||||
|
|
||||||
|
**Refactor FixedTimeslotTaskIF**
|
||||||
|
|
||||||
|
- Add additional `addSlot` function which takes an `ExecutableObjectIF` pointer and its Object ID
|
||||||
|
|
||||||
|
**Refactor FixedSequenceSlot**
|
||||||
|
|
||||||
|
- Introduce typedef `CustomCheckFunc` for `ReturnValue_t (*customCheckFunction)(const SlotList&)`.
|
||||||
|
- Convert `ReturnValue_t (*customCheckFunction)(const SlotList&)` to
|
||||||
|
`ReturnValue_t (*customCheckFunction)(const SlotList&, void*)`, allowing arbitrary user arguments
|
||||||
|
for the custom checker
|
||||||
|
|
||||||
|
**Linux Task Module**
|
||||||
|
|
||||||
|
- Use composition instead of inheritance for the `PeriodicPosixTask` and make the `PosixTask` a
|
||||||
|
member of the class
|
||||||
|
|
||||||
|
### HAL
|
||||||
|
|
||||||
|
- HAL Linux Uart: Baudrate and bits per word are enums now, avoiding misconfigurations
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/585
|
||||||
|
- HAL Linux SPI: Set the Clock Default State when setting new SPI speed
|
||||||
|
and mode
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/573
|
||||||
|
- GPIO HAL: `Direction`, `GpioOperation` and `Levels` are enum classes now, which prevents
|
||||||
|
name clashes with Windows defines.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
|
||||||
|
- HAL Linux Uart: Baudrate and bits per word are enums now, avoiding misconfigurations
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/585
|
||||||
|
|
||||||
|
### Time
|
||||||
|
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/584 and
|
||||||
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/593
|
||||||
|
|
||||||
|
- `timeval` to `TimeOfDay_t`
|
||||||
|
- Added Mutex for gmtime calls: (compare http://www.opengate.at/blog/2020/01/timeless/)
|
||||||
|
- Moved the statics used by Clock in ClockCommon.cpp to this file
|
||||||
|
- Better check for leap seconds
|
||||||
|
- Added Unittests for Clock (only getter)
|
||||||
|
|
||||||
|
### Power
|
||||||
|
|
||||||
|
- `PowerSwitchIF`: Remove `const` specifier from `sendSwitchCommand` and `sendFuseOnCommand` and
|
||||||
|
also specify a `ReturnValue_t` return type
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/590
|
||||||
|
- Extend `PowerSwitcher` module to optionally check current state when calling `turnOn` or
|
||||||
|
`turnOff`. Tis can be helpful to avoid commanding switches which do not need commanding
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/590
|
||||||
|
|
||||||
|
## Removed
|
||||||
|
|
||||||
|
- Removed the `HkSwitchHelper`. This module should not be needed anymore, now that the local
|
||||||
|
datapools have been implemented.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/557
|
||||||
|
|
||||||
|
## Additions
|
||||||
|
|
||||||
|
- New constructor for PoolEntry which allows to simply specify the length of the pool entry.
|
||||||
|
This is also the new default constructor for scalar value with 0 as an initial value
|
||||||
|
- Added options for CI/CD builds: `FSFW_CICD_BUILD`. This allows the source code to know
|
||||||
|
whether it is running in CI/CD
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/623
|
||||||
|
- Basic `clion` support: Update `.gitignore` and add some basic run configurations
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/625
|
||||||
|
- LTO support: Allow using LTO/IPO by setting `FSFW_ENABLE_LTO=1`. CMake is able to detect whether
|
||||||
|
the user compiler supports IPO/LPO. LTO is on by default now. Most modern compilers support it,
|
||||||
|
can make good use of it and it usually makes the code faster and/or smaller.
|
||||||
|
After some more research:
|
||||||
|
Enabling LTO will actually cause the compiler to only produce thin LTO by adding
|
||||||
|
`-flto -fno-fat-lto-objects` to the compiler options. I am not sure this is an ideal choice
|
||||||
|
because if an application linking against the FSFW does not use LTO, there can be compile
|
||||||
|
issues (e.g. observed when compiling the FSFW tests without LTO). This is a known issue as
|
||||||
|
can be seen in the multiple CMake issues for it:
|
||||||
|
- https://gitlab.kitware.com/cmake/cmake/-/issues/22913,
|
||||||
|
- https://gitlab.kitware.com/cmake/cmake/-/issues/16808,
|
||||||
|
- https://gitlab.kitware.com/cmake/cmake/-/issues/21696
|
||||||
|
Easiest solution for now: Keep this option OFF by default.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/616
|
||||||
|
- Linux HAL: Add wiretapping option for I2C. Enabled with `FSFW_HAL_I2C_WIRETAPPING` defined to 1
|
||||||
|
- Dedicated Version class and constant `fsfw::FSFW_VERSION` containing version information
|
||||||
|
inside `fsfw/version.h`
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/559
|
||||||
|
- Added generic PUS TC Scheduler Service 11. It depends on the new added Emebeded Template Library
|
||||||
|
(ETL) dependency.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/594
|
||||||
|
- Added ETL dependency and improved library dependency management
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/592
|
||||||
|
- Add a `DummyPowerSwitcher` module which can be useful for test setups when no PCDU is available
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/590
|
||||||
|
- New typedef for switcher type
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/590
|
||||||
|
- `Subsystem`: New API to add table and sequence entries
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- TCP TMTC Server: `MutexGuard` was not created properly in
|
||||||
|
`TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent)` call.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/618
|
||||||
|
- Fix infinite recursion in `prepareHealthSetReply` of PUS Health Service 201.
|
||||||
|
Is not currently used right now but might be used in the future
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/617
|
||||||
|
- Move some CMake directives further up top so they are not ignored
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/621
|
||||||
|
- Small bugfix in STM32 HAL for SPI
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/599
|
||||||
|
- HAL GPIO: Improved error checking in `LinuxLibgpioIF::configureGpios(...)`. If a GPIO
|
||||||
|
configuration fails, the function will exit prematurely with a dedicated error code
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/602
|
||||||
|
|
||||||
# [v4.0.0]
|
# [v4.0.0]
|
||||||
|
|
||||||
## Additions
|
## Additions
|
||||||
|
602
CMakeLists.txt
602
CMakeLists.txt
@ -1,23 +1,115 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(FSFW_VERSION 4)
|
set(MSG_PREFIX "fsfw |")
|
||||||
set(FSFW_SUBVERSION 0)
|
|
||||||
set(FSFW_REVISION 0)
|
|
||||||
|
|
||||||
# Add the cmake folder so the FindSphinx module is found
|
# Add the cmake folder so the FindSphinx module is found
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
list(APPEND CMAKE_MODULE_PATH
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake-modules/bilke")
|
||||||
|
list(APPEND CMAKE_MODULE_PATH
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake-modules/rpavlik")
|
||||||
|
|
||||||
option(FSFW_GENERATE_SECTIONS
|
# ##############################################################################
|
||||||
"Generate function and data sections. Required to remove unused code" ON
|
# Version file handling #
|
||||||
)
|
# ##############################################################################
|
||||||
if(FSFW_GENERATE_SECTIONS)
|
|
||||||
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
|
set(FSFW_VERSION_IF_GIT_FAILS 5)
|
||||||
|
set(FSFW_SUBVERSION_IF_GIT_FAILS 0)
|
||||||
|
set(FSFW_REVISION_IF_GIT_FAILS 0)
|
||||||
|
|
||||||
|
set(FSFW_GIT_VER_HANDLING_OK FALSE)
|
||||||
|
# Version handling
|
||||||
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||||
|
message(STATUS "${MSG_PREFIX} Determining version information with git")
|
||||||
|
include(FsfwHelpers)
|
||||||
|
determine_version_with_git("--exclude" "docker_*")
|
||||||
|
if(GIT_INFO)
|
||||||
|
set(FSFW_GIT_INFO
|
||||||
|
${GIT_INFO}
|
||||||
|
CACHE STRING "Version information retrieved with git describe")
|
||||||
|
list(GET FSFW_GIT_INFO 1 FSFW_VERSION)
|
||||||
|
list(GET FSFW_GIT_INFO 2 FSFW_SUBVERSION)
|
||||||
|
list(GET FSFW_GIT_INFO 3 FSFW_REVISION)
|
||||||
|
list(GET FSFW_GIT_INFO 4 FSFW_VCS_INFO)
|
||||||
|
if(NOT FSFW_VERSION)
|
||||||
|
set(FSFW_VERSION ${FSFW_VERSION_IF_GIT_FAILS})
|
||||||
|
endif()
|
||||||
|
if(NOT FSFW_SUBVERSION)
|
||||||
|
set(FSFW_SUBVERSION ${FSFW_SUBVERSION_IF_GIT_FAILS})
|
||||||
|
endif()
|
||||||
|
if(NOT FSFW_REVISION)
|
||||||
|
set(FSFW_REVISION ${FSFW_REVISION_IF_GIT_FAILS})
|
||||||
|
endif()
|
||||||
|
set(FSFW_GIT_VER_HANDLING_OK TRUE)
|
||||||
|
else()
|
||||||
|
set(FSFW_GIT_VER_HANDLING_OK FALSE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(NOT FSFW_GIT_VER_HANDLING_OK)
|
||||||
|
set(FSFW_VERSION ${FSFW_VERSION_IF_GIT_FAILS})
|
||||||
|
set(FSFW_SUBVERSION ${FSFW_SUBVERSION_IF_GIT_FAILS})
|
||||||
|
set(FSFW_REVISION ${FSFW_REVISION_IF_GIT_FAILS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(FSFW_BUILD_UNITTESTS "Build unittest binary in addition to static library" OFF)
|
set(LIB_FSFW_NAME fsfw)
|
||||||
|
project(${LIB_FSFW_NAME}
|
||||||
|
VERSION ${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION})
|
||||||
|
|
||||||
|
if(NOT CMAKE_CXX_STANDARD)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
elseif(${CMAKE_CXX_STANDARD} LESS 17)
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"${MSG_PREFIX} Compiling the FSFW requires a minimum of C++17 support")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(FSFW_SOURCES_DIR "${CMAKE_SOURCE_DIR}/src/fsfw")
|
||||||
|
|
||||||
|
set(FSFW_ETL_LIB_NAME etl)
|
||||||
|
set(FSFW_ETL_LINK_TARGET etl::etl)
|
||||||
|
set(FSFW_ETL_LIB_MAJOR_VERSION
|
||||||
|
20
|
||||||
|
CACHE STRING "ETL library major version requirement")
|
||||||
|
set(FSFW_ETL_LIB_VERSION
|
||||||
|
${FSFW_ETL_LIB_MAJOR_VERSION}.28.0
|
||||||
|
CACHE STRING "ETL library exact version requirement")
|
||||||
|
set(FSFW_ETL_LINK_TARGET etl::etl)
|
||||||
|
|
||||||
|
set(FSFW_CATCH2_LIB_MAJOR_VERSION
|
||||||
|
3
|
||||||
|
CACHE STRING "Catch2 library major version requirement")
|
||||||
|
set(FSFW_CATCH2_LIB_VERSION
|
||||||
|
v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5
|
||||||
|
CACHE STRING "Catch2 library exact version requirement")
|
||||||
|
|
||||||
|
# Keep this off by default for now. See PR:
|
||||||
|
# https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/616 for information which
|
||||||
|
# keeping this on by default is problematic
|
||||||
|
option(
|
||||||
|
FSFW_ENABLE_IPO
|
||||||
|
"Enable interprocedural optimization or link-time optimization if available"
|
||||||
|
OFF)
|
||||||
|
if(FSFW_ENABLE_IPO)
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT IPO_ERROR)
|
||||||
|
if(NOT IPO_SUPPORTED)
|
||||||
|
message(STATUS "FSFW | IPO/LTO not supported: ${IPO_ERROR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(FSFW_GENERATE_SECTIONS
|
||||||
|
"Generate function and data sections. Required to remove unused code" ON)
|
||||||
|
if(FSFW_GENERATE_SECTIONS)
|
||||||
|
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(FSFW_BUILD_TESTS "Build unittest binary in addition to static library"
|
||||||
|
OFF)
|
||||||
|
option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" OFF)
|
||||||
option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
|
option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
|
||||||
if(FSFW_BUILD_UNITTESTS)
|
if(FSFW_BUILD_TESTS)
|
||||||
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)
|
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
||||||
@ -26,6 +118,12 @@ option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON)
|
|||||||
option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF)
|
option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF)
|
||||||
option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON)
|
option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON)
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers"
|
||||||
|
OFF)
|
||||||
|
option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Optional sources
|
# Optional sources
|
||||||
option(FSFW_ADD_PUS "Compile with PUS sources" ON)
|
option(FSFW_ADD_PUS "Compile with PUS sources" ON)
|
||||||
option(FSFW_ADD_MONITORING "Compile with monitoring components" ON)
|
option(FSFW_ADD_MONITORING "Compile with monitoring components" ON)
|
||||||
@ -38,54 +136,95 @@ option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF)
|
|||||||
# Contrib sources
|
# Contrib sources
|
||||||
option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF)
|
option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF)
|
||||||
|
|
||||||
set(LIB_FSFW_NAME fsfw)
|
|
||||||
set(FSFW_TEST_TGT fsfw-tests)
|
set(FSFW_TEST_TGT fsfw-tests)
|
||||||
set(FSFW_DUMMY_TGT fsfw-dummy)
|
set(FSFW_DUMMY_TGT fsfw-dummy)
|
||||||
|
|
||||||
project(${LIB_FSFW_NAME})
|
|
||||||
add_library(${LIB_FSFW_NAME})
|
add_library(${LIB_FSFW_NAME})
|
||||||
|
|
||||||
if(FSFW_BUILD_UNITTESTS)
|
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
||||||
message(STATUS "Building the FSFW unittests in addition to the static library")
|
set_property(TARGET ${LIB_FSFW_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
||||||
# Check whether the user has already installed Catch2 first
|
TRUE)
|
||||||
find_package(Catch2 3)
|
endif()
|
||||||
# Not installed, so use FetchContent to download and provide Catch2
|
|
||||||
if(NOT Catch2_FOUND)
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
if(FSFW_BUILD_TESTS)
|
||||||
Catch2
|
message(
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
STATUS
|
||||||
GIT_TAG v3.0.0-preview4
|
"${MSG_PREFIX} Building the FSFW unittests in addition to the static library"
|
||||||
)
|
)
|
||||||
|
# Check whether the user has already installed Catch2 first
|
||||||
|
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION})
|
||||||
|
# Not installed, so use FetchContent to download and provide Catch2
|
||||||
|
if(NOT Catch2_FOUND)
|
||||||
|
message(
|
||||||
|
STATUS
|
||||||
|
"${MSG_PREFIX} Catch2 installation not found. Downloading Catch2 library with FetchContent"
|
||||||
|
)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(Catch2)
|
FetchContent_Declare(
|
||||||
#fixes regression -preview4, to be confirmed in later releases
|
Catch2
|
||||||
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
endif()
|
GIT_TAG ${FSFW_CATCH2_LIB_VERSION})
|
||||||
|
|
||||||
set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg)
|
list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2)
|
||||||
configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h)
|
endif()
|
||||||
configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h)
|
|
||||||
|
|
||||||
project(${FSFW_TEST_TGT} CXX C)
|
set(FSFW_CONFIG_PATH unittests/testcfg)
|
||||||
add_executable(${FSFW_TEST_TGT})
|
configure_file(unittests/testcfg/FSFWConfig.h.in FSFWConfig.h)
|
||||||
|
configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h)
|
||||||
|
|
||||||
if(FSFW_TESTS_GEN_COV)
|
project(${FSFW_TEST_TGT} CXX C)
|
||||||
message(STATUS "Generating coverage data for the library")
|
add_executable(${FSFW_TEST_TGT})
|
||||||
message(STATUS "Targets linking against ${LIB_FSFW_NAME} "
|
if(IPO_SUPPORTED AND FSFW_ENABLE_IPO)
|
||||||
"will be compiled with coverage data as well"
|
set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION
|
||||||
)
|
TRUE)
|
||||||
include(FetchContent)
|
endif()
|
||||||
FetchContent_Declare(
|
|
||||||
cmake-modules
|
if(FSFW_TESTS_GEN_COV)
|
||||||
GIT_REPOSITORY https://github.com/bilke/cmake-modules.git
|
message(STATUS "${MSG_PREFIX} Generating coverage data for the library")
|
||||||
)
|
message(STATUS "${MSG_PREFIX} Targets linking against ${LIB_FSFW_NAME} "
|
||||||
FetchContent_MakeAvailable(cmake-modules)
|
"will be compiled with coverage data as well")
|
||||||
set(CMAKE_BUILD_TYPE "Debug")
|
set(CMAKE_BUILD_TYPE "Debug")
|
||||||
list(APPEND CMAKE_MODULE_PATH ${cmake-modules_SOURCE_DIR})
|
include(CodeCoverage)
|
||||||
include(CodeCoverage)
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
message(
|
||||||
|
STATUS
|
||||||
|
"${MSG_PREFIX} Finding and/or providing etl library with version ${FSFW_ETL_LIB_MAJOR_VERSION}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check whether the user has already installed ETL first
|
||||||
|
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
|
||||||
|
# Not installed, so use FetchContent to download and provide etl
|
||||||
|
if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
|
||||||
|
message(
|
||||||
|
STATUS
|
||||||
|
"${MSG_PREFIX} No ETL installation was found with find_package. Installing and providing "
|
||||||
|
"etl with FindPackage")
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
${FSFW_ETL_LIB_NAME}
|
||||||
|
GIT_REPOSITORY https://github.com/ETLCPP/etl
|
||||||
|
GIT_TAG ${FSFW_ETL_LIB_VERSION})
|
||||||
|
|
||||||
|
list(APPEND FSFW_FETCH_CONTENT_TARGETS ${FSFW_ETL_LIB_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# The documentation for FetchContent recommends declaring all the dependencies
|
||||||
|
# before making them available. We make all declared dependency available here
|
||||||
|
# after their declaration
|
||||||
|
if(FSFW_FETCH_CONTENT_TARGETS)
|
||||||
|
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
|
||||||
|
if(TARGET ${FSFW_ETL_LIB_NAME})
|
||||||
|
add_library(${FSFW_ETL_LINK_TARGET} ALIAS ${FSFW_ETL_LIB_NAME})
|
||||||
|
endif()
|
||||||
|
if(TARGET Catch2)
|
||||||
|
# Fixes regression -preview4, to be confirmed in later releases Related
|
||||||
|
# GitHub issue: https://github.com/catchorg/Catch2/issues/2417
|
||||||
|
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FSFW_CORE_INC_PATH "inc")
|
set(FSFW_CORE_INC_PATH "inc")
|
||||||
@ -93,256 +232,241 @@ set(FSFW_CORE_INC_PATH "inc")
|
|||||||
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos)
|
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos)
|
||||||
|
|
||||||
# For configure files
|
# For configure files
|
||||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
target_include_directories(${LIB_FSFW_NAME}
|
||||||
)
|
INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT CMAKE_CXX_STANDARD)
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
||||||
elseif(${CMAKE_CXX_STANDARD} LESS 11)
|
|
||||||
message(FATAL_ERROR "Compiling the FSFW requires a minimum of C++11 support")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Backwards comptability
|
# Backwards comptability
|
||||||
if(OS_FSFW AND NOT FSFW_OSAL)
|
if(OS_FSFW AND NOT FSFW_OSAL)
|
||||||
message(WARNING "Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW")
|
message(
|
||||||
set(FSFW_OSAL OS_FSFW)
|
WARNING
|
||||||
|
"${MSG_PREFIX} Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW")
|
||||||
|
set(FSFW_OSAL OS_FSFW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT FSFW_OSAL)
|
if(NOT FSFW_OSAL)
|
||||||
message(STATUS "No OS for FSFW via FSFW_OSAL set. Assuming host OS")
|
message(STATUS "No OS for FSFW via FSFW_OSAL set. Assuming host OS")
|
||||||
# Assume host OS and autodetermine from OS_FSFW
|
# Assume host OS and autodetermine from OS_FSFW
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(FSFW_OSAL "linux"
|
set(FSFW_OSAL
|
||||||
CACHE STRING
|
"linux"
|
||||||
"OS abstraction layer used in the FSFW"
|
CACHE STRING "OS abstraction layer used in the FSFW")
|
||||||
)
|
elseif(WIN32)
|
||||||
elseif(WIN32)
|
set(FSFW_OSAL
|
||||||
set(FSFW_OSAL "host"
|
"host"
|
||||||
CACHE STRING "OS abstraction layer used in the FSFW"
|
CACHE STRING "OS abstraction layer used in the FSFW")
|
||||||
)
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST)
|
set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST)
|
||||||
|
|
||||||
if(FSFW_OSAL MATCHES host)
|
if(FSFW_OSAL MATCHES host)
|
||||||
set(FSFW_OS_NAME "Host")
|
set(FSFW_OS_NAME "Host")
|
||||||
set(FSFW_OSAL_HOST ON)
|
set(FSFW_OSAL_HOST ON)
|
||||||
elseif(FSFW_OSAL MATCHES linux)
|
elseif(FSFW_OSAL MATCHES linux)
|
||||||
set(FSFW_OS_NAME "Linux")
|
set(FSFW_OS_NAME "Linux")
|
||||||
set(FSFW_OSAL_LINUX ON)
|
set(FSFW_OSAL_LINUX ON)
|
||||||
elseif(FSFW_OSAL MATCHES freertos)
|
elseif(FSFW_OSAL MATCHES freertos)
|
||||||
set(FSFW_OS_NAME "FreeRTOS")
|
set(FSFW_OS_NAME "FreeRTOS")
|
||||||
set(FSFW_OSAL_FREERTOS ON)
|
set(FSFW_OSAL_FREERTOS ON)
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_OS_NAME})
|
||||||
${LIB_OS_NAME}
|
|
||||||
)
|
|
||||||
elseif(FSFW_OSAL STREQUAL rtems)
|
elseif(FSFW_OSAL STREQUAL rtems)
|
||||||
set(FSFW_OS_NAME "RTEMS")
|
set(FSFW_OS_NAME "RTEMS")
|
||||||
set(FSFW_OSAL_RTEMS ON)
|
set(FSFW_OSAL_RTEMS ON)
|
||||||
else()
|
else()
|
||||||
message(WARNING
|
message(
|
||||||
"Invalid operating system for FSFW specified! Setting to host.."
|
WARNING
|
||||||
)
|
"${MSG_PREFIX} Invalid operating system for FSFW specified! Setting to host.."
|
||||||
set(FSFW_OS_NAME "Host")
|
)
|
||||||
set(OS_FSFW "host")
|
set(FSFW_OS_NAME "Host")
|
||||||
|
set(OS_FSFW "host")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h)
|
configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h)
|
||||||
configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h)
|
configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h)
|
||||||
|
|
||||||
message(STATUS "Compiling FSFW for the ${FSFW_OS_NAME} operating system.")
|
message(
|
||||||
|
STATUS "${MSG_PREFIX} Compiling FSFW for the ${FSFW_OS_NAME} operating system"
|
||||||
|
)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(tests)
|
|
||||||
if(FSFW_ADD_HAL)
|
|
||||||
add_subdirectory(hal)
|
|
||||||
endif()
|
|
||||||
add_subdirectory(contrib)
|
add_subdirectory(contrib)
|
||||||
|
if(FSFW_BUILD_TESTS)
|
||||||
|
add_subdirectory(unittests)
|
||||||
|
endif()
|
||||||
if(FSFW_BUILD_DOCS)
|
if(FSFW_BUILD_DOCS)
|
||||||
add_subdirectory(docs)
|
add_subdirectory(docs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FSFW_BUILD_UNITTESTS)
|
if(FSFW_BUILD_TESTS)
|
||||||
if(FSFW_TESTS_GEN_COV)
|
if(FSFW_TESTS_GEN_COV)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
|
|
||||||
# Remove quotes.
|
# Remove quotes.
|
||||||
separate_arguments(COVERAGE_COMPILER_FLAGS
|
separate_arguments(COVERAGE_COMPILER_FLAGS NATIVE_COMMAND
|
||||||
NATIVE_COMMAND "${COVERAGE_COMPILER_FLAGS}"
|
"${COVERAGE_COMPILER_FLAGS}")
|
||||||
)
|
|
||||||
|
|
||||||
# Add compile options manually, we don't want coverage for Catch2
|
# Add compile options manually, we don't want coverage for Catch2
|
||||||
target_compile_options(${FSFW_TEST_TGT} PRIVATE
|
target_compile_options(${FSFW_TEST_TGT}
|
||||||
"${COVERAGE_COMPILER_FLAGS}"
|
PRIVATE "${COVERAGE_COMPILER_FLAGS}")
|
||||||
)
|
target_compile_options(${LIB_FSFW_NAME}
|
||||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
PRIVATE "${COVERAGE_COMPILER_FLAGS}")
|
||||||
"${COVERAGE_COMPILER_FLAGS}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Exclude directories here
|
# Exclude directories here
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(GCOVR_ADDITIONAL_ARGS
|
set(GCOVR_ADDITIONAL_ARGS "--exclude-throw-branches"
|
||||||
"--exclude-throw-branches"
|
"--exclude-unreachable-branches")
|
||||||
"--exclude-unreachable-branches"
|
set(COVERAGE_EXCLUDES "/c/msys64/mingw64/*" "*/fsfw_hal/*")
|
||||||
)
|
elseif(UNIX)
|
||||||
set(COVERAGE_EXCLUDES
|
set(COVERAGE_EXCLUDES
|
||||||
"/c/msys64/mingw64/*" "*/fsfw_hal/*"
|
"/usr/include/*"
|
||||||
)
|
"/usr/bin/*"
|
||||||
elseif(UNIX)
|
"Catch2/*"
|
||||||
set(COVERAGE_EXCLUDES
|
"/usr/local/include/*"
|
||||||
"/usr/include/*" "/usr/bin/*" "Catch2/*"
|
"*/fsfw_tests/*"
|
||||||
"/usr/local/include/*" "*/fsfw_tests/*"
|
"*/catch2-src/*"
|
||||||
"*/catch2-src/*" "*/fsfw_hal/*"
|
"*/fsfw_hal/*")
|
||||||
)
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_options(${FSFW_TEST_TGT} PRIVATE
|
target_link_options(${FSFW_TEST_TGT} PRIVATE -fprofile-arcs
|
||||||
-fprofile-arcs
|
-ftest-coverage)
|
||||||
-ftest-coverage
|
target_link_options(${LIB_FSFW_NAME} PRIVATE -fprofile-arcs
|
||||||
)
|
-ftest-coverage)
|
||||||
target_link_options(${LIB_FSFW_NAME} PRIVATE
|
# Need to specify this as an interface, otherwise there will the compile
|
||||||
-fprofile-arcs
|
# issues
|
||||||
-ftest-coverage
|
target_link_options(${LIB_FSFW_NAME} INTERFACE -fprofile-arcs
|
||||||
)
|
-ftest-coverage)
|
||||||
# Need to specify this as an interface, otherwise there will the compile issues
|
|
||||||
target_link_options(${LIB_FSFW_NAME} INTERFACE
|
|
||||||
-fprofile-arcs
|
|
||||||
-ftest-coverage
|
|
||||||
)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
setup_target_for_coverage_gcovr_html(
|
setup_target_for_coverage_gcovr_html(
|
||||||
NAME ${FSFW_TEST_TGT}_coverage
|
NAME ${FSFW_TEST_TGT}_coverage EXECUTABLE ${FSFW_TEST_TGT}
|
||||||
EXECUTABLE ${FSFW_TEST_TGT}
|
DEPENDENCIES ${FSFW_TEST_TGT})
|
||||||
DEPENDENCIES ${FSFW_TEST_TGT}
|
else()
|
||||||
)
|
setup_target_for_coverage_lcov(
|
||||||
else()
|
NAME ${FSFW_TEST_TGT}_coverage EXECUTABLE ${FSFW_TEST_TGT}
|
||||||
setup_target_for_coverage_lcov(
|
DEPENDENCIES ${FSFW_TEST_TGT})
|
||||||
NAME ${FSFW_TEST_TGT}_coverage
|
endif()
|
||||||
EXECUTABLE ${FSFW_TEST_TGT}
|
|
||||||
DEPENDENCIES ${FSFW_TEST_TGT}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${FSFW_TEST_TGT} PRIVATE Catch2::Catch2 ${LIB_FSFW_NAME})
|
endif()
|
||||||
|
target_link_libraries(${FSFW_TEST_TGT} PRIVATE Catch2::Catch2
|
||||||
|
${LIB_FSFW_NAME})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it.
|
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. If
|
||||||
# If this is not given, we include the default configuration and emit a warning.
|
# this is not given, we include the default configuration and emit a warning.
|
||||||
if(NOT FSFW_CONFIG_PATH)
|
if(NOT FSFW_CONFIG_PATH)
|
||||||
set(DEF_CONF_PATH misc/defaultcfg/fsfwconfig)
|
set(DEF_CONF_PATH misc/defaultcfg/fsfwconfig)
|
||||||
if(NOT FSFW_BUILD_DOCS)
|
if(NOT FSFW_BUILD_DOCS)
|
||||||
message(WARNING "Flight Software Framework configuration path not set!")
|
message(
|
||||||
message(WARNING "Setting default configuration from ${DEF_CONF_PATH} ..")
|
WARNING
|
||||||
endif()
|
"${MSG_PREFIX} Flight Software Framework configuration path not set")
|
||||||
add_subdirectory(${DEF_CONF_PATH})
|
message(
|
||||||
set(FSFW_CONFIG_PATH ${DEF_CONF_PATH})
|
WARNING
|
||||||
|
"${MSG_PREFIX} Setting default configuration from ${DEF_CONF_PATH} ..")
|
||||||
|
endif()
|
||||||
|
add_subdirectory(${DEF_CONF_PATH})
|
||||||
|
set(FSFW_CONFIG_PATH ${DEF_CONF_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# FSFW might be part of a possibly complicated folder structure, so we
|
# FSFW might be part of a possibly complicated folder structure, so we extract
|
||||||
# extract the absolute path of the fsfwconfig folder.
|
# the absolute path of the fsfwconfig folder.
|
||||||
if(IS_ABSOLUTE ${FSFW_CONFIG_PATH})
|
if(IS_ABSOLUTE ${FSFW_CONFIG_PATH})
|
||||||
set(FSFW_CONFIG_PATH_ABSOLUTE ${FSFW_CONFIG_PATH})
|
set(FSFW_CONFIG_PATH_ABSOLUTE ${FSFW_CONFIG_PATH})
|
||||||
else()
|
else()
|
||||||
get_filename_component(FSFW_CONFIG_PATH_ABSOLUTE
|
get_filename_component(FSFW_CONFIG_PATH_ABSOLUTE ${FSFW_CONFIG_PATH} REALPATH
|
||||||
${FSFW_CONFIG_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}
|
BASE_DIR ${CMAKE_SOURCE_DIR})
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(INCLUDE_PATH ${FSFW_ADDITIONAL_INC_PATHS})
|
foreach(INCLUDE_PATH ${FSFW_ADDITIONAL_INC_PATHS})
|
||||||
if(IS_ABSOLUTE ${INCLUDE_PATH})
|
if(IS_ABSOLUTE ${INCLUDE_PATH})
|
||||||
set(CURR_ABS_INC_PATH "${INCLUDE_PATH}")
|
set(CURR_ABS_INC_PATH "${INCLUDE_PATH}")
|
||||||
else()
|
else()
|
||||||
get_filename_component(CURR_ABS_INC_PATH
|
get_filename_component(CURR_ABS_INC_PATH ${INCLUDE_PATH} REALPATH BASE_DIR
|
||||||
${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})
|
${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
if(CMAKE_VERBOSE)
|
||||||
message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}")
|
message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND FSFW_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH})
|
list(APPEND FSFW_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
if(NOT DEFINED FSFW_WARNING_FLAGS)
|
if(NOT DEFINED FSFW_WARNING_FLAGS)
|
||||||
set(FSFW_WARNING_FLAGS
|
set(FSFW_WARNING_FLAGS
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
-Wimplicit-fallthrough=1
|
-Wimplicit-fallthrough=1
|
||||||
-Wno-unused-parameter
|
-Wno-unused-parameter
|
||||||
-Wno-psabi
|
-Wno-psabi
|
||||||
)
|
-Wduplicated-cond # check for duplicate conditions
|
||||||
endif()
|
-Wduplicated-branches # check for duplicate branches
|
||||||
|
-Wlogical-op # Search for bitwise operations instead of logical
|
||||||
|
-Wnull-dereference # Search for NULL dereference
|
||||||
|
-Wundef # Warn if undefind marcos are used
|
||||||
|
-Wformat=2 # Format string problem detection
|
||||||
|
-Wformat-overflow=2 # Formatting issues in printf
|
||||||
|
-Wformat-truncation=2 # Formatting issues in printf
|
||||||
|
-Wformat-security # Search for dangerous printf operations
|
||||||
|
-Wstrict-overflow=3 # Warn if integer overflows might happen
|
||||||
|
-Warray-bounds=2 # Some array bounds violations will be found
|
||||||
|
-Wshift-overflow=2 # Search for bit left shift overflows (<c++14)
|
||||||
|
-Wcast-qual # Warn if the constness is cast away
|
||||||
|
-Wstringop-overflow=4
|
||||||
|
# -Wstack-protector # Emits a few false positives for low level access
|
||||||
|
# -Wconversion # Creates many false positives -Warith-conversion # Use
|
||||||
|
# with Wconversion to find more implicit conversions -fanalyzer # Should
|
||||||
|
# be used to look through problems
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(FSFW_GENERATE_SECTIONS)
|
if(FSFW_GENERATE_SECTIONS)
|
||||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
target_compile_options(${LIB_FSFW_NAME} PRIVATE "-ffunction-sections"
|
||||||
"-ffunction-sections"
|
"-fdata-sections")
|
||||||
"-fdata-sections"
|
endif()
|
||||||
)
|
|
||||||
endif()
|
if(FSFW_REMOVE_UNUSED_CODE)
|
||||||
|
target_link_options(${LIB_FSFW_NAME} PRIVATE "Wl,--gc-sections")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FSFW_WARNING_SHADOW_LOCAL_GCC)
|
||||||
|
list(APPEND WARNING_FLAGS "-Wshadow=local")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(FSFW_REMOVE_UNUSED_CODE)
|
|
||||||
target_link_options(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
"Wl,--gc-sections"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FSFW_WARNING_SHADOW_LOCAL_GCC)
|
|
||||||
list(APPEND WARNING_FLAGS "-Wshadow=local")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
set(COMPILER_FLAGS "/permissive-")
|
set(COMPILER_FLAGS "/permissive-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Required include paths to compile the FSFW
|
# Required include paths to compile the FSFW
|
||||||
target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
target_include_directories(
|
||||||
${CMAKE_SOURCE_DIR}
|
${LIB_FSFW_NAME} INTERFACE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE}
|
||||||
${FSFW_CONFIG_PATH_ABSOLUTE}
|
${FSFW_CORE_INC_PATH} ${FSFW_ADD_INC_PATHS_ABS})
|
||||||
${FSFW_CORE_INC_PATH}
|
|
||||||
${FSFW_ADD_INC_PATHS_ABS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Includes path required to compile FSFW itself as well
|
# Includes path required to compile FSFW itself as well We assume that the
|
||||||
# We assume that the fsfwconfig folder uses include relative to the project
|
# fsfwconfig folder uses include relative to the project root here!
|
||||||
# root here!
|
target_include_directories(
|
||||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
${LIB_FSFW_NAME} PRIVATE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE}
|
||||||
${CMAKE_SOURCE_DIR}
|
${FSFW_CORE_INC_PATH} ${FSFW_ADD_INC_PATHS_ABS})
|
||||||
${FSFW_CONFIG_PATH_ABSOLUTE}
|
|
||||||
${FSFW_CORE_INC_PATH}
|
|
||||||
${FSFW_ADD_INC_PATHS_ABS}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS}
|
||||||
${FSFW_WARNING_FLAGS}
|
${COMPILER_FLAGS})
|
||||||
${COMPILER_FLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS})
|
||||||
${FSFW_ADDITIONAL_LINK_LIBS}
|
target_link_libraries(${LIB_FSFW_NAME} PUBLIC ${FSFW_ETL_LINK_TARGET})
|
||||||
)
|
|
||||||
|
|
||||||
string(CONCAT POST_BUILD_COMMENT
|
string(
|
||||||
|
CONCAT
|
||||||
|
POST_BUILD_COMMENT
|
||||||
"######################################################################\n"
|
"######################################################################\n"
|
||||||
"Built FSFW v${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION}, "
|
"Built FSFW v${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION}, "
|
||||||
"Target OSAL: ${FSFW_OS_NAME}\n"
|
"Target OSAL: ${FSFW_OS_NAME}\n"
|
||||||
"######################################################################\n"
|
"######################################################################\n")
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${LIB_FSFW_NAME}
|
TARGET ${LIB_FSFW_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMENT ${POST_BUILD_COMMENT}
|
COMMENT ${POST_BUILD_COMMENT})
|
||||||
)
|
|
||||||
|
0
FSFWVersion.h.in
Normal file
0
FSFWVersion.h.in
Normal file
62
README.md
62
README.md
@ -11,9 +11,15 @@ with Airbus Defence and Space GmbH.
|
|||||||
|
|
||||||
## Quick facts
|
## Quick facts
|
||||||
|
|
||||||
The framework is designed for systems, which communicate with external devices, perform control loops, receive telecommands and send telemetry, and need to maintain a high level of availability. Therefore, a mode and health system provides control over the states of the software and the controlled devices. In addition, a simple mechanism of event based fault detection, isolation and recovery is implemented as well.
|
The framework is designed for systems, which communicate with external devices, perform control loops,
|
||||||
|
receive telecommands and send telemetry, and need to maintain a high level of availability. Therefore,
|
||||||
|
a mode and health system provides control over the states of the software and the controlled devices.
|
||||||
|
In addition, a simple mechanism of event based fault detection, isolation and recovery is implemented as well.
|
||||||
|
|
||||||
The FSFW provides abstraction layers for operating systems to provide a uniform operating system abstraction layer (OSAL). Some components of this OSAL are required internally by the FSFW but is also very useful for developers to implement the same application logic on different operating systems with a uniform interface.
|
The FSFW provides abstraction layers for operating systems to provide a uniform operating system
|
||||||
|
abstraction layer (OSAL). Some components of this OSAL are required internally by the FSFW but is
|
||||||
|
also very useful for developers to implement the same application logic on different operating
|
||||||
|
systems with a uniform interface.
|
||||||
|
|
||||||
Currently, the FSFW provides the following OSALs:
|
Currently, the FSFW provides the following OSALs:
|
||||||
|
|
||||||
@ -45,6 +51,28 @@ A template configuration folder was provided and can be copied into the project
|
|||||||
a starting point. The [configuration section](docs/README-config.md#top) provides more specific
|
a starting point. The [configuration section](docs/README-config.md#top) provides more specific
|
||||||
information about the possible options.
|
information about the possible options.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
The Embedded Template Library (etl) is a dependency of the FSFW which is automatically
|
||||||
|
installed and provided by the build system unless the correction version was installed.
|
||||||
|
The current recommended version can be found inside the fsfw `CMakeLists.txt` file or by using
|
||||||
|
`ccmake` and looking up the `FSFW_ETL_LIB_MAJOR_VERSION` variable.
|
||||||
|
|
||||||
|
You can install the ETL library like this. On Linux, it might be necessary to add `sudo` before
|
||||||
|
the install call:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
git clone https://github.com/ETLCPP/etl
|
||||||
|
cd etl
|
||||||
|
git checkout <currentRecommendedVersion>
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake ..
|
||||||
|
cmake --install .
|
||||||
|
```
|
||||||
|
|
||||||
|
It is recommended to install `20.27.2` or newer for the package version handling of
|
||||||
|
ETL to work.
|
||||||
|
|
||||||
## Adding the library
|
## Adding the library
|
||||||
|
|
||||||
The following steps show how to add and use FSFW components. It is still recommended to
|
The following steps show how to add and use FSFW components. It is still recommended to
|
||||||
@ -71,9 +99,9 @@ add and link against the FSFW library in general.
|
|||||||
|
|
||||||
4. Link against the FSFW library
|
4. Link against the FSFW library
|
||||||
|
|
||||||
```cmake
|
```sh
|
||||||
target_link_libraries(<YourProjectName> PRIVATE fsfw)
|
target_link_libraries(${YourProjectName} PRIVATE fsfw)
|
||||||
```
|
```
|
||||||
|
|
||||||
5. It should now be possible use the FSFW as a static library from the user code.
|
5. It should now be possible use the FSFW as a static library from the user code.
|
||||||
|
|
||||||
@ -83,6 +111,19 @@ The FSFW also has unittests which use the [Catch2 library](https://github.com/ca
|
|||||||
These are built by setting the CMake option `FSFW_BUILD_UNITTESTS` to `ON` or `TRUE`
|
These are built by setting the CMake option `FSFW_BUILD_UNITTESTS` to `ON` or `TRUE`
|
||||||
from your project `CMakeLists.txt` file or from the command line.
|
from your project `CMakeLists.txt` file or from the command line.
|
||||||
|
|
||||||
|
You can install the Catch2 library, which prevents the build system to avoid re-downloading
|
||||||
|
the dependency if the unit tests are completely rebuilt. The current recommended version
|
||||||
|
can be found inside the fsfw `CMakeLists.txt` file or by using `ccmake` and looking up
|
||||||
|
the `FSFW_CATCH2_LIB_VERSION` variable.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/catchorg/Catch2.git
|
||||||
|
cd Catch2
|
||||||
|
git checkout <currentRecommendedVersion>
|
||||||
|
cmake -Bbuild -H. -DBUILD_TESTING=OFF
|
||||||
|
sudo cmake --build build/ --target install
|
||||||
|
```
|
||||||
|
|
||||||
The fsfw-tests binary will be built as part of the static library and dropped alongside it.
|
The fsfw-tests binary will be built as part of the static library and dropped alongside it.
|
||||||
If the unittests are built, the library and the tests will be built with coverage information by
|
If the unittests are built, the library and the tests will be built with coverage information by
|
||||||
default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`.
|
default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`.
|
||||||
@ -90,15 +131,15 @@ default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF
|
|||||||
You can use the following commands inside the `fsfw` folder to set up the build system
|
You can use the following commands inside the `fsfw` folder to set up the build system
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Unittest && cd build-Unittest
|
mkdir build-tests && cd build-tests
|
||||||
cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use `-DFSFW_OSAL=linux` on Linux systems.
|
You can also use `-DFSFW_OSAL=linux` on Linux systems.
|
||||||
|
|
||||||
Coverage data in HTML format can be generated using the `CodeCoverage`
|
Coverage data in HTML format can be generated using the `CodeCoverage`
|
||||||
[CMake module](https://github.com/bilke/cmake-modules/tree/master).
|
[CMake module](https://github.com/bilke/cmake-modules/tree/master).
|
||||||
To build the unittests, run them and then generare the coverage data in this format,
|
To build the unittests, run them and then generate the coverage data in this format,
|
||||||
the following command can be used inside the build directory after the build system was set up
|
the following command can be used inside the build directory after the build system was set up
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -147,7 +188,10 @@ and open the documentation conveniently. Try `helper.py -h for more information.
|
|||||||
|
|
||||||
The formatting is done by the `clang-format` tool. The configuration is contained within the
|
The formatting is done by the `clang-format` tool. The configuration is contained within the
|
||||||
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
|
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
|
||||||
can run the `apply-clang-format.sh` helper script to format all source files consistently.
|
can run the `auto-format.sh` helper script to format all source files consistently. Furthermore cmake-format is required to format CMake files which can be installed with:
|
||||||
|
````sh
|
||||||
|
sudo pip install cmakelang
|
||||||
|
````
|
||||||
|
|
||||||
## Index
|
## Index
|
||||||
|
|
||||||
|
@ -6,3 +6,15 @@ RUN apt-get --yes upgrade
|
|||||||
#tzdata is a dependency, won't install otherwise
|
#tzdata is a dependency, won't install otherwise
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
|
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
|
||||||
|
|
||||||
|
RUN git clone https://github.com/catchorg/Catch2.git && \
|
||||||
|
cd Catch2 && \
|
||||||
|
git checkout v3.0.0-preview5 && \
|
||||||
|
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
|
||||||
|
cmake --build build/ --target install
|
||||||
|
|
||||||
|
RUN git clone https://github.com/ETLCPP/etl.git && \
|
||||||
|
cd etl && \
|
||||||
|
git checkout 20.28.0 && \
|
||||||
|
cmake -B build . && \
|
||||||
|
cmake --install build/
|
||||||
|
8
automation/Jenkinsfile
vendored
8
automation/Jenkinsfile
vendored
@ -3,7 +3,7 @@ pipeline {
|
|||||||
BUILDDIR = 'build-tests'
|
BUILDDIR = 'build-tests'
|
||||||
}
|
}
|
||||||
agent {
|
agent {
|
||||||
docker { image 'fsfw-ci:d1'}
|
docker { image 'fsfw-ci:d3'}
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Clean') {
|
stage('Clean') {
|
||||||
@ -14,21 +14,21 @@ pipeline {
|
|||||||
stage('Configure') {
|
stage('Configure') {
|
||||||
steps {
|
steps {
|
||||||
dir(BUILDDIR) {
|
dir(BUILDDIR) {
|
||||||
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..'
|
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON -DFSFW_CICD_BUILD=ON ..'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
dir(BUILDDIR) {
|
dir(BUILDDIR) {
|
||||||
sh 'cmake --build . -j'
|
sh 'cmake --build . -j4'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Unittests') {
|
stage('Unittests') {
|
||||||
steps {
|
steps {
|
||||||
dir(BUILDDIR) {
|
dir(BUILDDIR) {
|
||||||
sh 'cmake --build . -- fsfw-tests_coverage -j'
|
sh 'cmake --build . -- fsfw-tests_coverage -j4'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
cmake/FsfwHelpers.cmake
Normal file
28
cmake/FsfwHelpers.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Determines the git version with git describe and returns it by setting
|
||||||
|
# the GIT_INFO list in the parent scope. The list has the following entries
|
||||||
|
# 1. Full version string
|
||||||
|
# 2. Major version
|
||||||
|
# 3. Minor version
|
||||||
|
# 4. Revision
|
||||||
|
# 5. git SHA hash and commits since tag
|
||||||
|
function(determine_version_with_git)
|
||||||
|
include(GetGitRevisionDescription)
|
||||||
|
git_describe(VERSION ${ARGN})
|
||||||
|
string(FIND ${VERSION} "." VALID_VERSION)
|
||||||
|
if(VALID_VERSION EQUAL -1)
|
||||||
|
message(WARNING "Version string ${VERSION} retrieved with git describe is invalid")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
# Parse the version information into pieces.
|
||||||
|
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" _VERSION_MAJOR "${VERSION}")
|
||||||
|
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" _VERSION_MINOR "${VERSION}")
|
||||||
|
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _VERSION_PATCH "${VERSION}")
|
||||||
|
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-(.*)" "\\1" VERSION_SHA1 "${VERSION}")
|
||||||
|
set(GIT_INFO ${VERSION})
|
||||||
|
list(APPEND GIT_INFO ${_VERSION_MAJOR})
|
||||||
|
list(APPEND GIT_INFO ${_VERSION_MINOR})
|
||||||
|
list(APPEND GIT_INFO ${_VERSION_PATCH})
|
||||||
|
list(APPEND GIT_INFO ${VERSION_SHA1})
|
||||||
|
set(GIT_INFO ${GIT_INFO} PARENT_SCOPE)
|
||||||
|
message(STATUS "${MSG_PREFIX} Set git version info into GIT_INFO from the git tag ${VERSION}")
|
||||||
|
endfunction()
|
7
cmake/cmake-modules/README.md
Normal file
7
cmake/cmake-modules/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
The files in the `bilke` folder were manually copy and pasted from the
|
||||||
|
[cmake-modules repository](https://github.com/bilke/cmake-modules). It was decided to do
|
||||||
|
this because only a small subset of its provided functions are needed.
|
||||||
|
|
||||||
|
The files in the `rpavlik` folder were manually copy and pasted from the
|
||||||
|
[cmake-modules repository](https://github.com/rpavlik/cmake-modules). It was decided to do
|
||||||
|
this because only a small subset of its provided functions are needed.
|
719
cmake/cmake-modules/bilke/CodeCoverage.cmake
Normal file
719
cmake/cmake-modules/bilke/CodeCoverage.cmake
Normal file
@ -0,0 +1,719 @@
|
|||||||
|
# Copyright (c) 2012 - 2017, Lars Bilke
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
# may be used to endorse or promote products derived from this software without
|
||||||
|
# specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# CHANGES:
|
||||||
|
#
|
||||||
|
# 2012-01-31, Lars Bilke
|
||||||
|
# - Enable Code Coverage
|
||||||
|
#
|
||||||
|
# 2013-09-17, Joakim Söderberg
|
||||||
|
# - Added support for Clang.
|
||||||
|
# - Some additional usage instructions.
|
||||||
|
#
|
||||||
|
# 2016-02-03, Lars Bilke
|
||||||
|
# - Refactored functions to use named parameters
|
||||||
|
#
|
||||||
|
# 2017-06-02, Lars Bilke
|
||||||
|
# - Merged with modified version from github.com/ufz/ogs
|
||||||
|
#
|
||||||
|
# 2019-05-06, Anatolii Kurotych
|
||||||
|
# - Remove unnecessary --coverage flag
|
||||||
|
#
|
||||||
|
# 2019-12-13, FeRD (Frank Dana)
|
||||||
|
# - Deprecate COVERAGE_LCOVR_EXCLUDES and COVERAGE_GCOVR_EXCLUDES lists in favor
|
||||||
|
# of tool-agnostic COVERAGE_EXCLUDES variable, or EXCLUDE setup arguments.
|
||||||
|
# - CMake 3.4+: All excludes can be specified relative to BASE_DIRECTORY
|
||||||
|
# - All setup functions: accept BASE_DIRECTORY, EXCLUDE list
|
||||||
|
# - Set lcov basedir with -b argument
|
||||||
|
# - Add automatic --demangle-cpp in lcovr, if 'c++filt' is available (can be
|
||||||
|
# overridden with NO_DEMANGLE option in setup_target_for_coverage_lcovr().)
|
||||||
|
# - Delete output dir, .info file on 'make clean'
|
||||||
|
# - Remove Python detection, since version mismatches will break gcovr
|
||||||
|
# - Minor cleanup (lowercase function names, update examples...)
|
||||||
|
#
|
||||||
|
# 2019-12-19, FeRD (Frank Dana)
|
||||||
|
# - Rename Lcov outputs, make filtered file canonical, fix cleanup for targets
|
||||||
|
#
|
||||||
|
# 2020-01-19, Bob Apthorpe
|
||||||
|
# - Added gfortran support
|
||||||
|
#
|
||||||
|
# 2020-02-17, FeRD (Frank Dana)
|
||||||
|
# - Make all add_custom_target()s VERBATIM to auto-escape wildcard characters
|
||||||
|
# in EXCLUDEs, and remove manual escaping from gcovr targets
|
||||||
|
#
|
||||||
|
# 2021-01-19, Robin Mueller
|
||||||
|
# - Add CODE_COVERAGE_VERBOSE option which will allow to print out commands which are run
|
||||||
|
# - Added the option for users to set the GCOVR_ADDITIONAL_ARGS variable to supply additional
|
||||||
|
# flags to the gcovr command
|
||||||
|
#
|
||||||
|
# 2020-05-04, Mihchael Davis
|
||||||
|
# - Add -fprofile-abs-path to make gcno files contain absolute paths
|
||||||
|
# - Fix BASE_DIRECTORY not working when defined
|
||||||
|
# - Change BYPRODUCT from folder to index.html to stop ninja from complaining about double defines
|
||||||
|
#
|
||||||
|
# 2021-05-10, Martin Stump
|
||||||
|
# - Check if the generator is multi-config before warning about non-Debug builds
|
||||||
|
#
|
||||||
|
# 2022-02-22, Marko Wehle
|
||||||
|
# - Change gcovr output from -o <filename> for --xml <filename> and --html <filename> output respectively.
|
||||||
|
# This will allow for Multiple Output Formats at the same time by making use of GCOVR_ADDITIONAL_ARGS, e.g. GCOVR_ADDITIONAL_ARGS "--txt".
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
#
|
||||||
|
# 1. Copy this file into your cmake modules path.
|
||||||
|
#
|
||||||
|
# 2. Add the following line to your CMakeLists.txt (best inside an if-condition
|
||||||
|
# using a CMake option() to enable it just optionally):
|
||||||
|
# include(CodeCoverage)
|
||||||
|
#
|
||||||
|
# 3. Append necessary compiler flags for all supported source files:
|
||||||
|
# append_coverage_compiler_flags()
|
||||||
|
# Or for specific target:
|
||||||
|
# append_coverage_compiler_flags_to_target(YOUR_TARGET_NAME)
|
||||||
|
#
|
||||||
|
# 3.a (OPTIONAL) Set appropriate optimization flags, e.g. -O0, -O1 or -Og
|
||||||
|
#
|
||||||
|
# 4. If you need to exclude additional directories from the report, specify them
|
||||||
|
# using full paths in the COVERAGE_EXCLUDES variable before calling
|
||||||
|
# setup_target_for_coverage_*().
|
||||||
|
# Example:
|
||||||
|
# set(COVERAGE_EXCLUDES
|
||||||
|
# '${PROJECT_SOURCE_DIR}/src/dir1/*'
|
||||||
|
# '/path/to/my/src/dir2/*')
|
||||||
|
# Or, use the EXCLUDE argument to setup_target_for_coverage_*().
|
||||||
|
# Example:
|
||||||
|
# setup_target_for_coverage_lcov(
|
||||||
|
# NAME coverage
|
||||||
|
# EXECUTABLE testrunner
|
||||||
|
# EXCLUDE "${PROJECT_SOURCE_DIR}/src/dir1/*" "/path/to/my/src/dir2/*")
|
||||||
|
#
|
||||||
|
# 4.a NOTE: With CMake 3.4+, COVERAGE_EXCLUDES or EXCLUDE can also be set
|
||||||
|
# relative to the BASE_DIRECTORY (default: PROJECT_SOURCE_DIR)
|
||||||
|
# Example:
|
||||||
|
# set(COVERAGE_EXCLUDES "dir1/*")
|
||||||
|
# setup_target_for_coverage_gcovr_html(
|
||||||
|
# NAME coverage
|
||||||
|
# EXECUTABLE testrunner
|
||||||
|
# BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
|
||||||
|
# EXCLUDE "dir2/*")
|
||||||
|
#
|
||||||
|
# 5. Use the functions described below to create a custom make target which
|
||||||
|
# runs your test executable and produces a code coverage report.
|
||||||
|
#
|
||||||
|
# 6. Build a Debug build:
|
||||||
|
# cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
|
# make
|
||||||
|
# make my_coverage_target
|
||||||
|
#
|
||||||
|
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
option(CODE_COVERAGE_VERBOSE "Verbose information" FALSE)
|
||||||
|
|
||||||
|
# Check prereqs
|
||||||
|
find_program( GCOV_PATH gcov )
|
||||||
|
find_program( LCOV_PATH NAMES lcov lcov.bat lcov.exe lcov.perl)
|
||||||
|
find_program( FASTCOV_PATH NAMES fastcov fastcov.py )
|
||||||
|
find_program( GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat )
|
||||||
|
find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)
|
||||||
|
find_program( CPPFILT_PATH NAMES c++filt )
|
||||||
|
|
||||||
|
if(NOT GCOV_PATH)
|
||||||
|
message(FATAL_ERROR "gcov not found! Aborting...")
|
||||||
|
endif() # NOT GCOV_PATH
|
||||||
|
|
||||||
|
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||||
|
list(GET LANGUAGES 0 LANG)
|
||||||
|
|
||||||
|
if("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
||||||
|
if("${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS 3)
|
||||||
|
message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...")
|
||||||
|
endif()
|
||||||
|
elseif(NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "[Ff]lang")
|
||||||
|
# Do nothing; exit conditional without error if true
|
||||||
|
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
|
||||||
|
# Do nothing; exit conditional without error if true
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(COVERAGE_COMPILER_FLAGS "-g -fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE INTERNAL "")
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
check_cxx_compiler_flag(-fprofile-abs-path HAVE_fprofile_abs_path)
|
||||||
|
if(HAVE_fprofile_abs_path)
|
||||||
|
set(COVERAGE_COMPILER_FLAGS "${COVERAGE_COMPILER_FLAGS} -fprofile-abs-path")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_Fortran_FLAGS_COVERAGE
|
||||||
|
${COVERAGE_COMPILER_FLAGS}
|
||||||
|
CACHE STRING "Flags used by the Fortran compiler during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_CXX_FLAGS_COVERAGE
|
||||||
|
${COVERAGE_COMPILER_FLAGS}
|
||||||
|
CACHE STRING "Flags used by the C++ compiler during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_C_FLAGS_COVERAGE
|
||||||
|
${COVERAGE_COMPILER_FLAGS}
|
||||||
|
CACHE STRING "Flags used by the C compiler during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
|
""
|
||||||
|
CACHE STRING "Flags used for linking binaries during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||||
|
""
|
||||||
|
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
|
||||||
|
FORCE )
|
||||||
|
mark_as_advanced(
|
||||||
|
CMAKE_Fortran_FLAGS_COVERAGE
|
||||||
|
CMAKE_CXX_FLAGS_COVERAGE
|
||||||
|
CMAKE_C_FLAGS_COVERAGE
|
||||||
|
CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||||
|
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
|
||||||
|
|
||||||
|
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
if(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG))
|
||||||
|
message(WARNING "Code coverage results with an optimised (non-Debug) build may be misleading")
|
||||||
|
endif() # NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
|
||||||
|
link_libraries(gcov)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Defines a target for running and collection code coverage information
|
||||||
|
# Builds dependencies, runs the given executable and outputs reports.
|
||||||
|
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||||
|
# the coverage generation will not complete.
|
||||||
|
#
|
||||||
|
# setup_target_for_coverage_lcov(
|
||||||
|
# NAME testrunner_coverage # New target name
|
||||||
|
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||||
|
# DEPENDENCIES testrunner # Dependencies to build first
|
||||||
|
# BASE_DIRECTORY "../" # Base directory for report
|
||||||
|
# # (defaults to PROJECT_SOURCE_DIR)
|
||||||
|
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||||
|
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||||
|
# NO_DEMANGLE # Don't demangle C++ symbols
|
||||||
|
# # even if c++filt is found
|
||||||
|
# )
|
||||||
|
function(setup_target_for_coverage_lcov)
|
||||||
|
|
||||||
|
set(options NO_DEMANGLE)
|
||||||
|
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||||
|
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
|
||||||
|
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT LCOV_PATH)
|
||||||
|
message(FATAL_ERROR "lcov not found! Aborting...")
|
||||||
|
endif() # NOT LCOV_PATH
|
||||||
|
|
||||||
|
if(NOT GENHTML_PATH)
|
||||||
|
message(FATAL_ERROR "genhtml not found! Aborting...")
|
||||||
|
endif() # NOT GENHTML_PATH
|
||||||
|
|
||||||
|
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||||
|
if(DEFINED Coverage_BASE_DIRECTORY)
|
||||||
|
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||||
|
else()
|
||||||
|
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||||
|
set(LCOV_EXCLUDES "")
|
||||||
|
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_LCOV_EXCLUDES})
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||||
|
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||||
|
endif()
|
||||||
|
list(APPEND LCOV_EXCLUDES "${EXCLUDE}")
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES LCOV_EXCLUDES)
|
||||||
|
|
||||||
|
# Conditional arguments
|
||||||
|
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
|
||||||
|
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Setting up commands which will be run to generate coverage data.
|
||||||
|
# Cleanup lcov
|
||||||
|
set(LCOV_CLEAN_CMD
|
||||||
|
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -directory .
|
||||||
|
-b ${BASEDIR} --zerocounters
|
||||||
|
)
|
||||||
|
# Create baseline to make sure untouched files show up in the report
|
||||||
|
set(LCOV_BASELINE_CMD
|
||||||
|
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -c -i -d . -b
|
||||||
|
${BASEDIR} -o ${Coverage_NAME}.base
|
||||||
|
)
|
||||||
|
# Run tests
|
||||||
|
set(LCOV_EXEC_TESTS_CMD
|
||||||
|
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
||||||
|
)
|
||||||
|
# Capturing lcov counters and generating report
|
||||||
|
set(LCOV_CAPTURE_CMD
|
||||||
|
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory . -b
|
||||||
|
${BASEDIR} --capture --output-file ${Coverage_NAME}.capture
|
||||||
|
)
|
||||||
|
# add baseline counters
|
||||||
|
set(LCOV_BASELINE_COUNT_CMD
|
||||||
|
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base
|
||||||
|
-a ${Coverage_NAME}.capture --output-file ${Coverage_NAME}.total
|
||||||
|
)
|
||||||
|
# filter collected data to final coverage report
|
||||||
|
set(LCOV_FILTER_CMD
|
||||||
|
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --remove
|
||||||
|
${Coverage_NAME}.total ${LCOV_EXCLUDES} --output-file ${Coverage_NAME}.info
|
||||||
|
)
|
||||||
|
# Generate HTML output
|
||||||
|
set(LCOV_GEN_HTML_CMD
|
||||||
|
${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o
|
||||||
|
${Coverage_NAME} ${Coverage_NAME}.info
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if(CODE_COVERAGE_VERBOSE)
|
||||||
|
message(STATUS "Executed command report")
|
||||||
|
message(STATUS "Command to clean up lcov: ")
|
||||||
|
string(REPLACE ";" " " LCOV_CLEAN_CMD_SPACED "${LCOV_CLEAN_CMD}")
|
||||||
|
message(STATUS "${LCOV_CLEAN_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to create baseline: ")
|
||||||
|
string(REPLACE ";" " " LCOV_BASELINE_CMD_SPACED "${LCOV_BASELINE_CMD}")
|
||||||
|
message(STATUS "${LCOV_BASELINE_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to run the tests: ")
|
||||||
|
string(REPLACE ";" " " LCOV_EXEC_TESTS_CMD_SPACED "${LCOV_EXEC_TESTS_CMD}")
|
||||||
|
message(STATUS "${LCOV_EXEC_TESTS_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to capture counters and generate report: ")
|
||||||
|
string(REPLACE ";" " " LCOV_CAPTURE_CMD_SPACED "${LCOV_CAPTURE_CMD}")
|
||||||
|
message(STATUS "${LCOV_CAPTURE_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to add baseline counters: ")
|
||||||
|
string(REPLACE ";" " " LCOV_BASELINE_COUNT_CMD_SPACED "${LCOV_BASELINE_COUNT_CMD}")
|
||||||
|
message(STATUS "${LCOV_BASELINE_COUNT_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to filter collected data: ")
|
||||||
|
string(REPLACE ";" " " LCOV_FILTER_CMD_SPACED "${LCOV_FILTER_CMD}")
|
||||||
|
message(STATUS "${LCOV_FILTER_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to generate lcov HTML output: ")
|
||||||
|
string(REPLACE ";" " " LCOV_GEN_HTML_CMD_SPACED "${LCOV_GEN_HTML_CMD}")
|
||||||
|
message(STATUS "${LCOV_GEN_HTML_CMD_SPACED}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Setup target
|
||||||
|
add_custom_target(${Coverage_NAME}
|
||||||
|
COMMAND ${LCOV_CLEAN_CMD}
|
||||||
|
COMMAND ${LCOV_BASELINE_CMD}
|
||||||
|
COMMAND ${LCOV_EXEC_TESTS_CMD}
|
||||||
|
COMMAND ${LCOV_CAPTURE_CMD}
|
||||||
|
COMMAND ${LCOV_BASELINE_COUNT_CMD}
|
||||||
|
COMMAND ${LCOV_FILTER_CMD}
|
||||||
|
COMMAND ${LCOV_GEN_HTML_CMD}
|
||||||
|
|
||||||
|
# Set output files as GENERATED (will be removed on 'make clean')
|
||||||
|
BYPRODUCTS
|
||||||
|
${Coverage_NAME}.base
|
||||||
|
${Coverage_NAME}.capture
|
||||||
|
${Coverage_NAME}.total
|
||||||
|
${Coverage_NAME}.info
|
||||||
|
${Coverage_NAME}/index.html
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
DEPENDS ${Coverage_DEPENDENCIES}
|
||||||
|
VERBATIM # Protect arguments to commands
|
||||||
|
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
|
||||||
|
)
|
||||||
|
|
||||||
|
# Show where to find the lcov info report
|
||||||
|
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||||
|
COMMAND ;
|
||||||
|
COMMENT "Lcov code coverage info report saved in ${Coverage_NAME}.info."
|
||||||
|
)
|
||||||
|
|
||||||
|
# Show info where to find the report
|
||||||
|
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||||
|
COMMAND ;
|
||||||
|
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction() # setup_target_for_coverage_lcov
|
||||||
|
|
||||||
|
# Defines a target for running and collection code coverage information
|
||||||
|
# Builds dependencies, runs the given executable and outputs reports.
|
||||||
|
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||||
|
# the coverage generation will not complete.
|
||||||
|
#
|
||||||
|
# setup_target_for_coverage_gcovr_xml(
|
||||||
|
# NAME ctest_coverage # New target name
|
||||||
|
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||||
|
# DEPENDENCIES executable_target # Dependencies to build first
|
||||||
|
# BASE_DIRECTORY "../" # Base directory for report
|
||||||
|
# # (defaults to PROJECT_SOURCE_DIR)
|
||||||
|
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||||
|
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||||
|
# )
|
||||||
|
# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the
|
||||||
|
# GCVOR command.
|
||||||
|
function(setup_target_for_coverage_gcovr_xml)
|
||||||
|
|
||||||
|
set(options NONE)
|
||||||
|
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||||
|
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
|
||||||
|
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT GCOVR_PATH)
|
||||||
|
message(FATAL_ERROR "gcovr not found! Aborting...")
|
||||||
|
endif() # NOT GCOVR_PATH
|
||||||
|
|
||||||
|
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||||
|
if(DEFINED Coverage_BASE_DIRECTORY)
|
||||||
|
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||||
|
else()
|
||||||
|
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||||
|
set(GCOVR_EXCLUDES "")
|
||||||
|
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||||
|
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||||
|
endif()
|
||||||
|
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
|
||||||
|
|
||||||
|
# Combine excludes to several -e arguments
|
||||||
|
set(GCOVR_EXCLUDE_ARGS "")
|
||||||
|
foreach(EXCLUDE ${GCOVR_EXCLUDES})
|
||||||
|
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
|
||||||
|
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Set up commands which will be run to generate coverage data
|
||||||
|
# Run tests
|
||||||
|
set(GCOVR_XML_EXEC_TESTS_CMD
|
||||||
|
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
||||||
|
)
|
||||||
|
# Running gcovr
|
||||||
|
set(GCOVR_XML_CMD
|
||||||
|
${GCOVR_PATH} --xml ${Coverage_NAME}.xml -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS}
|
||||||
|
${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CODE_COVERAGE_VERBOSE)
|
||||||
|
message(STATUS "Executed command report")
|
||||||
|
|
||||||
|
message(STATUS "Command to run tests: ")
|
||||||
|
string(REPLACE ";" " " GCOVR_XML_EXEC_TESTS_CMD_SPACED "${GCOVR_XML_EXEC_TESTS_CMD}")
|
||||||
|
message(STATUS "${GCOVR_XML_EXEC_TESTS_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to generate gcovr XML coverage data: ")
|
||||||
|
string(REPLACE ";" " " GCOVR_XML_CMD_SPACED "${GCOVR_XML_CMD}")
|
||||||
|
message(STATUS "${GCOVR_XML_CMD_SPACED}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(${Coverage_NAME}
|
||||||
|
COMMAND ${GCOVR_XML_EXEC_TESTS_CMD}
|
||||||
|
COMMAND ${GCOVR_XML_CMD}
|
||||||
|
|
||||||
|
BYPRODUCTS ${Coverage_NAME}.xml
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
DEPENDS ${Coverage_DEPENDENCIES}
|
||||||
|
VERBATIM # Protect arguments to commands
|
||||||
|
COMMENT "Running gcovr to produce Cobertura code coverage report."
|
||||||
|
)
|
||||||
|
|
||||||
|
# Show info where to find the report
|
||||||
|
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||||
|
COMMAND ;
|
||||||
|
COMMENT "Cobertura code coverage report saved in ${Coverage_NAME}.xml."
|
||||||
|
)
|
||||||
|
endfunction() # setup_target_for_coverage_gcovr_xml
|
||||||
|
|
||||||
|
# Defines a target for running and collection code coverage information
|
||||||
|
# Builds dependencies, runs the given executable and outputs reports.
|
||||||
|
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||||
|
# the coverage generation will not complete.
|
||||||
|
#
|
||||||
|
# setup_target_for_coverage_gcovr_html(
|
||||||
|
# NAME ctest_coverage # New target name
|
||||||
|
# EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||||
|
# DEPENDENCIES executable_target # Dependencies to build first
|
||||||
|
# BASE_DIRECTORY "../" # Base directory for report
|
||||||
|
# # (defaults to PROJECT_SOURCE_DIR)
|
||||||
|
# EXCLUDE "src/dir1/*" "src/dir2/*" # Patterns to exclude (can be relative
|
||||||
|
# # to BASE_DIRECTORY, with CMake 3.4+)
|
||||||
|
# )
|
||||||
|
# The user can set the variable GCOVR_ADDITIONAL_ARGS to supply additional flags to the
|
||||||
|
# GCVOR command.
|
||||||
|
function(setup_target_for_coverage_gcovr_html)
|
||||||
|
|
||||||
|
set(options NONE)
|
||||||
|
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||||
|
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)
|
||||||
|
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT GCOVR_PATH)
|
||||||
|
message(FATAL_ERROR "gcovr not found! Aborting...")
|
||||||
|
endif() # NOT GCOVR_PATH
|
||||||
|
|
||||||
|
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||||
|
if(DEFINED Coverage_BASE_DIRECTORY)
|
||||||
|
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||||
|
else()
|
||||||
|
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Collect excludes (CMake 3.4+: Also compute absolute paths)
|
||||||
|
set(GCOVR_EXCLUDES "")
|
||||||
|
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_GCOVR_EXCLUDES})
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3.4)
|
||||||
|
get_filename_component(EXCLUDE ${EXCLUDE} ABSOLUTE BASE_DIR ${BASEDIR})
|
||||||
|
endif()
|
||||||
|
list(APPEND GCOVR_EXCLUDES "${EXCLUDE}")
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES GCOVR_EXCLUDES)
|
||||||
|
|
||||||
|
# Combine excludes to several -e arguments
|
||||||
|
set(GCOVR_EXCLUDE_ARGS "")
|
||||||
|
foreach(EXCLUDE ${GCOVR_EXCLUDES})
|
||||||
|
list(APPEND GCOVR_EXCLUDE_ARGS "-e")
|
||||||
|
list(APPEND GCOVR_EXCLUDE_ARGS "${EXCLUDE}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Set up commands which will be run to generate coverage data
|
||||||
|
# Run tests
|
||||||
|
set(GCOVR_HTML_EXEC_TESTS_CMD
|
||||||
|
${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}
|
||||||
|
)
|
||||||
|
# Create folder
|
||||||
|
set(GCOVR_HTML_FOLDER_CMD
|
||||||
|
${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${Coverage_NAME}
|
||||||
|
)
|
||||||
|
# Running gcovr
|
||||||
|
set(GCOVR_HTML_CMD
|
||||||
|
${GCOVR_PATH} --html ${Coverage_NAME}/index.html --html-details -r ${BASEDIR} ${GCOVR_ADDITIONAL_ARGS}
|
||||||
|
${GCOVR_EXCLUDE_ARGS} --object-directory=${PROJECT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CODE_COVERAGE_VERBOSE)
|
||||||
|
message(STATUS "Executed command report")
|
||||||
|
|
||||||
|
message(STATUS "Command to run tests: ")
|
||||||
|
string(REPLACE ";" " " GCOVR_HTML_EXEC_TESTS_CMD_SPACED "${GCOVR_HTML_EXEC_TESTS_CMD}")
|
||||||
|
message(STATUS "${GCOVR_HTML_EXEC_TESTS_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to create a folder: ")
|
||||||
|
string(REPLACE ";" " " GCOVR_HTML_FOLDER_CMD_SPACED "${GCOVR_HTML_FOLDER_CMD}")
|
||||||
|
message(STATUS "${GCOVR_HTML_FOLDER_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(STATUS "Command to generate gcovr HTML coverage data: ")
|
||||||
|
string(REPLACE ";" " " GCOVR_HTML_CMD_SPACED "${GCOVR_HTML_CMD}")
|
||||||
|
message(STATUS "${GCOVR_HTML_CMD_SPACED}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(${Coverage_NAME}
|
||||||
|
COMMAND ${GCOVR_HTML_EXEC_TESTS_CMD}
|
||||||
|
COMMAND ${GCOVR_HTML_FOLDER_CMD}
|
||||||
|
COMMAND ${GCOVR_HTML_CMD}
|
||||||
|
|
||||||
|
BYPRODUCTS ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html # report directory
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
DEPENDS ${Coverage_DEPENDENCIES}
|
||||||
|
VERBATIM # Protect arguments to commands
|
||||||
|
COMMENT "Running gcovr to produce HTML code coverage report."
|
||||||
|
)
|
||||||
|
|
||||||
|
# Show info where to find the report
|
||||||
|
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||||
|
COMMAND ;
|
||||||
|
COMMENT "Open ./${Coverage_NAME}/index.html in your browser to view the coverage report."
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction() # setup_target_for_coverage_gcovr_html
|
||||||
|
|
||||||
|
# Defines a target for running and collection code coverage information
|
||||||
|
# Builds dependencies, runs the given executable and outputs reports.
|
||||||
|
# NOTE! The executable should always have a ZERO as exit code otherwise
|
||||||
|
# the coverage generation will not complete.
|
||||||
|
#
|
||||||
|
# setup_target_for_coverage_fastcov(
|
||||||
|
# NAME testrunner_coverage # New target name
|
||||||
|
# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR
|
||||||
|
# DEPENDENCIES testrunner # Dependencies to build first
|
||||||
|
# BASE_DIRECTORY "../" # Base directory for report
|
||||||
|
# # (defaults to PROJECT_SOURCE_DIR)
|
||||||
|
# EXCLUDE "src/dir1/" "src/dir2/" # Patterns to exclude.
|
||||||
|
# NO_DEMANGLE # Don't demangle C++ symbols
|
||||||
|
# # even if c++filt is found
|
||||||
|
# SKIP_HTML # Don't create html report
|
||||||
|
# POST_CMD perl -i -pe s!${PROJECT_SOURCE_DIR}/!!g ctest_coverage.json # E.g. for stripping source dir from file paths
|
||||||
|
# )
|
||||||
|
function(setup_target_for_coverage_fastcov)
|
||||||
|
|
||||||
|
set(options NO_DEMANGLE SKIP_HTML)
|
||||||
|
set(oneValueArgs BASE_DIRECTORY NAME)
|
||||||
|
set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES FASTCOV_ARGS GENHTML_ARGS POST_CMD)
|
||||||
|
cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT FASTCOV_PATH)
|
||||||
|
message(FATAL_ERROR "fastcov not found! Aborting...")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT Coverage_SKIP_HTML AND NOT GENHTML_PATH)
|
||||||
|
message(FATAL_ERROR "genhtml not found! Aborting...")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set base directory (as absolute path), or default to PROJECT_SOURCE_DIR
|
||||||
|
if(Coverage_BASE_DIRECTORY)
|
||||||
|
get_filename_component(BASEDIR ${Coverage_BASE_DIRECTORY} ABSOLUTE)
|
||||||
|
else()
|
||||||
|
set(BASEDIR ${PROJECT_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Collect excludes (Patterns, not paths, for fastcov)
|
||||||
|
set(FASTCOV_EXCLUDES "")
|
||||||
|
foreach(EXCLUDE ${Coverage_EXCLUDE} ${COVERAGE_EXCLUDES} ${COVERAGE_FASTCOV_EXCLUDES})
|
||||||
|
list(APPEND FASTCOV_EXCLUDES "${EXCLUDE}")
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES FASTCOV_EXCLUDES)
|
||||||
|
|
||||||
|
# Conditional arguments
|
||||||
|
if(CPPFILT_PATH AND NOT ${Coverage_NO_DEMANGLE})
|
||||||
|
set(GENHTML_EXTRA_ARGS "--demangle-cpp")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set up commands which will be run to generate coverage data
|
||||||
|
set(FASTCOV_EXEC_TESTS_CMD ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS})
|
||||||
|
|
||||||
|
set(FASTCOV_CAPTURE_CMD ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH}
|
||||||
|
--search-directory ${BASEDIR}
|
||||||
|
--process-gcno
|
||||||
|
--output ${Coverage_NAME}.json
|
||||||
|
--exclude ${FASTCOV_EXCLUDES}
|
||||||
|
--exclude ${FASTCOV_EXCLUDES}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(FASTCOV_CONVERT_CMD ${FASTCOV_PATH}
|
||||||
|
-C ${Coverage_NAME}.json --lcov --output ${Coverage_NAME}.info
|
||||||
|
)
|
||||||
|
|
||||||
|
if(Coverage_SKIP_HTML)
|
||||||
|
set(FASTCOV_HTML_CMD ";")
|
||||||
|
else()
|
||||||
|
set(FASTCOV_HTML_CMD ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS}
|
||||||
|
-o ${Coverage_NAME} ${Coverage_NAME}.info
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(FASTCOV_POST_CMD ";")
|
||||||
|
if(Coverage_POST_CMD)
|
||||||
|
set(FASTCOV_POST_CMD ${Coverage_POST_CMD})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CODE_COVERAGE_VERBOSE)
|
||||||
|
message(STATUS "Code coverage commands for target ${Coverage_NAME} (fastcov):")
|
||||||
|
|
||||||
|
message(" Running tests:")
|
||||||
|
string(REPLACE ";" " " FASTCOV_EXEC_TESTS_CMD_SPACED "${FASTCOV_EXEC_TESTS_CMD}")
|
||||||
|
message(" ${FASTCOV_EXEC_TESTS_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(" Capturing fastcov counters and generating report:")
|
||||||
|
string(REPLACE ";" " " FASTCOV_CAPTURE_CMD_SPACED "${FASTCOV_CAPTURE_CMD}")
|
||||||
|
message(" ${FASTCOV_CAPTURE_CMD_SPACED}")
|
||||||
|
|
||||||
|
message(" Converting fastcov .json to lcov .info:")
|
||||||
|
string(REPLACE ";" " " FASTCOV_CONVERT_CMD_SPACED "${FASTCOV_CONVERT_CMD}")
|
||||||
|
message(" ${FASTCOV_CONVERT_CMD_SPACED}")
|
||||||
|
|
||||||
|
if(NOT Coverage_SKIP_HTML)
|
||||||
|
message(" Generating HTML report: ")
|
||||||
|
string(REPLACE ";" " " FASTCOV_HTML_CMD_SPACED "${FASTCOV_HTML_CMD}")
|
||||||
|
message(" ${FASTCOV_HTML_CMD_SPACED}")
|
||||||
|
endif()
|
||||||
|
if(Coverage_POST_CMD)
|
||||||
|
message(" Running post command: ")
|
||||||
|
string(REPLACE ";" " " FASTCOV_POST_CMD_SPACED "${FASTCOV_POST_CMD}")
|
||||||
|
message(" ${FASTCOV_POST_CMD_SPACED}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Setup target
|
||||||
|
add_custom_target(${Coverage_NAME}
|
||||||
|
|
||||||
|
# Cleanup fastcov
|
||||||
|
COMMAND ${FASTCOV_PATH} ${Coverage_FASTCOV_ARGS} --gcov ${GCOV_PATH}
|
||||||
|
--search-directory ${BASEDIR}
|
||||||
|
--zerocounters
|
||||||
|
|
||||||
|
COMMAND ${FASTCOV_EXEC_TESTS_CMD}
|
||||||
|
COMMAND ${FASTCOV_CAPTURE_CMD}
|
||||||
|
COMMAND ${FASTCOV_CONVERT_CMD}
|
||||||
|
COMMAND ${FASTCOV_HTML_CMD}
|
||||||
|
COMMAND ${FASTCOV_POST_CMD}
|
||||||
|
|
||||||
|
# Set output files as GENERATED (will be removed on 'make clean')
|
||||||
|
BYPRODUCTS
|
||||||
|
${Coverage_NAME}.info
|
||||||
|
${Coverage_NAME}.json
|
||||||
|
${Coverage_NAME}/index.html # report directory
|
||||||
|
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
DEPENDS ${Coverage_DEPENDENCIES}
|
||||||
|
VERBATIM # Protect arguments to commands
|
||||||
|
COMMENT "Resetting code coverage counters to zero. Processing code coverage counters and generating report."
|
||||||
|
)
|
||||||
|
|
||||||
|
set(INFO_MSG "fastcov code coverage info report saved in ${Coverage_NAME}.info and ${Coverage_NAME}.json.")
|
||||||
|
if(NOT Coverage_SKIP_HTML)
|
||||||
|
string(APPEND INFO_MSG " Open ${PROJECT_BINARY_DIR}/${Coverage_NAME}/index.html in your browser to view the coverage report.")
|
||||||
|
endif()
|
||||||
|
# Show where to find the fastcov info report
|
||||||
|
add_custom_command(TARGET ${Coverage_NAME} POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo ${INFO_MSG}
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction() # setup_target_for_coverage_fastcov
|
||||||
|
|
||||||
|
function(append_coverage_compiler_flags)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
|
||||||
|
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${COVERAGE_COMPILER_FLAGS}" PARENT_SCOPE)
|
||||||
|
message(STATUS "Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}")
|
||||||
|
endfunction() # append_coverage_compiler_flags
|
||||||
|
|
||||||
|
# Setup coverage for specific library
|
||||||
|
function(append_coverage_compiler_flags_to_target name)
|
||||||
|
target_compile_options(${name}
|
||||||
|
PRIVATE ${COVERAGE_COMPILER_FLAGS})
|
||||||
|
endfunction()
|
23
cmake/cmake-modules/bilke/LICENSE_1_0.txt
Normal file
23
cmake/cmake-modules/bilke/LICENSE_1_0.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
do so, all subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer,
|
||||||
|
must be included in all copies of the Software, in whole or in part, and
|
||||||
|
all derivative works of the Software, unless such copies or derivative
|
||||||
|
works are solely in the form of machine-executable object code generated by
|
||||||
|
a source language processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
284
cmake/cmake-modules/rpavlik/GetGitRevisionDescription.cmake
Normal file
284
cmake/cmake-modules/rpavlik/GetGitRevisionDescription.cmake
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
# - Returns a version string from Git
|
||||||
|
#
|
||||||
|
# These functions force a re-configure on each git commit so that you can
|
||||||
|
# trust the values of the variables in your build system.
|
||||||
|
#
|
||||||
|
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
|
||||||
|
#
|
||||||
|
# Returns the refspec and sha hash of the current head revision
|
||||||
|
#
|
||||||
|
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe on the source tree, and adjusting
|
||||||
|
# the output so that it tests false if an error occurs.
|
||||||
|
#
|
||||||
|
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe on the working tree (--dirty option),
|
||||||
|
# and adjusting the output so that it tests false if an error occurs.
|
||||||
|
#
|
||||||
|
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe --exact-match on the source tree,
|
||||||
|
# and adjusting the output so that it tests false if there was no exact
|
||||||
|
# matching tag.
|
||||||
|
#
|
||||||
|
# git_local_changes(<var>)
|
||||||
|
#
|
||||||
|
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||||
|
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||||
|
# Does not regard untracked files.
|
||||||
|
#
|
||||||
|
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
#
|
||||||
|
# Copyright 2009-2013, Iowa State University.
|
||||||
|
# Copyright 2013-2020, Ryan Pavlik
|
||||||
|
# Copyright 2013-2020, Contributors
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
if(__get_git_revision_description)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(__get_git_revision_description YES)
|
||||||
|
|
||||||
|
# We must run the following at "include" time, not at function call time,
|
||||||
|
# to find the path to this module rather than the path to a calling list file
|
||||||
|
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||||
|
|
||||||
|
# Function _git_find_closest_git_dir finds the next closest .git directory
|
||||||
|
# that is part of any directory in the path defined by _start_dir.
|
||||||
|
# The result is returned in the parent scope variable whose name is passed
|
||||||
|
# as variable _git_dir_var. If no .git directory can be found, the
|
||||||
|
# function returns an empty string via _git_dir_var.
|
||||||
|
#
|
||||||
|
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
|
||||||
|
# neither foo nor bar contain a file/directory .git. This wil return
|
||||||
|
# C:/bla/.git
|
||||||
|
#
|
||||||
|
function(_git_find_closest_git_dir _start_dir _git_dir_var)
|
||||||
|
set(cur_dir "${_start_dir}")
|
||||||
|
set(git_dir "${_start_dir}/.git")
|
||||||
|
while(NOT EXISTS "${git_dir}")
|
||||||
|
# .git dir not found, search parent directories
|
||||||
|
set(git_previous_parent "${cur_dir}")
|
||||||
|
get_filename_component(cur_dir "${cur_dir}" DIRECTORY)
|
||||||
|
if(cur_dir STREQUAL git_previous_parent)
|
||||||
|
# We have reached the root directory, we are not in git
|
||||||
|
set(${_git_dir_var}
|
||||||
|
""
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(git_dir "${cur_dir}/.git")
|
||||||
|
endwhile()
|
||||||
|
set(${_git_dir_var}
|
||||||
|
"${git_dir}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(get_git_head_revision _refspecvar _hashvar)
|
||||||
|
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
||||||
|
|
||||||
|
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
|
||||||
|
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
|
||||||
|
else()
|
||||||
|
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
|
||||||
|
endif()
|
||||||
|
if(NOT "${GIT_DIR}" STREQUAL "")
|
||||||
|
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
|
||||||
|
"${GIT_DIR}")
|
||||||
|
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
|
||||||
|
# We've gone above the CMake root dir.
|
||||||
|
set(GIT_DIR "")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if("${GIT_DIR}" STREQUAL "")
|
||||||
|
set(${_refspecvar}
|
||||||
|
"GITDIR-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
set(${_hashvar}
|
||||||
|
"GITDIR-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check if the current source dir is a git submodule or a worktree.
|
||||||
|
# In both cases .git is a file instead of a directory.
|
||||||
|
#
|
||||||
|
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||||
|
# The following git command will return a non empty string that
|
||||||
|
# points to the super project working tree if the current
|
||||||
|
# source dir is inside a git submodule.
|
||||||
|
# Otherwise the command will return an empty string.
|
||||||
|
#
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" rev-parse
|
||||||
|
--show-superproject-working-tree
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT "${out}" STREQUAL "")
|
||||||
|
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
|
||||||
|
file(READ ${GIT_DIR} submodule)
|
||||||
|
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
|
||||||
|
${submodule})
|
||||||
|
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
|
||||||
|
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||||
|
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
|
||||||
|
ABSOLUTE)
|
||||||
|
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||||
|
else()
|
||||||
|
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
|
||||||
|
file(READ ${GIT_DIR} worktree_ref)
|
||||||
|
# The .git directory contains a path to the worktree information directory
|
||||||
|
# inside the parent git repo of the worktree.
|
||||||
|
#
|
||||||
|
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||||
|
${worktree_ref})
|
||||||
|
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||||
|
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||||
|
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||||
|
endif()
|
||||||
|
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||||
|
if(NOT EXISTS "${GIT_DATA}")
|
||||||
|
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||||
|
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
|
||||||
|
|
||||||
|
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||||
|
"${GIT_DATA}/grabRef.cmake" @ONLY)
|
||||||
|
include("${GIT_DATA}/grabRef.cmake")
|
||||||
|
|
||||||
|
set(${_refspecvar}
|
||||||
|
"${HEAD_REF}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
set(${_hashvar}
|
||||||
|
"${HEAD_HASH}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_describe _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
get_git_head_revision(refspec hash)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var}
|
||||||
|
"GIT-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(NOT hash)
|
||||||
|
set(${_var}
|
||||||
|
"HEAD-HASH-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO sanitize
|
||||||
|
#if((${ARGN}" MATCHES "&&") OR
|
||||||
|
# (ARGN MATCHES "||") OR
|
||||||
|
# (ARGN MATCHES "\\;"))
|
||||||
|
# message("Please report the following error to the project!")
|
||||||
|
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT res EQUAL 0)
|
||||||
|
set(out "${out}-${res}-NOTFOUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_var}
|
||||||
|
"${out}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_describe_working_tree _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var}
|
||||||
|
"GIT-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT res EQUAL 0)
|
||||||
|
set(out "${out}-${res}-NOTFOUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_var}
|
||||||
|
"${out}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_get_exact_tag _var)
|
||||||
|
git_describe(out --exact-match ${ARGN})
|
||||||
|
set(${_var}
|
||||||
|
"${out}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_local_changes _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
get_git_head_revision(refspec hash)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var}
|
||||||
|
"GIT-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(NOT hash)
|
||||||
|
set(${_var}
|
||||||
|
"HEAD-HASH-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(res EQUAL 0)
|
||||||
|
set(${_var}
|
||||||
|
"CLEAN"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${_var}
|
||||||
|
"DIRTY"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -0,0 +1,43 @@
|
|||||||
|
#
|
||||||
|
# Internal file for GetGitRevisionDescription.cmake
|
||||||
|
#
|
||||||
|
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
# Iowa State University HCI Graduate Program/VRAC
|
||||||
|
#
|
||||||
|
# Copyright 2009-2012, Iowa State University
|
||||||
|
# Copyright 2011-2015, Contributors
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
|
set(HEAD_HASH)
|
||||||
|
|
||||||
|
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||||
|
|
||||||
|
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||||
|
if(HEAD_CONTENTS MATCHES "ref")
|
||||||
|
# named branch
|
||||||
|
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||||
|
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||||
|
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||||
|
else()
|
||||||
|
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||||
|
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||||
|
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||||
|
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# detached HEAD
|
||||||
|
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT HEAD_HASH)
|
||||||
|
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||||
|
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||||
|
endif()
|
26
cmake/cmake-modules/rpavlik/LICENSES/BSD-3-Clause.txt
Normal file
26
cmake/cmake-modules/rpavlik/LICENSES/BSD-3-Clause.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Copyright (c) <year> <owner>. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||||
|
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23
cmake/cmake-modules/rpavlik/LICENSES/BSL-1.0.txt
Normal file
23
cmake/cmake-modules/rpavlik/LICENSES/BSL-1.0.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute, execute,
|
||||||
|
and transmit the Software, and to prepare derivative works of the Software,
|
||||||
|
and to permit third-parties to whom the Software is furnished to do so, all
|
||||||
|
subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer, must
|
||||||
|
be included in all copies of the Software, in whole or in part, and all derivative
|
||||||
|
works of the Software, unless such copies or derivative works are solely in
|
||||||
|
the form of machine-executable object code generated by a source language
|
||||||
|
processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
|
||||||
|
OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
23
cmake/cmake-modules/rpavlik/LICENSE_1_0.txt
Normal file
23
cmake/cmake-modules/rpavlik/LICENSE_1_0.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
do so, all subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer,
|
||||||
|
must be included in all copies of the Software, in whole or in part, and
|
||||||
|
all derivative works of the Software, unless such copies or derivative
|
||||||
|
works are solely in the form of machine-executable object code generated by
|
||||||
|
a source language processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
@ -14,7 +14,7 @@ FSFW to achieve that. The fsfw uses run-time type information but exceptions are
|
|||||||
# Failure Handling
|
# Failure Handling
|
||||||
|
|
||||||
Functions should return a defined `ReturnValue_t` to signal to the caller that something has
|
Functions should return a defined `ReturnValue_t` to signal to the caller that something has
|
||||||
gone wrong. Returnvalues must be unique. For this the function `HasReturnvaluesIF::makeReturnCode`
|
gone wrong. Returnvalues must be unique. For this the function `returnvalue::makeCode`
|
||||||
or the macro `MAKE_RETURN` can be used. The `CLASS_ID` is a unique id for that type of object.
|
or the macro `MAKE_RETURN` can be used. The `CLASS_ID` is a unique id for that type of object.
|
||||||
See `returnvalues/FwClassIds` folder. The user can add custom `CLASS_ID`s via the
|
See `returnvalues/FwClassIds` folder. The user can add custom `CLASS_ID`s via the
|
||||||
`fsfwconfig` folder.
|
`fsfwconfig` folder.
|
||||||
|
@ -144,7 +144,7 @@ ReturnValue_t GyroHandler::initializeLocalDataPool(localpool::DataPool &localDat
|
|||||||
new PoolEntry<uint8_t>({0}));
|
new PoolEntry<uint8_t>({0}));
|
||||||
|
|
||||||
poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
|
poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ in any case:
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
PoolReadGuard readHelper(&gyroData);
|
PoolReadGuard readHelper(&gyroData);
|
||||||
if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
if(readHelper.getReadResult() == returnvalue::OK) {
|
||||||
if(not gyroData.isValid()) {
|
if(not gyroData.isValid()) {
|
||||||
gyroData.setValidity(true, true);
|
gyroData.setValidity(true, true);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Returnvalue API
|
Returnvalue API
|
||||||
==================
|
==================
|
||||||
|
|
||||||
.. doxygenfile:: HasReturnvaluesIF.h
|
.. doxygenfile:: returnvalue.h
|
||||||
|
|
||||||
.. _fwclassids:
|
.. _fwclassids:
|
||||||
|
|
||||||
|
@ -75,11 +75,11 @@ and the respective source file with sensible default return values:
|
|||||||
void TestDeviceHandler::doShutDown() {}
|
void TestDeviceHandler::doShutDown() {}
|
||||||
|
|
||||||
ReturnValue_t TestDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t TestDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TestDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t TestDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestDeviceHandler::fillCommandAndReplyMap() {}
|
void TestDeviceHandler::fillCommandAndReplyMap() {}
|
||||||
@ -87,17 +87,17 @@ and the respective source file with sensible default return values:
|
|||||||
ReturnValue_t TestDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t TestDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t* commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TestDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t TestDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TestDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t TestDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t* packet) {
|
const uint8_t* packet) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TestDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
uint32_t TestDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||||
@ -106,5 +106,5 @@ and the respective source file with sensible default return values:
|
|||||||
|
|
||||||
ReturnValue_t TestDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t TestDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,29 @@ A template configuration folder was provided and can be copied into the project
|
|||||||
a starting point. The [configuration section](docs/README-config.md#top) provides more specific
|
a starting point. The [configuration section](docs/README-config.md#top) provides more specific
|
||||||
information about the possible options.
|
information about the possible options.
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
The Embedded Template Library (etl) is a dependency of the FSFW which is automatically
|
||||||
|
installed and provided by the build system unless the correction version was installed.
|
||||||
|
The current recommended version can be found inside the fsfw ``CMakeLists.txt`` file or by using
|
||||||
|
``ccmake`` and looking up the ``FSFW_ETL_LIB_MAJOR_VERSION`` variable.
|
||||||
|
|
||||||
|
You can install the ETL library like this. On Linux, it might be necessary to add ``sudo`` before
|
||||||
|
the install call:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
git clone https://github.com/ETLCPP/etl
|
||||||
|
cd etl
|
||||||
|
git checkout <currentRecommendedVersion>
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake ..
|
||||||
|
cmake --install .
|
||||||
|
|
||||||
|
It is recommended to install ``20.27.2`` or newer for the package version handling of
|
||||||
|
ETL to work.
|
||||||
|
|
||||||
Adding the library
|
Adding the library
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
@ -60,6 +83,20 @@ The FSFW also has unittests which use the `Catch2 library`_.
|
|||||||
These are built by setting the CMake option ``FSFW_BUILD_UNITTESTS`` to ``ON`` or `TRUE`
|
These are built by setting the CMake option ``FSFW_BUILD_UNITTESTS`` to ``ON`` or `TRUE`
|
||||||
from your project `CMakeLists.txt` file or from the command line.
|
from your project `CMakeLists.txt` file or from the command line.
|
||||||
|
|
||||||
|
You can install the Catch2 library, which prevents the build system to avoid re-downloading
|
||||||
|
the dependency if the unit tests are completely rebuilt. The current recommended version
|
||||||
|
can be found inside the fsfw ``CMakeLists.txt`` file or by using ``ccmake`` and looking up
|
||||||
|
the ``FSFW_CATCH2_LIB_VERSION`` variable.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
git clone https://github.com/catchorg/Catch2.git
|
||||||
|
cd Catch2
|
||||||
|
git checkout <currentRecommendedVersion>
|
||||||
|
cmake -Bbuild -H. -DBUILD_TESTING=OFF
|
||||||
|
sudo cmake --build build/ --target install
|
||||||
|
|
||||||
|
|
||||||
The fsfw-tests binary will be built as part of the static library and dropped alongside it.
|
The fsfw-tests binary will be built as part of the static library and dropped alongside it.
|
||||||
If the unittests are built, the library and the tests will be built with coverage information by
|
If the unittests are built, the library and the tests will be built with coverage information by
|
||||||
default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`.
|
default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`.
|
||||||
@ -69,7 +106,7 @@ You can use the following commands inside the ``fsfw`` folder to set up the buil
|
|||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
mkdir build-tests && cd build-tests
|
mkdir build-tests && cd build-tests
|
||||||
cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host ..
|
cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host ..
|
||||||
|
|
||||||
|
|
||||||
You can also use ``-DFSFW_OSAL=linux`` on Linux systems.
|
You can also use ``-DFSFW_OSAL=linux`` on Linux systems.
|
||||||
|
@ -18,7 +18,7 @@ Failure Handling
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Functions should return a defined :cpp:type:`ReturnValue_t` to signal to the caller that something has
|
Functions should return a defined :cpp:type:`ReturnValue_t` to signal to the caller that something has
|
||||||
gone wrong. Returnvalues must be unique. For this the function :cpp:func:`HasReturnvaluesIF::makeReturnCode`
|
gone wrong. Returnvalues must be unique. For this the function :cpp:func:`returnvalue::makeCode`
|
||||||
or the :ref:`macro MAKE_RETURN_CODE <retvalapi>` can be used. The ``CLASS_ID`` is a unique ID for that type of object.
|
or the :ref:`macro MAKE_RETURN_CODE <retvalapi>` can be used. The ``CLASS_ID`` is a unique ID for that type of object.
|
||||||
See the :ref:`FSFW Class IDs file <fwclassids>`. The user can add custom ``CLASS_ID``\s via the
|
See the :ref:`FSFW Class IDs file <fwclassids>`. The user can add custom ``CLASS_ID``\s via the
|
||||||
``fsfwconfig`` folder.
|
``fsfwconfig`` folder.
|
||||||
|
@ -150,7 +150,7 @@ with a housekeeping service command.
|
|||||||
new PoolEntry<uint8_t>({0}));
|
new PoolEntry<uint8_t>({0}));
|
||||||
|
|
||||||
poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
|
poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Now, if we receive some sensor data and converted them into the right format,
|
Now, if we receive some sensor data and converted them into the right format,
|
||||||
@ -160,7 +160,7 @@ in any case:
|
|||||||
.. code-block:: cpp
|
.. code-block:: cpp
|
||||||
|
|
||||||
PoolReadGuard readHelper(&gyroData);
|
PoolReadGuard readHelper(&gyroData);
|
||||||
if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
|
if(readHelper.getReadResult() == returnvalue::OK) {
|
||||||
if(not gyroData.isValid()) {
|
if(not gyroData.isValid()) {
|
||||||
gyroData.setValidity(true, true);
|
gyroData.setValidity(true, true);
|
||||||
}
|
}
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
|
||||||
|
|
||||||
# Can also be changed by upper CMakeLists.txt file
|
|
||||||
find_library(LIB_FSFW_NAME fsfw REQUIRED)
|
|
||||||
|
|
||||||
option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Requires gpiod library" OFF)
|
|
||||||
# On by default for now because I did not have an issue including and compiling those files
|
|
||||||
# and libraries on a Desktop Linux system and the primary target of the FSFW is still embedded
|
|
||||||
# Linux. The only exception from this is the gpiod library which requires a dedicated installation,
|
|
||||||
# but CMake is able to determine whether this library is installed with find_library.
|
|
||||||
option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add peripheral drivers for embedded Linux" ON)
|
|
||||||
|
|
||||||
option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF)
|
|
||||||
option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF)
|
|
||||||
option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
|
||||||
|
|
||||||
set(LINUX_HAL_PATH_NAME linux)
|
|
||||||
set(STM32H7_PATH_NAME stm32h7)
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
|
||||||
|
|
||||||
foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS})
|
|
||||||
if(IS_ABSOLUTE ${INCLUDE_PATH})
|
|
||||||
set(CURR_ABS_INC_PATH "${INCLUDE_PATH}")
|
|
||||||
else()
|
|
||||||
get_filename_component(CURR_ABS_INC_PATH
|
|
||||||
${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
|
||||||
message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
${FSFW_HAL_ADD_INC_PATHS_ABS}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
${FSFW_HAL_DEFINES}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
${FSFW_HAL_LINK_LIBS}
|
|
||||||
)
|
|
@ -1,9 +0,0 @@
|
|||||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(fsfw_hal)
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
GpioCookie.cpp
|
|
||||||
)
|
|
@ -1,5 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
GyroL3GD20Handler.cpp
|
|
||||||
MgmRM3100Handler.cpp
|
|
||||||
MgmLIS3MDLHandler.cpp
|
|
||||||
)
|
|
@ -1,18 +0,0 @@
|
|||||||
if(FSFW_HAL_ADD_RASPBERRY_PI)
|
|
||||||
add_subdirectory(rpi)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
UnixFileGuard.cpp
|
|
||||||
CommandExecutor.cpp
|
|
||||||
utility.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS)
|
|
||||||
add_subdirectory(gpio)
|
|
||||||
add_subdirectory(spi)
|
|
||||||
add_subdirectory(i2c)
|
|
||||||
add_subdirectory(uart)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(uio)
|
|
@ -1,16 +0,0 @@
|
|||||||
# This abstraction layer requires the gpiod library. You can install this library
|
|
||||||
# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need
|
|
||||||
# to install the package before syncing the sysroot to your host computer.
|
|
||||||
find_library(LIB_GPIO gpiod)
|
|
||||||
|
|
||||||
if(${LIB_GPIO} MATCHES LIB_GPIO-NOTFOUND)
|
|
||||||
message(STATUS "gpiod library not found, not linking against it")
|
|
||||||
else()
|
|
||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
LinuxLibgpioIF.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
${LIB_GPIO}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PUBLIC
|
|
||||||
I2cComIF.cpp
|
|
||||||
I2cCookie.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
GpioRPi.cpp
|
|
||||||
)
|
|
@ -1,8 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PUBLIC
|
|
||||||
SpiComIF.cpp
|
|
||||||
SpiCookie.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PUBLIC
|
|
||||||
UartComIF.cpp
|
|
||||||
UartCookie.cpp
|
|
||||||
)
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PUBLIC
|
|
||||||
UioMapper.cpp
|
|
||||||
)
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
GyroL3GD20H.cpp
|
|
||||||
)
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
gpio.cpp
|
|
||||||
)
|
|
@ -1,2 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
)
|
|
@ -1,9 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
spiCore.cpp
|
|
||||||
spiDefinitions.cpp
|
|
||||||
spiInterrupts.cpp
|
|
||||||
mspInit.cpp
|
|
||||||
SpiCookie.cpp
|
|
||||||
SpiComIF.cpp
|
|
||||||
stm32h743zi.cpp
|
|
||||||
)
|
|
@ -1,2 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
|
||||||
)
|
|
@ -11,15 +11,15 @@ ReturnValue_t pst::pollingSequenceInitDefault(
|
|||||||
|
|
||||||
/* Add polling sequence table here */
|
/* Add polling sequence table here */
|
||||||
|
|
||||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() == returnvalue::OK) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
|
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef POLLINGSEQUENCEFACTORY_H_
|
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||||
#define POLLINGSEQUENCEFACTORY_H_
|
#define POLLINGSEQUENCEFACTORY_H_
|
||||||
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
class FixedTimeslotTaskIF;
|
class FixedTimeslotTaskIF;
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if [[ ! -f README.md ]]; then
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
|
|
||||||
find ./src -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
|
||||||
find ./hal -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
|
||||||
find ./tests -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i
|
|
29
scripts/auto-formatter.sh
Executable file
29
scripts/auto-formatter.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ ! -f README.md ]]; then
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
folder_list=(
|
||||||
|
"./src"
|
||||||
|
"./unittests"
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_fmt="cmake-format"
|
||||||
|
file_selectors="-iname CMakeLists.txt"
|
||||||
|
if command -v ${cmake_fmt} &> /dev/null; then
|
||||||
|
${cmake_fmt} -i CMakeLists.txt
|
||||||
|
find ./src ${file_selectors} | xargs ${cmake_fmt} -i
|
||||||
|
else
|
||||||
|
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cpp_format="clang-format"
|
||||||
|
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
|
||||||
|
if command -v ${cpp_format} &> /dev/null; then
|
||||||
|
for dir in ${folder_list[@]}; do
|
||||||
|
echo "Auto-formatting ${dir} recursively"
|
||||||
|
find ${dir} ${file_selectors} | xargs clang-format --style=file -i
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No ${cpp_format} tool found, not formatting C++/C files"
|
||||||
|
fi
|
@ -48,6 +48,20 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Run valgrind on generated test binary",
|
help="Run valgrind on generated test binary",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-g",
|
||||||
|
"--generators",
|
||||||
|
default = "Ninja",
|
||||||
|
action="store",
|
||||||
|
help="CMake generators",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-w",
|
||||||
|
"--windows",
|
||||||
|
default=False,
|
||||||
|
action="store_true",
|
||||||
|
help="Run on windows",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.all:
|
if args.all:
|
||||||
@ -97,11 +111,11 @@ def handle_docs_type(args, build_dir_list: list):
|
|||||||
build_directory = determine_build_dir(build_dir_list)
|
build_directory = determine_build_dir(build_dir_list)
|
||||||
os.chdir(build_directory)
|
os.chdir(build_directory)
|
||||||
if args.build:
|
if args.build:
|
||||||
os.system("cmake --build . -j")
|
cmd_runner("cmake --build . -j")
|
||||||
if args.open:
|
if args.open:
|
||||||
if not os.path.isfile("docs/sphinx/index.html"):
|
if not os.path.isfile("docs/sphinx/index.html"):
|
||||||
# try again..
|
# try again..
|
||||||
os.system("cmake --build . -j")
|
cmd_runner("cmake --build . -j")
|
||||||
if not os.path.isfile("docs/sphinx/index.html"):
|
if not os.path.isfile("docs/sphinx/index.html"):
|
||||||
print(
|
print(
|
||||||
"No Sphinx documentation file detected. "
|
"No Sphinx documentation file detected. "
|
||||||
@ -115,14 +129,14 @@ def handle_tests_type(args, build_dir_list: list):
|
|||||||
if args.create:
|
if args.create:
|
||||||
if os.path.exists(UNITTEST_FOLDER_NAME):
|
if os.path.exists(UNITTEST_FOLDER_NAME):
|
||||||
shutil.rmtree(UNITTEST_FOLDER_NAME)
|
shutil.rmtree(UNITTEST_FOLDER_NAME)
|
||||||
create_tests_build_cfg()
|
create_tests_build_cfg(args)
|
||||||
build_directory = UNITTEST_FOLDER_NAME
|
build_directory = UNITTEST_FOLDER_NAME
|
||||||
elif len(build_dir_list) == 0:
|
elif len(build_dir_list) == 0:
|
||||||
print(
|
print(
|
||||||
"No valid CMake tests build directory found. "
|
"No valid CMake tests build directory found. "
|
||||||
"Trying to set up test build system"
|
"Trying to set up test build system"
|
||||||
)
|
)
|
||||||
create_tests_build_cfg()
|
create_tests_build_cfg(args)
|
||||||
build_directory = UNITTEST_FOLDER_NAME
|
build_directory = UNITTEST_FOLDER_NAME
|
||||||
elif len(build_dir_list) == 1:
|
elif len(build_dir_list) == 1:
|
||||||
build_directory = build_dir_list[0]
|
build_directory = build_dir_list[0]
|
||||||
@ -143,25 +157,26 @@ def handle_tests_type(args, build_dir_list: list):
|
|||||||
if which("valgrind") is None:
|
if which("valgrind") is None:
|
||||||
print("Please install valgrind first")
|
print("Please install valgrind first")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if os.path.split(os.getcwd())[1] != UNITTEST_FOLDER_NAME:
|
cmd_runner("valgrind --leak-check=full ./fsfw-tests")
|
||||||
# If we are in a different directory we try to switch into it but
|
|
||||||
# this might fail
|
|
||||||
os.chdir(UNITTEST_FOLDER_NAME)
|
|
||||||
os.system("valgrind --leak-check=full ./fsfw-tests")
|
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
def create_tests_build_cfg():
|
def create_tests_build_cfg(args):
|
||||||
os.mkdir(UNITTEST_FOLDER_NAME)
|
os.mkdir(UNITTEST_FOLDER_NAME)
|
||||||
os.chdir(UNITTEST_FOLDER_NAME)
|
os.chdir(UNITTEST_FOLDER_NAME)
|
||||||
os.system("cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..")
|
if args.windows:
|
||||||
|
cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON \
|
||||||
|
-DGCOVR_PATH="py -m gcovr" ..'
|
||||||
|
else:
|
||||||
|
cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON ..'
|
||||||
|
cmd_runner(cmake_cmd)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
def create_docs_build_cfg():
|
def create_docs_build_cfg():
|
||||||
os.mkdir(DOCS_FOLDER_NAME)
|
os.mkdir(DOCS_FOLDER_NAME)
|
||||||
os.chdir(DOCS_FOLDER_NAME)
|
os.chdir(DOCS_FOLDER_NAME)
|
||||||
os.system("cmake -DFSFW_OSAL=host -DFSFW_BUILD_DOCS=ON ..")
|
cmd_runner("cmake -DFSFW_OSAL=host -DFSFW_BUILD_DOCS=ON ..")
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
@ -184,7 +199,7 @@ def check_for_cmake_build_dir(build_dir_list: list) -> list:
|
|||||||
def perform_lcov_operation(directory: str, chdir: bool):
|
def perform_lcov_operation(directory: str, chdir: bool):
|
||||||
if chdir:
|
if chdir:
|
||||||
os.chdir(directory)
|
os.chdir(directory)
|
||||||
os.system("cmake --build . -- fsfw-tests_coverage -j")
|
cmd_runner("cmake --build . -- fsfw-tests_coverage -j")
|
||||||
|
|
||||||
|
|
||||||
def determine_build_dir(build_dir_list: List[str]):
|
def determine_build_dir(build_dir_list: List[str]):
|
||||||
@ -206,5 +221,10 @@ def determine_build_dir(build_dir_list: List[str]):
|
|||||||
return build_directory
|
return build_directory
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_runner(cmd: str):
|
||||||
|
print(f"Executing command: {cmd}")
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
target_include_directories(${LIB_FSFW_NAME}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(fsfw)
|
add_subdirectory(fsfw)
|
||||||
|
if(FSFW_ADD_HAL)
|
||||||
|
add_subdirectory(fsfw_hal)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(fsfw_tests)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME} PRIVATE version.cpp)
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
|
|
||||||
add_subdirectory(action)
|
add_subdirectory(action)
|
||||||
@ -33,22 +35,22 @@ add_subdirectory(tmtcservices)
|
|||||||
# Optional
|
# Optional
|
||||||
|
|
||||||
if(FSFW_ADD_MONITORING)
|
if(FSFW_ADD_MONITORING)
|
||||||
add_subdirectory(monitoring)
|
add_subdirectory(monitoring)
|
||||||
endif()
|
endif()
|
||||||
if(FSFW_ADD_PUS)
|
if(FSFW_ADD_PUS)
|
||||||
add_subdirectory(pus)
|
add_subdirectory(pus)
|
||||||
endif()
|
endif()
|
||||||
if(FSFW_ADD_TMSTORAGE)
|
if(FSFW_ADD_TMSTORAGE)
|
||||||
add_subdirectory(tmstorage)
|
add_subdirectory(tmstorage)
|
||||||
endif()
|
endif()
|
||||||
if(FSFW_ADD_COORDINATES)
|
if(FSFW_ADD_COORDINATES)
|
||||||
add_subdirectory(coordinates)
|
add_subdirectory(coordinates)
|
||||||
endif()
|
endif()
|
||||||
if(FSFW_ADD_RMAP)
|
if(FSFW_ADD_RMAP)
|
||||||
add_subdirectory(rmap)
|
add_subdirectory(rmap)
|
||||||
endif()
|
endif()
|
||||||
if(FSFW_ADD_DATALINKLAYER)
|
if(FSFW_ADD_DATALINKLAYER)
|
||||||
add_subdirectory(datalinklayer)
|
add_subdirectory(datalinklayer)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# OSAL
|
# OSAL
|
||||||
|
@ -30,6 +30,10 @@
|
|||||||
#define FSFW_VERBOSE_LEVEL 1
|
#define FSFW_VERBOSE_LEVEL 1
|
||||||
#endif /* FSFW_VERBOSE_LEVEL */
|
#endif /* FSFW_VERBOSE_LEVEL */
|
||||||
|
|
||||||
|
#ifndef FSFW_DISABLE_PRINTOUT
|
||||||
|
#define FSFW_DISABLE_PRINTOUT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FSFW_USE_REALTIME_FOR_LINUX
|
#ifndef FSFW_USE_REALTIME_FOR_LINUX
|
||||||
#define FSFW_USE_REALTIME_FOR_LINUX 0
|
#define FSFW_USE_REALTIME_FOR_LINUX 0
|
||||||
#endif /* FSFW_USE_REALTIME_FOR_LINUX */
|
#endif /* FSFW_USE_REALTIME_FOR_LINUX */
|
||||||
@ -57,16 +61,9 @@
|
|||||||
#define FSFW_HAL_SPI_WIRETAPPING 0
|
#define FSFW_HAL_SPI_WIRETAPPING 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG
|
// Can be used for low-level debugging of the I2C bus
|
||||||
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
|
#ifndef FSFW_HAL_I2C_WIRETAPPING
|
||||||
#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */
|
#define FSFW_HAL_I2C_WIRETAPPING 0
|
||||||
|
#endif
|
||||||
#ifndef FSFW_HAL_RM3100_MGM_DEBUG
|
|
||||||
#define FSFW_HAL_RM3100_MGM_DEBUG 0
|
|
||||||
#endif /* FSFW_HAL_RM3100_MGM_DEBUG */
|
|
||||||
|
|
||||||
#ifndef FSFW_HAL_LIS3MDL_MGM_DEBUG
|
|
||||||
#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0
|
|
||||||
#endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */
|
|
||||||
|
|
||||||
#endif /* FSFW_FSFW_H_ */
|
#endif /* FSFW_FSFW_H_ */
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#ifndef FSFW_VERSION_H_
|
#ifndef FSFW_VERSION_H_
|
||||||
#define FSFW_VERSION_H_
|
#define FSFW_VERSION_H_
|
||||||
|
|
||||||
// Versioning is kept in project CMakeLists.txt file
|
// Versioning is managed in project CMakeLists.txt file
|
||||||
#define FSFW_VERSION @FSFW_VERSION@
|
static constexpr int FSFW_VERSION_MAJOR = @FSFW_VERSION@;
|
||||||
#define FSFW_SUBVERSION @FSFW_SUBVERSION@
|
static constexpr int FSFW_VERSION_MINOR = @FSFW_SUBVERSION@;
|
||||||
#define FSFW_REVISION @FSFW_REVISION@
|
static constexpr int FSFW_VERSION_REVISION = @FSFW_REVISION@;
|
||||||
|
// Also contains CST (Commits since tag) information
|
||||||
|
static const char FSFW_VCS_INFO[] = "@FSFW_VCS_INFO@";
|
||||||
|
|
||||||
#endif /* FSFW_VERSION_H_ */
|
#endif /* FSFW_VERSION_H_ */
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
||||||
: owner(setOwner), queueToUse(useThisQueue) {}
|
: owner(setOwner), queueToUse(useThisQueue) {}
|
||||||
|
|
||||||
ActionHelper::~ActionHelper() {}
|
ActionHelper::~ActionHelper() = default;
|
||||||
|
|
||||||
ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
|
ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
|
||||||
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
|
if (command->getCommand() == ActionMessage::EXECUTE_ACTION) {
|
||||||
ActionId_t currentAction = ActionMessage::getActionId(command);
|
ActionId_t currentAction = ActionMessage::getActionId(command);
|
||||||
prepareExecution(command->getSender(), currentAction, ActionMessage::getStoreId(command));
|
prepareExecution(command->getSender(), currentAction, ActionMessage::getStoreId(command));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else {
|
} else {
|
||||||
return CommandMessage::UNKNOWN_COMMAND;
|
return CommandMessage::UNKNOWN_COMMAND;
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) {
|
|||||||
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
||||||
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (ipcStore == nullptr) {
|
if (ipcStore == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (queueToUse_ != nullptr) {
|
if (queueToUse_ != nullptr) {
|
||||||
setQueueToUse(queueToUse_);
|
setQueueToUse(queueToUse_);
|
||||||
@ -35,10 +35,10 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
|||||||
sif::printWarning("ActionHelper::initialize: No queue set\n");
|
sif::printWarning("ActionHelper::initialize: No queue set\n");
|
||||||
#endif
|
#endif
|
||||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
|
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
|
||||||
@ -59,10 +59,10 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
|
|||||||
|
|
||||||
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||||
store_address_t dataAddress) {
|
store_address_t dataAddress) {
|
||||||
const uint8_t* dataPtr = NULL;
|
const uint8_t* dataPtr = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
@ -75,7 +75,7 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
|
|||||||
ActionMessage::setCompletionReply(&reply, actionId, true, result);
|
ActionMessage::setCompletionReply(&reply, actionId, true, result);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
}
|
}
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
@ -91,11 +91,11 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
size_t maxSize = data->getSerializedSize();
|
size_t maxSize = data->getSerializedSize();
|
||||||
if (maxSize == 0) {
|
if (maxSize == 0) {
|
||||||
/* No error, there's simply nothing to report. */
|
/* No error, there's simply nothing to report. */
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
|
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize, &dataPtr);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!"
|
sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -107,7 +107,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
|
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
ipcStore->deleteData(storeAddress);
|
ipcStore->deleteData(storeAddress);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
result = queueToUse->sendMessage(reportTo, &reply);
|
result = queueToUse->sendMessage(reportTo, &reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
ipcStore->deleteData(storeAddress);
|
ipcStore->deleteData(storeAddress);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -137,7 +137,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl;
|
sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl;
|
||||||
#else
|
#else
|
||||||
@ -158,7 +158,7 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, ActionId_t rep
|
|||||||
result = queueToUse->sendMessage(reportTo, &reply);
|
result = queueToUse->sendMessage(reportTo, &reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
ipcStore->deleteData(storeAddress);
|
ipcStore->deleteData(storeAddress);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef FSFW_ACTION_ACTIONHELPER_H_
|
#ifndef FSFW_ACTION_ACTIONHELPER_H_
|
||||||
#define FSFW_ACTION_ACTIONHELPER_H_
|
#define FSFW_ACTION_ACTIONHELPER_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
|
||||||
#include "../serialize/SerializeIF.h"
|
|
||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
/**
|
/**
|
||||||
* @brief Action Helper is a helper class which handles action messages
|
* @brief Action Helper is a helper class which handles action messages
|
||||||
*
|
*
|
||||||
@ -36,7 +36,7 @@ class ActionHelper {
|
|||||||
* send to the sender of the message automatically.
|
* send to the sender of the message automatically.
|
||||||
*
|
*
|
||||||
* @param command Pointer to a command message received by the owner
|
* @param command Pointer to a command message received by the owner
|
||||||
* @return HasReturnvaluesIF::RETURN_OK if the message is a action message,
|
* @return returnvalue::OK if the message is a action message,
|
||||||
* CommandMessage::UNKNOW_COMMAND if this message ID is unkown
|
* CommandMessage::UNKNOW_COMMAND if this message ID is unkown
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleActionMessage(CommandMessage* command);
|
ReturnValue_t handleActionMessage(CommandMessage* command);
|
||||||
@ -45,7 +45,7 @@ class ActionHelper {
|
|||||||
* helper function
|
* helper function
|
||||||
* @param queueToUse_ Pointer to the messageQueue to be used, optional
|
* @param queueToUse_ Pointer to the messageQueue to be used, optional
|
||||||
* if queue was set in constructor
|
* if queue was set in constructor
|
||||||
* @return Returns RETURN_OK if successful
|
* @return Returns returnvalue::OK if successful
|
||||||
*/
|
*/
|
||||||
ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr);
|
ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr);
|
||||||
/**
|
/**
|
||||||
@ -58,7 +58,7 @@ class ActionHelper {
|
|||||||
* @param result Result of the execution
|
* @param result Result of the execution
|
||||||
*/
|
*/
|
||||||
void step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
|
void step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId,
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
ReturnValue_t result = returnvalue::OK);
|
||||||
/**
|
/**
|
||||||
* Function to be called by the owner to send a action completion message
|
* Function to be called by the owner to send a action completion message
|
||||||
* @param success Specify whether action was completed successfully or not.
|
* @param success Specify whether action was completed successfully or not.
|
||||||
@ -67,7 +67,7 @@ class ActionHelper {
|
|||||||
* @param result Result of the execution
|
* @param result Result of the execution
|
||||||
*/
|
*/
|
||||||
void finish(bool success, MessageQueueId_t reportTo, ActionId_t commandId,
|
void finish(bool success, MessageQueueId_t reportTo, ActionId_t commandId,
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
ReturnValue_t result = returnvalue::OK);
|
||||||
/**
|
/**
|
||||||
* Function to be called by the owner if an action does report data.
|
* Function to be called by the owner if an action does report data.
|
||||||
* Takes a SerializeIF* pointer and serializes it into the IPC store.
|
* Takes a SerializeIF* pointer and serializes it into the IPC store.
|
||||||
@ -75,7 +75,7 @@ class ActionHelper {
|
|||||||
* message to
|
* message to
|
||||||
* @param replyId ID of the executed command
|
* @param replyId ID of the executed command
|
||||||
* @param data Pointer to the data
|
* @param data Pointer to the data
|
||||||
* @return Returns RETURN_OK if successful, otherwise failure code
|
* @return Returns returnvalue::OK if successful, otherwise failure code
|
||||||
*/
|
*/
|
||||||
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, SerializeIF* data,
|
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, SerializeIF* data,
|
||||||
bool hideSender = false);
|
bool hideSender = false);
|
||||||
@ -86,7 +86,7 @@ class ActionHelper {
|
|||||||
* message to
|
* message to
|
||||||
* @param replyId ID of the executed command
|
* @param replyId ID of the executed command
|
||||||
* @param data Pointer to the data
|
* @param data Pointer to the data
|
||||||
* @return Returns RETURN_OK if successful, otherwise failure code
|
* @return Returns returnvalue::OK if successful, otherwise failure code
|
||||||
*/
|
*/
|
||||||
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, const uint8_t* data,
|
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, const uint8_t* data,
|
||||||
size_t dataSize, bool hideSender = false);
|
size_t dataSize, bool hideSender = false);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
ActionMessage::ActionMessage() {}
|
ActionMessage::ActionMessage() = default;
|
||||||
|
|
||||||
ActionMessage::~ActionMessage() {}
|
ActionMessage::~ActionMessage() = default;
|
||||||
|
|
||||||
void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid,
|
void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid,
|
||||||
store_address_t parameters) {
|
store_address_t parameters) {
|
||||||
@ -25,7 +25,7 @@ store_address_t ActionMessage::getStoreId(const CommandMessage* message) {
|
|||||||
|
|
||||||
void ActionMessage::setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
|
void ActionMessage::setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
|
||||||
ReturnValue_t result) {
|
ReturnValue_t result) {
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
message->setCommand(STEP_SUCCESS);
|
message->setCommand(STEP_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
message->setCommand(STEP_FAILED);
|
message->setCommand(STEP_FAILED);
|
||||||
@ -64,9 +64,8 @@ void ActionMessage::clear(CommandMessage* message) {
|
|||||||
switch (message->getCommand()) {
|
switch (message->getCommand()) {
|
||||||
case EXECUTE_ACTION:
|
case EXECUTE_ACTION:
|
||||||
case DATA_REPLY: {
|
case DATA_REPLY: {
|
||||||
StorageManagerIF* ipcStore =
|
auto* ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
if (ipcStore != nullptr) {
|
||||||
if (ipcStore != NULL) {
|
|
||||||
ipcStore->deleteData(getStoreId(message));
|
ipcStore->deleteData(getStoreId(message));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -33,12 +33,12 @@ class ActionMessage {
|
|||||||
static store_address_t getStoreId(const CommandMessage* message);
|
static store_address_t getStoreId(const CommandMessage* message);
|
||||||
|
|
||||||
static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
|
static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step,
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
ReturnValue_t result = returnvalue::OK);
|
||||||
static uint8_t getStep(const CommandMessage* message);
|
static uint8_t getStep(const CommandMessage* message);
|
||||||
static ReturnValue_t getReturnCode(const CommandMessage* message);
|
static ReturnValue_t getReturnCode(const CommandMessage* message);
|
||||||
static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data);
|
static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data);
|
||||||
static void setCompletionReply(CommandMessage* message, ActionId_t fid, bool success,
|
static void setCompletionReply(CommandMessage* message, ActionId_t fid, bool success,
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
ReturnValue_t result = returnvalue::OK);
|
||||||
|
|
||||||
static void clear(CommandMessage* message);
|
static void clear(CommandMessage* message);
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
target_sources(${LIB_FSFW_NAME}
|
target_sources(
|
||||||
PRIVATE
|
${LIB_FSFW_NAME} PRIVATE ActionHelper.cpp ActionMessage.cpp
|
||||||
ActionHelper.cpp
|
CommandActionHelper.cpp SimpleActionHelper.cpp)
|
||||||
ActionMessage.cpp
|
|
||||||
CommandActionHelper.cpp
|
|
||||||
SimpleActionHelper.cpp
|
|
||||||
)
|
|
||||||
|
@ -2,26 +2,26 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner)
|
CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner)
|
||||||
: owner(setOwner), queueToUse(NULL), ipcStore(NULL), commandCount(0), lastTarget(0) {}
|
: owner(setOwner), queueToUse(nullptr), ipcStore(nullptr), commandCount(0), lastTarget(0) {}
|
||||||
|
|
||||||
CommandActionHelper::~CommandActionHelper() {}
|
CommandActionHelper::~CommandActionHelper() = default;
|
||||||
|
|
||||||
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
||||||
SerializeIF *data) {
|
SerializeIF *data) {
|
||||||
HasActionsIF *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
auto *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
||||||
if (receiver == NULL) {
|
if (receiver == nullptr) {
|
||||||
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
||||||
}
|
}
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
uint8_t *storePointer;
|
uint8_t *storePointer;
|
||||||
size_t maxSize = data->getSerializedSize();
|
size_t maxSize = data->getSerializedSize();
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &storePointer);
|
ReturnValue_t result = ipcStore->getFreeElement(&storeId, maxSize, &storePointer);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
result = data->serialize(&storePointer, &size, maxSize, SerializeIF::Endianness::BIG);
|
result = data->serialize(&storePointer, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return sendCommand(receiver->getCommandQueue(), actionId, storeId);
|
return sendCommand(receiver->getCommandQueue(), actionId, storeId);
|
||||||
@ -29,16 +29,13 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId
|
|||||||
|
|
||||||
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId,
|
||||||
const uint8_t *data, uint32_t size) {
|
const uint8_t *data, uint32_t size) {
|
||||||
// if (commandCount != 0) {
|
auto *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
||||||
// return CommandsFunctionsIF::ALREADY_COMMANDING;
|
if (receiver == nullptr) {
|
||||||
// }
|
|
||||||
HasActionsIF *receiver = ObjectManager::instance()->get<HasActionsIF>(commandTo);
|
|
||||||
if (receiver == NULL) {
|
|
||||||
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS;
|
||||||
}
|
}
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
ReturnValue_t result = ipcStore->addData(&storeId, data, size);
|
ReturnValue_t result = ipcStore->addData(&storeId, data, size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return sendCommand(receiver->getCommandQueue(), actionId, storeId);
|
return sendCommand(receiver->getCommandQueue(), actionId, storeId);
|
||||||
@ -49,7 +46,7 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
|
|||||||
CommandMessage command;
|
CommandMessage command;
|
||||||
ActionMessage::setCommand(&command, actionId, storeId);
|
ActionMessage::setCommand(&command, actionId, storeId);
|
||||||
ReturnValue_t result = queueToUse->sendMessage(queueId, &command);
|
ReturnValue_t result = queueToUse->sendMessage(queueId, &command);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
ipcStore->deleteData(storeId);
|
ipcStore->deleteData(storeId);
|
||||||
}
|
}
|
||||||
lastTarget = queueId;
|
lastTarget = queueId;
|
||||||
@ -59,55 +56,55 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI
|
|||||||
|
|
||||||
ReturnValue_t CommandActionHelper::initialize() {
|
ReturnValue_t CommandActionHelper::initialize() {
|
||||||
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (ipcStore == NULL) {
|
if (ipcStore == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
queueToUse = owner->getCommandQueuePtr();
|
queueToUse = owner->getCommandQueuePtr();
|
||||||
if (queueToUse == NULL) {
|
if (queueToUse == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
|
ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) {
|
||||||
if (reply->getSender() != lastTarget) {
|
if (reply->getSender() != lastTarget) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
switch (reply->getCommand()) {
|
switch (reply->getCommand()) {
|
||||||
case ActionMessage::COMPLETION_SUCCESS:
|
case ActionMessage::COMPLETION_SUCCESS:
|
||||||
commandCount--;
|
commandCount--;
|
||||||
owner->completionSuccessfulReceived(ActionMessage::getActionId(reply));
|
owner->completionSuccessfulReceived(ActionMessage::getActionId(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
case ActionMessage::COMPLETION_FAILED:
|
case ActionMessage::COMPLETION_FAILED:
|
||||||
commandCount--;
|
commandCount--;
|
||||||
owner->completionFailedReceived(ActionMessage::getActionId(reply),
|
owner->completionFailedReceived(ActionMessage::getActionId(reply),
|
||||||
ActionMessage::getReturnCode(reply));
|
ActionMessage::getReturnCode(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
case ActionMessage::STEP_SUCCESS:
|
case ActionMessage::STEP_SUCCESS:
|
||||||
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
|
owner->stepSuccessfulReceived(ActionMessage::getActionId(reply),
|
||||||
ActionMessage::getStep(reply));
|
ActionMessage::getStep(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
case ActionMessage::STEP_FAILED:
|
case ActionMessage::STEP_FAILED:
|
||||||
commandCount--;
|
commandCount--;
|
||||||
owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply),
|
owner->stepFailedReceived(ActionMessage::getActionId(reply), ActionMessage::getStep(reply),
|
||||||
ActionMessage::getReturnCode(reply));
|
ActionMessage::getReturnCode(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
case ActionMessage::DATA_REPLY:
|
case ActionMessage::DATA_REPLY:
|
||||||
extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply));
|
extractDataForOwner(ActionMessage::getActionId(reply), ActionMessage::getStoreId(reply));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
default:
|
default:
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CommandActionHelper::getCommandCount() const { return commandCount; }
|
uint8_t CommandActionHelper::getCommandCount() const { return commandCount; }
|
||||||
|
|
||||||
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
|
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
|
||||||
const uint8_t *data = NULL;
|
const uint8_t *data = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
|
ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
owner->dataReceived(actionId, data, size);
|
owner->dataReceived(actionId, data, size);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/serialize/SerializeIF.h"
|
#include "fsfw/serialize/SerializeIF.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
|
||||||
@ -14,14 +14,14 @@ class CommandActionHelper {
|
|||||||
friend class CommandsActionsIF;
|
friend class CommandsActionsIF;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CommandActionHelper(CommandsActionsIF* owner);
|
explicit CommandActionHelper(CommandsActionsIF* owner);
|
||||||
virtual ~CommandActionHelper();
|
virtual ~CommandActionHelper();
|
||||||
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
|
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data,
|
||||||
uint32_t size);
|
uint32_t size);
|
||||||
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data);
|
ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data);
|
||||||
ReturnValue_t initialize();
|
ReturnValue_t initialize();
|
||||||
ReturnValue_t handleReply(CommandMessage* reply);
|
ReturnValue_t handleReply(CommandMessage* reply);
|
||||||
uint8_t getCommandCount() const;
|
[[nodiscard]] uint8_t getCommandCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommandsActionsIF* owner;
|
CommandsActionsIF* owner;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
|
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
|
||||||
#define FSFW_ACTION_COMMANDSACTIONSIF_H_
|
#define FSFW_ACTION_COMMANDSACTIONSIF_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "CommandActionHelper.h"
|
#include "CommandActionHelper.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to separate commanding actions of other objects.
|
* Interface to separate commanding actions of other objects.
|
||||||
@ -21,7 +21,7 @@ class CommandsActionsIF {
|
|||||||
static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF;
|
||||||
static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
|
static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
|
||||||
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
|
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
|
||||||
virtual ~CommandsActionsIF() {}
|
virtual ~CommandsActionsIF() = default;
|
||||||
virtual MessageQueueIF* getCommandQueuePtr() = 0;
|
virtual MessageQueueIF* getCommandQueuePtr() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef FSFW_ACTION_HASACTIONSIF_H_
|
#ifndef FSFW_ACTION_HASACTIONSIF_H_
|
||||||
#define FSFW_ACTION_HASACTIONSIF_H_
|
#define FSFW_ACTION_HASACTIONSIF_H_
|
||||||
|
|
||||||
#include "../ipc/MessageQueueIF.h"
|
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "ActionHelper.h"
|
#include "ActionHelper.h"
|
||||||
#include "ActionMessage.h"
|
#include "ActionMessage.h"
|
||||||
#include "SimpleActionHelper.h"
|
#include "SimpleActionHelper.h"
|
||||||
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -40,12 +40,12 @@ class HasActionsIF {
|
|||||||
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
|
static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2);
|
||||||
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3);
|
||||||
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4);
|
||||||
virtual ~HasActionsIF() {}
|
virtual ~HasActionsIF() = default;
|
||||||
/**
|
/**
|
||||||
* Function to get the MessageQueueId_t of the implementing object
|
* Function to get the MessageQueueId_t of the implementing object
|
||||||
* @return MessageQueueId_t of the object
|
* @return MessageQueueId_t of the object
|
||||||
*/
|
*/
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
[[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
/**
|
/**
|
||||||
* Execute or initialize the execution of a certain function.
|
* Execute or initialize the execution of a certain function.
|
||||||
* The ActionHelpers will execute this function and behave differently
|
* The ActionHelpers will execute this function and behave differently
|
||||||
@ -53,7 +53,7 @@ class HasActionsIF {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* -@c EXECUTION_FINISHED Finish reply will be generated
|
* -@c EXECUTION_FINISHED Finish reply will be generated
|
||||||
* -@c Not RETURN_OK Step failure reply will be generated
|
* -@c Not returnvalue::OK Step failure reply will be generated
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size) = 0;
|
const uint8_t* data, size_t size) = 0;
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue)
|
||||||
: ActionHelper(setOwner, useThisQueue), isExecuting(false) {}
|
: ActionHelper(setOwner, useThisQueue), isExecuting(false) {}
|
||||||
|
|
||||||
SimpleActionHelper::~SimpleActionHelper() {}
|
SimpleActionHelper::~SimpleActionHelper() = default;
|
||||||
|
|
||||||
void SimpleActionHelper::step(ReturnValue_t result) {
|
void SimpleActionHelper::step(ReturnValue_t result) {
|
||||||
// STEP_OFFESET is subtracted to compensate for adding offset in base
|
// STEP_OFFESET is subtracted to compensate for adding offset in base
|
||||||
// method, which is not necessary here.
|
// method, which is not necessary here.
|
||||||
ActionHelper::step(stepCount - STEP_OFFSET, lastCommander, lastAction, result);
|
ActionHelper::step(stepCount - STEP_OFFSET, lastCommander, lastAction, result);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
resetHelper();
|
resetHelper();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,10 +38,10 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
|
|||||||
ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY);
|
ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
}
|
}
|
||||||
const uint8_t* dataPtr = NULL;
|
const uint8_t* dataPtr = nullptr;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
return;
|
return;
|
||||||
@ -51,12 +51,12 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId
|
|||||||
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
|
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
|
||||||
ipcStore->deleteData(dataAddress);
|
ipcStore->deleteData(dataAddress);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case HasReturnvaluesIF::RETURN_OK:
|
case returnvalue::OK:
|
||||||
isExecuting = true;
|
isExecuting = true;
|
||||||
stepCount++;
|
stepCount++;
|
||||||
break;
|
break;
|
||||||
case HasActionsIF::EXECUTION_FINISHED:
|
case HasActionsIF::EXECUTION_FINISHED:
|
||||||
ActionMessage::setCompletionReply(&reply, actionId, true, HasReturnvaluesIF::RETURN_OK);
|
ActionMessage::setCompletionReply(&reply, actionId, true, returnvalue::OK);
|
||||||
queueToUse->sendMessage(commandedBy, &reply);
|
queueToUse->sendMessage(commandedBy, &reply);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -11,15 +11,15 @@
|
|||||||
class SimpleActionHelper : public ActionHelper {
|
class SimpleActionHelper : public ActionHelper {
|
||||||
public:
|
public:
|
||||||
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
|
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
|
||||||
virtual ~SimpleActionHelper();
|
~SimpleActionHelper() override;
|
||||||
void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
void step(ReturnValue_t result = returnvalue::OK);
|
||||||
void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
void finish(ReturnValue_t result = returnvalue::OK);
|
||||||
ReturnValue_t reportData(SerializeIF* data);
|
ReturnValue_t reportData(SerializeIF* data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||||
store_address_t dataAddress);
|
store_address_t dataAddress) override;
|
||||||
virtual void resetHelper();
|
void resetHelper() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isExecuting;
|
bool isExecuting;
|
||||||
@ -28,4 +28,4 @@ class SimpleActionHelper : public ActionHelper {
|
|||||||
uint8_t stepCount = 0;
|
uint8_t stepCount = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SIMPLEACTIONHELPER_H_ */
|
#endif /* FSFW_ACTION_SIMPLEACTIONHELPER_H_ */
|
||||||
|
@ -20,11 +20,11 @@ CFDPHandler::~CFDPHandler() {}
|
|||||||
|
|
||||||
ReturnValue_t CFDPHandler::initialize() {
|
ReturnValue_t CFDPHandler::initialize() {
|
||||||
ReturnValue_t result = SystemObject::initialize();
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
this->distributor->registerHandler(this);
|
this->distributor->registerHandler(this);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
|
ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
|
||||||
@ -38,18 +38,18 @@ ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
|
|||||||
|
|
||||||
// TODO read out packet from store using storeId
|
// TODO read out packet from store using storeId
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CFDPHandler::performOperation(uint8_t opCode) {
|
ReturnValue_t CFDPHandler::performOperation(uint8_t opCode) {
|
||||||
ReturnValue_t status = RETURN_OK;
|
ReturnValue_t status = returnvalue::OK;
|
||||||
CommandMessage currentMessage;
|
CommandMessage currentMessage;
|
||||||
for (status = this->requestQueue->receiveMessage(¤tMessage); status == RETURN_OK;
|
for (status = this->requestQueue->receiveMessage(¤tMessage); status == returnvalue::OK;
|
||||||
status = this->requestQueue->receiveMessage(¤tMessage)) {
|
status = this->requestQueue->receiveMessage(¤tMessage)) {
|
||||||
store_address_t storeId = CFDPMessage::getStoreId(¤tMessage);
|
store_address_t storeId = CFDPMessage::getStoreId(¤tMessage);
|
||||||
this->handleRequest(storeId);
|
this->handleRequest(storeId);
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CFDPHandler::getIdentifier() { return 0; }
|
uint16_t CFDPHandler::getIdentifier() { return 0; }
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "fsfw/ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
#include "fsfw/tcdistribution/CFDPDistributor.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
@ -12,10 +12,7 @@ namespace Factory {
|
|||||||
void setStaticFrameworkObjectIds();
|
void setStaticFrameworkObjectIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
class CFDPHandler : public ExecutableObjectIF,
|
class CFDPHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, public SystemObject {
|
||||||
public AcceptsTelecommandsIF,
|
|
||||||
public SystemObject,
|
|
||||||
public HasReturnvaluesIF {
|
|
||||||
friend void(Factory::setStaticFrameworkObjectIds)();
|
friend void(Factory::setStaticFrameworkObjectIds)();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
target_sources(${LIB_FSFW_NAME} PRIVATE CFDPHandler.cpp CFDPMessage.cpp)
|
||||||
CFDPHandler.cpp
|
|
||||||
CFDPMessage.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(pdu)
|
add_subdirectory(pdu)
|
||||||
add_subdirectory(tlv)
|
add_subdirectory(tlv)
|
||||||
|
@ -43,7 +43,7 @@ struct FileSize : public SerializeIF {
|
|||||||
uint32_t sizeTmp = 0;
|
uint32_t sizeTmp = 0;
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
SerializeAdapter::deSerialize(&sizeTmp, buffer, size, streamEndianness);
|
SerializeAdapter::deSerialize(&sizeTmp, buffer, size, streamEndianness);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
fileSize = sizeTmp;
|
fileSize = sizeTmp;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -53,11 +53,11 @@ struct FileSize : public SerializeIF {
|
|||||||
ReturnValue_t setFileSize(uint64_t fileSize, bool largeFile) {
|
ReturnValue_t setFileSize(uint64_t fileSize, bool largeFile) {
|
||||||
if (not largeFile and fileSize > UINT32_MAX) {
|
if (not largeFile and fileSize > UINT32_MAX) {
|
||||||
// TODO: emit warning here
|
// TODO: emit warning here
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
this->fileSize = fileSize;
|
this->fileSize = fileSize;
|
||||||
this->largeFile = largeFile;
|
this->largeFile = largeFile;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLargeFile() const { return largeFile; }
|
bool isLargeFile() const { return largeFile; }
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "fsfw/returnvalues/FwClassIds.h"
|
#include "fsfw/returnvalues/FwClassIds.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
@ -15,28 +15,24 @@ static constexpr uint8_t VERSION_BITS = 0b00100000;
|
|||||||
|
|
||||||
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
|
||||||
|
|
||||||
static constexpr ReturnValue_t INVALID_TLV_TYPE =
|
static constexpr ReturnValue_t INVALID_TLV_TYPE = returnvalue::makeCode(CFDP_CLASS_ID, 1);
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 1);
|
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = returnvalue::makeCode(CFDP_CLASS_ID, 2);
|
||||||
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS =
|
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = returnvalue::makeCode(CFDP_CLASS_ID, 3);
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 2);
|
|
||||||
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
|
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 3);
|
|
||||||
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
|
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 4);
|
returnvalue::makeCode(CFDP_CLASS_ID, 4);
|
||||||
//! Can not parse options. This can also occur because there are options
|
//! Can not parse options. This can also occur because there are options
|
||||||
//! available but the user did not pass a valid options array
|
//! available but the user did not pass a valid options array
|
||||||
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
|
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 5);
|
returnvalue::makeCode(CFDP_CLASS_ID, 5);
|
||||||
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
|
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = returnvalue::makeCode(CFDP_CLASS_ID, 6);
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 6);
|
|
||||||
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
|
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 6);
|
returnvalue::makeCode(CFDP_CLASS_ID, 6);
|
||||||
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
|
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 8);
|
returnvalue::makeCode(CFDP_CLASS_ID, 8);
|
||||||
//! Can not parse filestore response because user did not pass a valid instance
|
//! Can not parse filestore response because user did not pass a valid instance
|
||||||
//! or remaining size is invalid
|
//! or remaining size is invalid
|
||||||
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
|
static constexpr ReturnValue_t FILESTORE_RESPONSE_CANT_PARSE_FS_MESSAGE =
|
||||||
HasReturnvaluesIF::makeReturnCode(CFDP_CLASS_ID, 9);
|
returnvalue::makeCode(CFDP_CLASS_ID, 9);
|
||||||
|
|
||||||
//! Checksum types according to the SANA Checksum Types registry
|
//! Checksum types according to the SANA Checksum Types registry
|
||||||
//! https://sanaregistry.org/r/checksum_identifiers/
|
//! https://sanaregistry.org/r/checksum_identifiers/
|
||||||
|
@ -5,7 +5,7 @@ AckPduDeserializer::AckPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Ac
|
|||||||
|
|
||||||
ReturnValue_t AckPduDeserializer::parseData() {
|
ReturnValue_t AckPduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
||||||
@ -15,7 +15,7 @@ ReturnValue_t AckPduDeserializer::parseData() {
|
|||||||
if (not checkAndSetCodes(rawPtr[currentIdx], rawPtr[currentIdx + 1])) {
|
if (not checkAndSetCodes(rawPtr[currentIdx], rawPtr[currentIdx + 1])) {
|
||||||
return cfdp::INVALID_ACK_DIRECTIVE_FIELDS;
|
return cfdp::INVALID_ACK_DIRECTIVE_FIELDS;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AckPduDeserializer::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
bool AckPduDeserializer::checkAndSetCodes(uint8_t firstByte, uint8_t secondByte) {
|
||||||
|
@ -11,7 +11,7 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
|
cfdp::FileDirectives ackedDirective = ackInfo.getAckedDirective();
|
||||||
@ -21,7 +21,7 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
if (ackedDirective != cfdp::FileDirectives::FINISH and
|
if (ackedDirective != cfdp::FileDirectives::FINISH and
|
||||||
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
|
ackedDirective != cfdp::FileDirectives::EOF_DIRECTIVE) {
|
||||||
// TODO: better returncode
|
// TODO: better returncode
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*size + 2 > maxSize) {
|
if (*size + 2 > maxSize) {
|
||||||
return SerializeIF::BUFFER_TOO_SHORT;
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
@ -32,5 +32,5 @@ ReturnValue_t AckPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
**buffer = ackedConditionCode << 4 | transactionStatus;
|
**buffer = ackedConditionCode << 4 | transactionStatus;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,30 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
target_sources(
|
||||||
PduConfig.cpp
|
${LIB_FSFW_NAME}
|
||||||
VarLenField.cpp
|
PRIVATE PduConfig.cpp
|
||||||
HeaderSerializer.cpp
|
VarLenField.cpp
|
||||||
HeaderDeserializer.cpp
|
HeaderSerializer.cpp
|
||||||
FileDirectiveDeserializer.cpp
|
HeaderDeserializer.cpp
|
||||||
FileDirectiveSerializer.cpp
|
FileDirectiveDeserializer.cpp
|
||||||
|
FileDirectiveSerializer.cpp
|
||||||
AckInfo.cpp
|
AckInfo.cpp
|
||||||
AckPduSerializer.cpp
|
AckPduSerializer.cpp
|
||||||
AckPduDeserializer.cpp
|
AckPduDeserializer.cpp
|
||||||
EofInfo.cpp
|
EofInfo.cpp
|
||||||
EofPduSerializer.cpp
|
EofPduSerializer.cpp
|
||||||
EofPduDeserializer.cpp
|
EofPduDeserializer.cpp
|
||||||
NakInfo.cpp
|
NakInfo.cpp
|
||||||
NakPduSerializer.cpp
|
NakPduSerializer.cpp
|
||||||
NakPduDeserializer.cpp
|
NakPduDeserializer.cpp
|
||||||
FinishedInfo.cpp
|
FinishedInfo.cpp
|
||||||
FinishedPduSerializer.cpp
|
FinishedPduSerializer.cpp
|
||||||
FinishedPduDeserializer.cpp
|
FinishedPduDeserializer.cpp
|
||||||
MetadataInfo.cpp
|
MetadataInfo.cpp
|
||||||
MetadataPduSerializer.cpp
|
MetadataPduSerializer.cpp
|
||||||
MetadataPduDeserializer.cpp
|
MetadataPduDeserializer.cpp
|
||||||
KeepAlivePduSerializer.cpp
|
KeepAlivePduSerializer.cpp
|
||||||
KeepAlivePduDeserializer.cpp
|
KeepAlivePduDeserializer.cpp
|
||||||
PromptPduSerializer.cpp
|
PromptPduSerializer.cpp
|
||||||
PromptPduDeserializer.cpp
|
PromptPduDeserializer.cpp
|
||||||
|
FileDataSerializer.cpp
|
||||||
FileDataSerializer.cpp
|
FileDataDeserializer.cpp
|
||||||
FileDataDeserializer.cpp
|
FileDataInfo.cpp)
|
||||||
FileDataInfo.cpp
|
|
||||||
)
|
|
||||||
|
@ -8,7 +8,7 @@ EofPduDeserializer::EofPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Eo
|
|||||||
|
|
||||||
ReturnValue_t EofPduDeserializer::parseData() {
|
ReturnValue_t EofPduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
|
|||||||
uint32_t checksum = 0;
|
uint32_t checksum = 0;
|
||||||
auto endianness = getEndianness();
|
auto endianness = getEndianness();
|
||||||
result = SerializeAdapter::deSerialize(&checksum, &bufPtr, &deserLen, endianness);
|
result = SerializeAdapter::deSerialize(&checksum, &bufPtr, &deserLen, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
info.setChecksum(checksum);
|
info.setChecksum(checksum);
|
||||||
@ -44,7 +44,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
|
|||||||
result = SerializeAdapter::deSerialize(&fileSizeValue, &bufPtr, &deserLen, endianness);
|
result = SerializeAdapter::deSerialize(&fileSizeValue, &bufPtr, &deserLen, endianness);
|
||||||
info.setFileSize(fileSizeValue, false);
|
info.setFileSize(fileSizeValue, false);
|
||||||
}
|
}
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
if (info.getConditionCode() != cfdp::ConditionCode::NO_ERROR) {
|
||||||
@ -61,7 +61,7 @@ ReturnValue_t EofPduDeserializer::parseData() {
|
|||||||
" given TLV pointer invalid");
|
" given TLV pointer invalid");
|
||||||
#endif
|
#endif
|
||||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);
|
result = tlvPtr->deSerialize(&bufPtr, &deserLen, endianness);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ ReturnValue_t EofPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (*size + 1 > maxSize) {
|
if (*size + 1 > maxSize) {
|
||||||
@ -27,7 +27,7 @@ ReturnValue_t EofPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
*size += 1;
|
*size += 1;
|
||||||
uint32_t checksum = info.getChecksum();
|
uint32_t checksum = info.getChecksum();
|
||||||
result = SerializeAdapter::serialize(&checksum, buffer, size, maxSize, streamEndianness);
|
result = SerializeAdapter::serialize(&checksum, buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (info.getFileSize().isLargeFile()) {
|
if (info.getFileSize().isLargeFile()) {
|
||||||
|
@ -6,7 +6,7 @@ FileDataDeserializer::FileDataDeserializer(const uint8_t* pduBuf, size_t maxSize
|
|||||||
|
|
||||||
ReturnValue_t FileDataDeserializer::parseData() {
|
ReturnValue_t FileDataDeserializer::parseData() {
|
||||||
ReturnValue_t result = HeaderDeserializer::parseData();
|
ReturnValue_t result = HeaderDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = HeaderDeserializer::getHeaderSize();
|
size_t currentIdx = HeaderDeserializer::getHeaderSize();
|
||||||
@ -32,13 +32,13 @@ ReturnValue_t FileDataDeserializer::parseData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = info.getOffset().deSerialize(&buf, &remSize, this->getEndianness());
|
result = info.getOffset().deSerialize(&buf, &remSize, this->getEndianness());
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (remSize > 0) {
|
if (remSize > 0) {
|
||||||
info.setFileData(buf, remSize);
|
info.setFileData(buf, remSize);
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializeIF::Endianness FileDataDeserializer::getEndianness() const { return endianness; }
|
SerializeIF::Endianness FileDataDeserializer::getEndianness() const { return endianness; }
|
||||||
|
@ -50,11 +50,11 @@ ReturnValue_t FileDataInfo::addSegmentMetadataInfo(cfdp::RecordContinuationState
|
|||||||
this->segmentMetadataFlag = cfdp::SegmentMetadataFlag::PRESENT;
|
this->segmentMetadataFlag = cfdp::SegmentMetadataFlag::PRESENT;
|
||||||
this->recContState = recContState;
|
this->recContState = recContState;
|
||||||
if (segmentMetadataLen > 63) {
|
if (segmentMetadataLen > 63) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
this->segmentMetadata = segmentMetadata;
|
this->segmentMetadata = segmentMetadata;
|
||||||
this->segmentMetadataLen = segmentMetadataLen;
|
this->segmentMetadataLen = segmentMetadataLen;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *FileDataInfo::getFileData(size_t *fileSize) const {
|
const uint8_t *FileDataInfo::getFileData(size_t *fileSize) const {
|
||||||
|
@ -17,7 +17,7 @@ void FileDataSerializer::update() {
|
|||||||
ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (*size + this->getSerializedSize() > maxSize) {
|
if (*size + this->getSerializedSize() > maxSize) {
|
||||||
@ -36,7 +36,7 @@ ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size
|
|||||||
}
|
}
|
||||||
cfdp::FileSize& offset = info.getOffset();
|
cfdp::FileSize& offset = info.getOffset();
|
||||||
result = offset.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
|
result = offset.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t fileSize = 0;
|
size_t fileSize = 0;
|
||||||
@ -47,7 +47,7 @@ ReturnValue_t FileDataSerializer::serialize(uint8_t** buffer, size_t* size, size
|
|||||||
std::memcpy(*buffer, readOnlyPtr, fileSize);
|
std::memcpy(*buffer, readOnlyPtr, fileSize);
|
||||||
*buffer += fileSize;
|
*buffer += fileSize;
|
||||||
*size += fileSize;
|
*size += fileSize;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FileDataSerializer::getSerializedSize() const {
|
size_t FileDataSerializer::getSerializedSize() const {
|
||||||
|
@ -7,7 +7,7 @@ cfdp::FileDirectives FileDirectiveDeserializer::getFileDirective() const { retur
|
|||||||
|
|
||||||
ReturnValue_t FileDirectiveDeserializer::parseData() {
|
ReturnValue_t FileDirectiveDeserializer::parseData() {
|
||||||
ReturnValue_t result = HeaderDeserializer::parseData();
|
ReturnValue_t result = HeaderDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (this->getPduDataFieldLen() < 1) {
|
if (this->getPduDataFieldLen() < 1) {
|
||||||
@ -21,7 +21,7 @@ ReturnValue_t FileDirectiveDeserializer::parseData() {
|
|||||||
return cfdp::INVALID_DIRECTIVE_FIELDS;
|
return cfdp::INVALID_DIRECTIVE_FIELDS;
|
||||||
}
|
}
|
||||||
setFileDirective(static_cast<cfdp::FileDirectives>(rawPtr[currentIdx]));
|
setFileDirective(static_cast<cfdp::FileDirectives>(rawPtr[currentIdx]));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FileDirectiveDeserializer::getHeaderSize() const {
|
size_t FileDirectiveDeserializer::getHeaderSize() const {
|
||||||
|
@ -13,13 +13,13 @@ size_t FileDirectiveSerializer::getSerializedSize() const {
|
|||||||
ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (FileDirectiveSerializer::getWholePduSize() > maxSize) {
|
if (FileDirectiveSerializer::getWholePduSize() > maxSize) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = HeaderSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ ReturnValue_t FileDirectiveSerializer::serialize(uint8_t **buffer, size_t *size,
|
|||||||
**buffer = directiveCode;
|
**buffer = directiveCode;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDirectiveSerializer::setDirectiveDataFieldLen(size_t len) {
|
void FileDirectiveSerializer::setDirectiveDataFieldLen(size_t len) {
|
||||||
|
@ -46,14 +46,14 @@ ReturnValue_t FinishedInfo::setFilestoreResponsesArray(FilestoreResponseTlv** fs
|
|||||||
if (maxFsResponsesLen != nullptr) {
|
if (maxFsResponsesLen != nullptr) {
|
||||||
this->fsResponsesMaxLen = *maxFsResponsesLen;
|
this->fsResponsesMaxLen = *maxFsResponsesLen;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsResponses,
|
ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsResponses,
|
||||||
size_t* fsResponsesLen,
|
size_t* fsResponsesLen,
|
||||||
size_t* fsResponsesMaxLen) {
|
size_t* fsResponsesMaxLen) {
|
||||||
if (fsResponses == nullptr) {
|
if (fsResponses == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*fsResponses = this->fsResponses;
|
*fsResponses = this->fsResponses;
|
||||||
if (fsResponsesLen != nullptr) {
|
if (fsResponsesLen != nullptr) {
|
||||||
@ -62,7 +62,7 @@ ReturnValue_t FinishedInfo::getFilestoreResonses(FilestoreResponseTlv*** fsRespo
|
|||||||
if (fsResponsesMaxLen != nullptr) {
|
if (fsResponsesMaxLen != nullptr) {
|
||||||
*fsResponsesMaxLen = this->fsResponsesMaxLen;
|
*fsResponsesMaxLen = this->fsResponsesMaxLen;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
|
void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
|
||||||
@ -71,10 +71,10 @@ void FinishedInfo::setFaultLocation(EntityIdTlv* faultLocation) {
|
|||||||
|
|
||||||
ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
|
ReturnValue_t FinishedInfo::getFaultLocation(EntityIdTlv** faultLocation) {
|
||||||
if (this->faultLocation == nullptr) {
|
if (this->faultLocation == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*faultLocation = this->faultLocation;
|
*faultLocation = this->faultLocation;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; }
|
cfdp::ConditionCode FinishedInfo::getConditionCode() const { return conditionCode; }
|
||||||
|
@ -6,7 +6,7 @@ FinishPduDeserializer::FinishPduDeserializer(const uint8_t* pduBuf, size_t maxSi
|
|||||||
|
|
||||||
ReturnValue_t FinishPduDeserializer::parseData() {
|
ReturnValue_t FinishPduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
||||||
@ -33,7 +33,7 @@ FinishedInfo& FinishPduDeserializer::getInfo() { return finishedInfo; }
|
|||||||
|
|
||||||
ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx, const uint8_t* buf,
|
||||||
cfdp::ConditionCode conditionCode) {
|
cfdp::ConditionCode conditionCode) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
size_t fsResponsesIdx = 0;
|
size_t fsResponsesIdx = 0;
|
||||||
auto endianness = getEndianness();
|
auto endianness = getEndianness();
|
||||||
FilestoreResponseTlv** fsResponseArray = nullptr;
|
FilestoreResponseTlv** fsResponseArray = nullptr;
|
||||||
@ -60,7 +60,7 @@ ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx,
|
|||||||
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
|
return cfdp::FINISHED_CANT_PARSE_FS_RESPONSES;
|
||||||
}
|
}
|
||||||
result = fsResponseArray[fsResponsesIdx]->deSerialize(&buf, &remLen, endianness);
|
result = fsResponseArray[fsResponsesIdx]->deSerialize(&buf, &remLen, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
fsResponsesIdx += 1;
|
fsResponsesIdx += 1;
|
||||||
@ -72,11 +72,11 @@ ReturnValue_t FinishPduDeserializer::parseTlvs(size_t remLen, size_t currentIdx,
|
|||||||
return cfdp::INVALID_TLV_TYPE;
|
return cfdp::INVALID_TLV_TYPE;
|
||||||
}
|
}
|
||||||
result = finishedInfo.getFaultLocation(&faultLocation);
|
result = finishedInfo.getFaultLocation(&faultLocation);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = faultLocation->deSerialize(&buf, &remLen, endianness);
|
result = faultLocation->deSerialize(&buf, &remLen, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,7 +17,7 @@ ReturnValue_t FinishPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (*size + 1 >= maxSize) {
|
if (*size + 1 >= maxSize) {
|
||||||
@ -34,13 +34,13 @@ ReturnValue_t FinishPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
|
|||||||
finishInfo.getFilestoreResonses(&fsResponsesArray, &fsResponsesArrayLen, nullptr);
|
finishInfo.getFilestoreResonses(&fsResponsesArray, &fsResponsesArrayLen, nullptr);
|
||||||
for (size_t idx = 0; idx < fsResponsesArrayLen; idx++) {
|
for (size_t idx = 0; idx < fsResponsesArrayLen; idx++) {
|
||||||
result = fsResponsesArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
|
result = fsResponsesArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EntityIdTlv *entityId = nullptr;
|
EntityIdTlv *entityId = nullptr;
|
||||||
if (finishInfo.getFaultLocation(&entityId) == HasReturnvaluesIF::RETURN_OK) {
|
if (finishInfo.getFaultLocation(&entityId) == returnvalue::OK) {
|
||||||
result = entityId->serialize(buffer, size, maxSize, streamEndianness);
|
result = entityId->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -18,7 +18,7 @@ ReturnValue_t HeaderDeserializer::setData(uint8_t *dataPtr, size_t maxSize, void
|
|||||||
if (dataPtr == nullptr) {
|
if (dataPtr == nullptr) {
|
||||||
// Allowed for now
|
// Allowed for now
|
||||||
this->fixedHeader = nullptr;
|
this->fixedHeader = nullptr;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
this->fixedHeader = reinterpret_cast<PduHeaderFixedStruct *>(const_cast<uint8_t *>(dataPtr));
|
this->fixedHeader = reinterpret_cast<PduHeaderFixedStruct *>(const_cast<uint8_t *>(dataPtr));
|
||||||
sourceIdRaw = static_cast<uint8_t *>(&fixedHeader->variableFieldsStart);
|
sourceIdRaw = static_cast<uint8_t *>(&fixedHeader->variableFieldsStart);
|
||||||
@ -27,7 +27,7 @@ ReturnValue_t HeaderDeserializer::setData(uint8_t *dataPtr, size_t maxSize, void
|
|||||||
seqNumRaw = static_cast<uint8_t *>(sourceIdRaw) + static_cast<uint8_t>(widthEntityIds);
|
seqNumRaw = static_cast<uint8_t *>(sourceIdRaw) + static_cast<uint8_t>(widthEntityIds);
|
||||||
destIdRaw = static_cast<uint8_t *>(seqNumRaw) + static_cast<uint8_t>(widthSeqNum);
|
destIdRaw = static_cast<uint8_t *>(seqNumRaw) + static_cast<uint8_t>(widthSeqNum);
|
||||||
this->maxSize = maxSize;
|
this->maxSize = maxSize;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t HeaderDeserializer::getHeaderSize() const {
|
size_t HeaderDeserializer::getHeaderSize() const {
|
||||||
|
@ -36,8 +36,8 @@ class HeaderDeserializer : public RedirectableDataPointerIF, public PduHeaderIF
|
|||||||
/**
|
/**
|
||||||
* This needs to be called before accessing the PDU fields to avoid segmentation faults.
|
* This needs to be called before accessing the PDU fields to avoid segmentation faults.
|
||||||
* @return
|
* @return
|
||||||
* - RETURN_OK on parse success
|
* - returnvalue::OK on parse success
|
||||||
* - RETURN_FAILED Invalid raw data
|
* - returnvalue::FAILED Invalid raw data
|
||||||
* - SerializeIF::BUFFER_TOO_SHORT if buffer is shorter than expected
|
* - SerializeIF::BUFFER_TOO_SHORT if buffer is shorter than expected
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t parseData();
|
virtual ReturnValue_t parseData();
|
||||||
@ -61,7 +61,7 @@ class HeaderDeserializer : public RedirectableDataPointerIF, public PduHeaderIF
|
|||||||
void getDestId(cfdp::EntityId& destId) const override;
|
void getDestId(cfdp::EntityId& destId) const override;
|
||||||
void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override;
|
void getTransactionSeqNum(cfdp::TransactionSeqNum& seqNum) const override;
|
||||||
|
|
||||||
ReturnValue_t deserResult = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t deserResult = returnvalue::OK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can also be used to reset the pointer to a nullptr, but the getter functions will not
|
* Can also be used to reset the pointer to a nullptr, but the getter functions will not
|
||||||
|
@ -15,7 +15,7 @@ HeaderSerializer::HeaderSerializer(PduConfig &pduConf, cfdp::PduType pduType,
|
|||||||
ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (maxSize < this->getSerializedSize()) {
|
if (maxSize < this->getSerializedSize()) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
@ -32,19 +32,19 @@ ReturnValue_t HeaderSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 4;
|
*size += 4;
|
||||||
ReturnValue_t result = pduConf.sourceId.serialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = pduConf.sourceId.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = pduConf.seqNum.serialize(buffer, size, maxSize, streamEndianness);
|
result = pduConf.seqNum.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = pduConf.destId.serialize(buffer, size, maxSize, streamEndianness);
|
result = pduConf.destId.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t HeaderSerializer::getSerializedSize() const {
|
size_t HeaderSerializer::getSerializedSize() const {
|
||||||
@ -55,7 +55,7 @@ size_t HeaderSerializer::getSerializedSize() const {
|
|||||||
ReturnValue_t HeaderSerializer::deSerialize(const uint8_t **buffer, size_t *size,
|
ReturnValue_t HeaderSerializer::deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
// We could implement this, but I prefer dedicated classes
|
// We could implement this, but I prefer dedicated classes
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t HeaderSerializer::getWholePduSize() const {
|
size_t HeaderSerializer::getWholePduSize() const {
|
||||||
|
@ -44,7 +44,7 @@ class HeaderSerializer : public SerializeIF, public PduHeaderIF {
|
|||||||
cfdp::WidthInBytes getLenEntityIds() const override;
|
cfdp::WidthInBytes getLenEntityIds() const override;
|
||||||
cfdp::WidthInBytes getLenSeqNum() const override;
|
cfdp::WidthInBytes getLenSeqNum() const override;
|
||||||
cfdp::SegmentMetadataFlag getSegmentMetadataFlag() const override;
|
cfdp::SegmentMetadataFlag getSegmentMetadataFlag() const override;
|
||||||
bool hasSegmentMetadataFlag() const;
|
bool hasSegmentMetadataFlag() const override;
|
||||||
void setSegmentationControl(cfdp::SegmentationControl);
|
void setSegmentationControl(cfdp::SegmentationControl);
|
||||||
|
|
||||||
void getSourceId(cfdp::EntityId& sourceId) const override;
|
void getSourceId(cfdp::EntityId& sourceId) const override;
|
||||||
|
@ -6,7 +6,7 @@ KeepAlivePduDeserializer::KeepAlivePduDeserializer(const uint8_t* pduBuf, size_t
|
|||||||
|
|
||||||
ReturnValue_t KeepAlivePduDeserializer::parseData() {
|
ReturnValue_t KeepAlivePduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
||||||
|
@ -19,7 +19,7 @@ ReturnValue_t KeepAlivePduSerializer::serialize(uint8_t **buffer, size_t *size,
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return progress.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
|
return progress.serialize(this->getLargeFileFlag(), buffer, size, maxSize, streamEndianness);
|
||||||
|
@ -39,7 +39,7 @@ cfdp::FileSize& MetadataInfo::getFileSize() { return fileSize; }
|
|||||||
ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* optionsLen,
|
ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* optionsLen,
|
||||||
size_t* maxOptsLen) {
|
size_t* maxOptsLen) {
|
||||||
if (optionsArray == nullptr or this->optionsArray == nullptr) {
|
if (optionsArray == nullptr or this->optionsArray == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*optionsArray = this->optionsArray;
|
*optionsArray = this->optionsArray;
|
||||||
if (optionsLen != nullptr) {
|
if (optionsLen != nullptr) {
|
||||||
@ -48,7 +48,7 @@ ReturnValue_t MetadataInfo::getOptions(cfdp::Tlv*** optionsArray, size_t* option
|
|||||||
if (maxOptsLen != nullptr) {
|
if (maxOptsLen != nullptr) {
|
||||||
*maxOptsLen = this->maxOptionsLen;
|
*maxOptsLen = this->maxOptionsLen;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MetadataInfo::hasOptions() const {
|
bool MetadataInfo::hasOptions() const {
|
||||||
|
@ -6,7 +6,7 @@ MetadataPduDeserializer::MetadataPduDeserializer(const uint8_t* pduBuf, size_t m
|
|||||||
|
|
||||||
ReturnValue_t MetadataPduDeserializer::parseData() {
|
ReturnValue_t MetadataPduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
||||||
@ -21,15 +21,15 @@ ReturnValue_t MetadataPduDeserializer::parseData() {
|
|||||||
buf += 1;
|
buf += 1;
|
||||||
auto endianness = getEndianness();
|
auto endianness = getEndianness();
|
||||||
result = info.getFileSize().deSerialize(&buf, &remSize, endianness);
|
result = info.getFileSize().deSerialize(&buf, &remSize, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = info.getSourceFileName().deSerialize(&buf, &remSize, endianness);
|
result = info.getSourceFileName().deSerialize(&buf, &remSize, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = info.getDestFileName().deSerialize(&buf, &remSize, endianness);
|
result = info.getDestFileName().deSerialize(&buf, &remSize, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ ReturnValue_t MetadataPduDeserializer::parseData() {
|
|||||||
return cfdp::METADATA_CANT_PARSE_OPTIONS;
|
return cfdp::METADATA_CANT_PARSE_OPTIONS;
|
||||||
}
|
}
|
||||||
result = optionsArray[optsIdx]->deSerialize(&buf, &remSize, endianness);
|
result = optionsArray[optsIdx]->deSerialize(&buf, &remSize, endianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
optsIdx++;
|
optsIdx++;
|
||||||
|
@ -17,7 +17,7 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (*size + 1 >= maxSize) {
|
if (*size + 1 >= maxSize) {
|
||||||
@ -27,15 +27,15 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
|
|||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
result = info.getFileSize().serialize(buffer, size, maxSize, streamEndianness);
|
result = info.getFileSize().serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = info.getSourceFileName().serialize(buffer, size, maxSize, streamEndianness);
|
result = info.getSourceFileName().serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = info.getDestFileName().serialize(buffer, size, maxSize, streamEndianness);
|
result = info.getDestFileName().serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ ReturnValue_t MetadataPduSerializer::serialize(uint8_t **buffer, size_t *size, s
|
|||||||
info.getOptions(&optsArray, &optsLen, nullptr);
|
info.getOptions(&optsArray, &optsLen, nullptr);
|
||||||
for (size_t idx = 0; idx < optsLen; idx++) {
|
for (size_t idx = 0; idx < optsLen; idx++) {
|
||||||
result = optsArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
|
result = optsArray[idx]->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ NakPduDeserializer::NakPduDeserializer(const uint8_t* pduBuf, size_t maxSize, Na
|
|||||||
|
|
||||||
ReturnValue_t NakPduDeserializer::parseData() {
|
ReturnValue_t NakPduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
||||||
@ -16,11 +16,11 @@ ReturnValue_t NakPduDeserializer::parseData() {
|
|||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
nakInfo.getStartOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
nakInfo.getStartOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = nakInfo.getEndOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
result = nakInfo.getEndOfScope().deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
nakInfo.setSegmentRequestLen(0);
|
nakInfo.setSegmentRequestLen(0);
|
||||||
@ -39,12 +39,12 @@ ReturnValue_t NakPduDeserializer::parseData() {
|
|||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
segReqs[idx].first.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
segReqs[idx].first.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
segReqs[idx].second.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
segReqs[idx].second.deSerialize(&buffer, &remSize, SerializeIF::Endianness::NETWORK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
|
@ -17,15 +17,15 @@ ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = nakInfo.getStartOfScope().serialize(buffer, size, maxSize, streamEndianness);
|
result = nakInfo.getStartOfScope().serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = nakInfo.getEndOfScope().serialize(buffer, size, maxSize, streamEndianness);
|
result = nakInfo.getEndOfScope().serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (nakInfo.hasSegmentRequests()) {
|
if (nakInfo.hasSegmentRequests()) {
|
||||||
@ -34,11 +34,11 @@ ReturnValue_t NakPduSerializer::serialize(uint8_t **buffer, size_t *size, size_t
|
|||||||
nakInfo.getSegmentRequests(&segmentRequests, &segmentRequestLen, nullptr);
|
nakInfo.getSegmentRequests(&segmentRequests, &segmentRequestLen, nullptr);
|
||||||
for (size_t idx = 0; idx < segmentRequestLen; idx++) {
|
for (size_t idx = 0; idx < segmentRequestLen; idx++) {
|
||||||
result = segmentRequests[idx].first.serialize(buffer, size, maxSize, streamEndianness);
|
result = segmentRequests[idx].first.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = segmentRequests[idx].second.serialize(buffer, size, maxSize, streamEndianness);
|
result = segmentRequests[idx].second.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ cfdp::PromptResponseRequired PromptPduDeserializer::getPromptResponseRequired()
|
|||||||
|
|
||||||
ReturnValue_t PromptPduDeserializer::parseData() {
|
ReturnValue_t PromptPduDeserializer::parseData() {
|
||||||
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
ReturnValue_t result = FileDirectiveDeserializer::parseData();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
size_t currentIdx = FileDirectiveDeserializer::getHeaderSize();
|
||||||
@ -17,5 +17,5 @@ ReturnValue_t PromptPduDeserializer::parseData() {
|
|||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
responseRequired = static_cast<cfdp::PromptResponseRequired>((rawPtr[currentIdx] >> 7) & 0x01);
|
responseRequired = static_cast<cfdp::PromptResponseRequired>((rawPtr[currentIdx] >> 7) & 0x01);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ ReturnValue_t PromptPduSerializer::serialize(uint8_t **buffer, size_t *size, siz
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
FileDirectiveSerializer::serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (*size + 1 > maxSize) {
|
if (*size + 1 > maxSize) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
|
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
|
||||||
ReturnValue_t result = this->setValue(width, value);
|
ReturnValue_t result = this->setValue(width, value);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "cfdp::VarLenField: Setting value failed" << std::endl;
|
sif::warning << "cfdp::VarLenField: Setting value failed" << std::endl;
|
||||||
@ -25,21 +25,21 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
|
|||||||
switch (widthInBytes) {
|
switch (widthInBytes) {
|
||||||
case (cfdp::WidthInBytes::ONE_BYTE): {
|
case (cfdp::WidthInBytes::ONE_BYTE): {
|
||||||
if (value > UINT8_MAX) {
|
if (value > UINT8_MAX) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
this->value.oneByte = value;
|
this->value.oneByte = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (cfdp::WidthInBytes::TWO_BYTES): {
|
case (cfdp::WidthInBytes::TWO_BYTES): {
|
||||||
if (value > UINT16_MAX) {
|
if (value > UINT16_MAX) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
this->value.twoBytes = value;
|
this->value.twoBytes = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (cfdp::WidthInBytes::FOUR_BYTES): {
|
case (cfdp::WidthInBytes::FOUR_BYTES): {
|
||||||
if (value > UINT32_MAX) {
|
if (value > UINT32_MAX) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
this->value.fourBytes = value;
|
this->value.fourBytes = value;
|
||||||
break;
|
break;
|
||||||
@ -49,7 +49,7 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->width = widthInBytes;
|
this->width = widthInBytes;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t cfdp::VarLenField::getValue() const {
|
size_t cfdp::VarLenField::getValue() const {
|
||||||
@ -77,7 +77,7 @@ ReturnValue_t cfdp::VarLenField::serialize(uint8_t **buffer, size_t *size, size_
|
|||||||
**buffer = value.oneByte;
|
**buffer = value.oneByte;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (cfdp::WidthInBytes::TWO_BYTES): {
|
case (cfdp::WidthInBytes::TWO_BYTES): {
|
||||||
return SerializeAdapter::serialize(&value.twoBytes, buffer, size, maxSize, streamEndianness);
|
return SerializeAdapter::serialize(&value.twoBytes, buffer, size, maxSize, streamEndianness);
|
||||||
@ -86,7 +86,7 @@ ReturnValue_t cfdp::VarLenField::serialize(uint8_t **buffer, size_t *size, size_
|
|||||||
return SerializeAdapter::serialize(&value.fourBytes, buffer, size, maxSize, streamEndianness);
|
return SerializeAdapter::serialize(&value.fourBytes, buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
|
|||||||
case (cfdp::WidthInBytes::ONE_BYTE): {
|
case (cfdp::WidthInBytes::ONE_BYTE): {
|
||||||
value.oneByte = **buffer;
|
value.oneByte = **buffer;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (cfdp::WidthInBytes::TWO_BYTES): {
|
case (cfdp::WidthInBytes::TWO_BYTES): {
|
||||||
return SerializeAdapter::deSerialize(&value.twoBytes, buffer, size, streamEndianness);
|
return SerializeAdapter::deSerialize(&value.twoBytes, buffer, size, streamEndianness);
|
||||||
@ -114,7 +114,7 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
|
|||||||
return SerializeAdapter::deSerialize(&value.fourBytes, buffer, size, streamEndianness);
|
return SerializeAdapter::deSerialize(&value.fourBytes, buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
target_sources(
|
||||||
EntityIdTlv.cpp
|
${LIB_FSFW_NAME}
|
||||||
FilestoreRequestTlv.cpp
|
PRIVATE EntityIdTlv.cpp
|
||||||
FilestoreResponseTlv.cpp
|
FilestoreRequestTlv.cpp
|
||||||
Lv.cpp
|
FilestoreResponseTlv.cpp
|
||||||
Tlv.cpp
|
Lv.cpp
|
||||||
FlowLabelTlv.cpp
|
Tlv.cpp
|
||||||
MessageToUserTlv.cpp
|
FlowLabelTlv.cpp
|
||||||
FaultHandlerOverrideTlv.cpp
|
MessageToUserTlv.cpp
|
||||||
)
|
FaultHandlerOverrideTlv.cpp)
|
||||||
|
@ -22,7 +22,7 @@ ReturnValue_t FaultHandlerOverrideTlv::serialize(uint8_t **buffer, size_t *size,
|
|||||||
**buffer = this->conditionCode << 4 | this->handlerCode;
|
**buffer = this->conditionCode << 4 | this->handlerCode;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FaultHandlerOverrideTlv::getSerializedSize() const { return getLengthField() + 2; }
|
size_t FaultHandlerOverrideTlv::getSerializedSize() const { return getLengthField() + 2; }
|
||||||
@ -40,7 +40,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
|||||||
*size -= 1;
|
*size -= 1;
|
||||||
size_t detectedSize = **buffer;
|
size_t detectedSize = **buffer;
|
||||||
if (detectedSize != getLengthField()) {
|
if (detectedSize != getLengthField()) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
@ -48,7 +48,7 @@ ReturnValue_t FaultHandlerOverrideTlv::deSerialize(const uint8_t **buffer, size_
|
|||||||
this->handlerCode = static_cast<cfdp::FaultHandlerCode>(**buffer & 0x0f);
|
this->handlerCode = static_cast<cfdp::FaultHandlerCode>(**buffer & 0x0f);
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; }
|
cfdp::TlvTypes FaultHandlerOverrideTlv::getType() const { return cfdp::TlvTypes::FAULT_HANDLER; }
|
||||||
|
@ -16,11 +16,11 @@ void FilestoreRequestTlv::setSecondFileName(cfdp::Lv *secondFileName) {
|
|||||||
ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result = commonSerialize(buffer, size, maxSize, streamEndianness);
|
ReturnValue_t result = commonSerialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
|
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (requiresSecondFileName()) {
|
if (requiresSecondFileName()) {
|
||||||
@ -30,13 +30,13 @@ ReturnValue_t FilestoreRequestTlv::serialize(uint8_t **buffer, size_t *size, siz
|
|||||||
}
|
}
|
||||||
secondFileName->serialize(buffer, size, maxSize, streamEndianness);
|
secondFileName->serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FilestoreRequestTlv::deSerialize(const uint8_t **buffer, size_t *size,
|
ReturnValue_t FilestoreRequestTlv::deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
|
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return deSerializeFromValue(buffer, size, streamEndianness);
|
return deSerializeFromValue(buffer, size, streamEndianness);
|
||||||
@ -63,13 +63,13 @@ ReturnValue_t FilestoreRequestTlv::deSerializeFromValue(const uint8_t **buffer,
|
|||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size -= 1;
|
*size -= 1;
|
||||||
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
|
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (requiresSecondFileName()) {
|
if (requiresSecondFileName()) {
|
||||||
if (secondFileName == nullptr) {
|
if (secondFileName == nullptr) {
|
||||||
secondFileNameMissing();
|
secondFileNameMissing();
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = secondFileName->deSerialize(buffer, size, streamEndianness);
|
result = secondFileName->deSerialize(buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,11 @@ ReturnValue_t FilestoreResponseTlv::serialize(uint8_t **buffer, size_t *size, si
|
|||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
commonSerialize(buffer, size, maxSize, streamEndianness, true, this->statusCode);
|
commonSerialize(buffer, size, maxSize, streamEndianness, true, this->statusCode);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
|
result = firstFileName.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (requiresSecondFileName()) {
|
if (requiresSecondFileName()) {
|
||||||
@ -61,7 +61,7 @@ ReturnValue_t FilestoreResponseTlv::serialize(uint8_t **buffer, size_t *size, si
|
|||||||
ReturnValue_t FilestoreResponseTlv::deSerialize(const uint8_t **buffer, size_t *size,
|
ReturnValue_t FilestoreResponseTlv::deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
|
ReturnValue_t result = commonDeserialize(buffer, size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return deSerializeFromValue(buffer, size, streamEndianness);
|
return deSerializeFromValue(buffer, size, streamEndianness);
|
||||||
@ -75,7 +75,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
|
|||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size -= 1;
|
*size -= 1;
|
||||||
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
|
ReturnValue_t result = firstFileName.deSerialize(buffer, size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (requiresSecondFileName()) {
|
if (requiresSecondFileName()) {
|
||||||
@ -83,7 +83,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
|
|||||||
return cfdp::FILESTORE_REQUIRES_SECOND_FILE;
|
return cfdp::FILESTORE_REQUIRES_SECOND_FILE;
|
||||||
}
|
}
|
||||||
result = secondFileName->deSerialize(buffer, size, streamEndianness);
|
result = secondFileName->deSerialize(buffer, size, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ ReturnValue_t FilestoreResponseTlv::deSerializeFromValue(const uint8_t **buffer,
|
|||||||
*size -= 1;
|
*size -= 1;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
// Ignore empty filestore message
|
// Ignore empty filestore message
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
return filestoreMsg->deSerialize(buffer, size, streamEndianness);
|
return filestoreMsg->deSerialize(buffer, size, streamEndianness);
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,13 @@
|
|||||||
#include <fsfw/cfdp/tlv/Tlv.h>
|
#include <fsfw/cfdp/tlv/Tlv.h>
|
||||||
#include <fsfw/cfdp/tlv/TlvIF.h>
|
#include <fsfw/cfdp/tlv/TlvIF.h>
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
|
||||||
namespace cfdp {
|
namespace cfdp {
|
||||||
|
|
||||||
enum FilestoreActionCode {
|
enum FilestoreActionCode {
|
||||||
@ -70,7 +73,7 @@ class FilestoreTlvBase : public TlvIF {
|
|||||||
Endianness streamEndianness, bool isResponse = false,
|
Endianness streamEndianness, bool isResponse = false,
|
||||||
uint8_t responseStatusCode = 0) const {
|
uint8_t responseStatusCode = 0) const {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (maxSize < 3) {
|
if (maxSize < 3) {
|
||||||
return SerializeIF::BUFFER_TOO_SHORT;
|
return SerializeIF::BUFFER_TOO_SHORT;
|
||||||
@ -87,13 +90,13 @@ class FilestoreTlvBase : public TlvIF {
|
|||||||
}
|
}
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t commonDeserialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t commonDeserialize(const uint8_t** buffer, size_t* size,
|
||||||
SerializeIF::Endianness streamEndianness) {
|
SerializeIF::Endianness streamEndianness) {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*size < 3) {
|
if (*size < 3) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
@ -111,7 +114,7 @@ class FilestoreTlvBase : public TlvIF {
|
|||||||
if (remainingLength == 0) {
|
if (remainingLength == 0) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool requiresSecondFileName() const {
|
bool requiresSecondFileName() const {
|
||||||
@ -149,7 +152,7 @@ class FilestoreTlvBase : public TlvIF {
|
|||||||
size_t serSize = 0;
|
size_t serSize = 0;
|
||||||
uint8_t* valueStart = buffer + 2;
|
uint8_t* valueStart = buffer + 2;
|
||||||
ReturnValue_t result = this->serialize(&buffer, &serSize, maxSize, streamEndianness);
|
ReturnValue_t result = this->serialize(&buffer, &serSize, maxSize, streamEndianness);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
tlv.setValue(valueStart, serSize - 2);
|
tlv.setValue(valueStart, serSize - 2);
|
||||||
|
@ -31,13 +31,13 @@ ReturnValue_t cfdp::Lv::serialize(uint8_t** buffer, size_t* size, size_t maxSize
|
|||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
}
|
}
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (zeroLen) {
|
if (zeroLen) {
|
||||||
**buffer = 0;
|
**buffer = 0;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
return value.serialize(buffer, size, maxSize, streamEndianness);
|
return value.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ size_t cfdp::Lv::getSerializedSize() const {
|
|||||||
ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*size < 1) {
|
if (*size < 1) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
@ -64,7 +64,7 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
|
|||||||
zeroLen = true;
|
zeroLen = true;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size -= 1;
|
*size -= 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else if (*size < lengthField + 1) {
|
} else if (*size < lengthField + 1) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
|
|||||||
value.setBuffer(const_cast<uint8_t*>(*buffer + 1), lengthField);
|
value.setBuffer(const_cast<uint8_t*>(*buffer + 1), lengthField);
|
||||||
*buffer += 1 + lengthField;
|
*buffer += 1 + lengthField;
|
||||||
*size -= 1 + lengthField;
|
*size -= 1 + lengthField;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t* cfdp::Lv::getValue(size_t* size) const {
|
const uint8_t* cfdp::Lv::getValue(size_t* size) const {
|
||||||
|
@ -12,7 +12,7 @@ cfdp::Tlv::Tlv() : value(static_cast<uint8_t *>(nullptr), 0, true) {}
|
|||||||
ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*size + 2 > maxSize) {
|
if (*size + 2 > maxSize) {
|
||||||
return BUFFER_TOO_SHORT;
|
return BUFFER_TOO_SHORT;
|
||||||
@ -28,10 +28,10 @@ ReturnValue_t cfdp::Tlv::serialize(uint8_t **buffer, size_t *size, size_t maxSiz
|
|||||||
**buffer = 0;
|
**buffer = 0;
|
||||||
*size += 1;
|
*size += 1;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
if (value.getConstBuffer() == nullptr) {
|
if (value.getConstBuffer() == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return value.serialize(buffer, size, maxSize, streamEndianness);
|
return value.serialize(buffer, size, maxSize, streamEndianness);
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ size_t cfdp::Tlv::getSerializedSize() const {
|
|||||||
ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*size < 2) {
|
if (*size < 2) {
|
||||||
return STREAM_TOO_SHORT;
|
return STREAM_TOO_SHORT;
|
||||||
@ -68,7 +68,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
zeroLen = true;
|
zeroLen = true;
|
||||||
*buffer += 1;
|
*buffer += 1;
|
||||||
*size -= 1;
|
*size -= 1;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
if (lengthField + 1 > *size) {
|
if (lengthField + 1 > *size) {
|
||||||
return SerializeIF::STREAM_TOO_SHORT;
|
return SerializeIF::STREAM_TOO_SHORT;
|
||||||
@ -78,7 +78,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
|
|||||||
value.setBuffer(const_cast<uint8_t *>(*buffer + 1), lengthField);
|
value.setBuffer(const_cast<uint8_t *>(*buffer + 1), lengthField);
|
||||||
*buffer += 1 + lengthField;
|
*buffer += 1 + lengthField;
|
||||||
*size -= 1 + lengthField;
|
*size -= 1 + lengthField;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); }
|
const uint8_t *cfdp::Tlv::getValue() const { return value.getConstBuffer(); }
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user