Compare commits
349 Commits
Author | SHA1 | Date | |
---|---|---|---|
0a11ca6051 | |||
b305924e11 | |||
863295cd31 | |||
b1a91da844 | |||
397e1433fd | |||
31c84d47fe | |||
8fc144b595 | |||
8693075061 | |||
b128455217 | |||
99c975d0cd | |||
d5205b59c1 | |||
26fbd81d39 | |||
0ccf062d51 | |||
aa71159a9a | |||
e56a30df06 | |||
7b7bd76703 | |||
ee878d9fe9 | |||
0b50d9aedf | |||
4131084973 | |||
b81ff7f8f5 | |||
1284d10257 | |||
af9a9b837a | |||
9a16544836 | |||
dbcf4f5d69 | |||
f9050ab185 | |||
d6e22e7d4d | |||
e1ae1c021a | |||
da45326150 | |||
28040f85cc | |||
652cfa0986 | |||
3a76ee366d | |||
09c602a830 | |||
1d8c4be47a | |||
c4ba578285 | |||
804afa5d96 | |||
26162f8e78 | |||
38903f647b | |||
cd92f4a611 | |||
8f1d521007 | |||
cf9ff87560 | |||
cbb7fdfa99 | |||
487b6fd5ca | |||
87d00dbcee | |||
5cb6ab8416 | |||
4b5f22f013 | |||
48a8a52b1c | |||
8dcd2f0c95 | |||
2cb562cdee | |||
00bafd98fe | |||
536c0cb0fe | |||
0f57fc33c8 | |||
2aa76766af | |||
00711c148a | |||
d0cba24a37 | |||
adb0147ea9 | |||
086d076262 | |||
260082c425 | |||
ad052462c1 | |||
b8b6cd8872 | |||
799e90f617 | |||
8afc6dea11 | |||
8af3a91b5a | |||
bdd5a7dd21 | |||
2630d7fae7 | |||
df5b0a19de | |||
c7d0a9551e | |||
26fa568d72 | |||
39acc24535 | |||
d29b86a0bd | |||
8e6a2a1f02 | |||
43fe7e0aa0 | |||
ca79f370b0 | |||
10f5933c1e | |||
3354f2a696 | |||
c67a7ef1d8 | |||
63ec5d6338 | |||
a66a76609f | |||
9f389fb920 | |||
9dff2e1479 | |||
299136f1a5 | |||
2c65849bc6 | |||
0343372910 | |||
366c475b05 | |||
46e3956bca | |||
6409c596f7 | |||
5779f511cf | |||
63c7903f9b | |||
87495fd3af | |||
38c60f37da | |||
baba8b5cf0 | |||
a4cd99ec90 | |||
e837532b22 | |||
f7c6f16777 | |||
3b3b2ed8c3 | |||
52d0182a52 | |||
405b9e7074 | |||
24c7a4e7e3 | |||
30a57ad5a4 | |||
d78c746552 | |||
773b745c76 | |||
45409fc2d6 | |||
f97d5df75f | |||
49b8232f12 | |||
ac3812f268 | |||
ed6ee02861 | |||
94979e3561 | |||
74e4415d58 | |||
08bc44ce8b | |||
aeb289b758 | |||
56108aed66 | |||
225dcf27ba | |||
146035de5a | |||
cc602ddada | |||
e13db2e6b6 | |||
0f79864446 | |||
01dd2eb92e | |||
89b68940be | |||
c8150dff17 | |||
d8e1e4561d | |||
c1ca43113b | |||
26afe1d94a | |||
90622eb25a | |||
e4e765300d | |||
922c33df57 | |||
23894f9749 | |||
1716034926 | |||
acc1849fbb | |||
d1a25bfa65 | |||
dc0c8c704c | |||
bb58281fba | |||
5b9811a950 | |||
e9849bfedd | |||
6ecd4ec2f3 | |||
333c46bdf8 | |||
23782dc2fa | |||
95b49ca49d | |||
a45d4592c3 | |||
9a84abf77f | |||
5789e2a3b5 | |||
92528c7350 | |||
3acb61959a | |||
ef75d92415 | |||
e821a9700a | |||
d1afdfe578 | |||
24ecfe84ae | |||
42d225bb6c | |||
7c828427e9 | |||
8ddd7b02dc | |||
963e40120f | |||
faee071edc | |||
a6777067da | |||
c1b22af695 | |||
7fc3285272 | |||
19d4349c05 | |||
99a24a9a35 | |||
2b061a2b1c | |||
124abf0213 | |||
2f72b4e42a | |||
e98b985d66 | |||
9efcd90cc0 | |||
aa248b7997 | |||
921e82f6d1 | |||
aa43bd7d75 | |||
be6056aadb | |||
a298fff602 | |||
5204afca9e | |||
1722f14a60 | |||
3a65f1d39f | |||
567199f460 | |||
cfbacd4d80 | |||
95c06d5a09 | |||
dc8879b1af | |||
1962b30e5f | |||
cb330bcf29 | |||
268cd33677 | |||
0ae55e0783 | |||
be43dbd293 | |||
45b78a0100 | |||
fc22f7d86f | |||
0622b78dde | |||
cf355a0451 | |||
337aa39ecc | |||
24b58e50d1 | |||
11c2efa733 | |||
0efaa13a9f | |||
ae08d14626 | |||
681ad25847 | |||
53f6a0d3a6 | |||
4fdcb5d7cd | |||
f3bc2958f9 | |||
d714f84df8 | |||
bda8550ef9 | |||
d604f8d3d1 | |||
e92af98f34 | |||
3b915f4c97 | |||
03510e5de9 | |||
1d714ff85e | |||
b3f2a05385 | |||
ec27521c35 | |||
cd7bc466ae | |||
12dbc5569e | |||
8f124de79c | |||
9fd0009c7b | |||
74dbfae225 | |||
6871cc597a | |||
ce1124472a | |||
6e22c3e017 | |||
f5f8df61ae | |||
4a74a3ac37 | |||
444389a41c | |||
f4ef0cb7ab | |||
f56c8ba1c0 | |||
66f38daf56 | |||
0580784d16 | |||
74dc04daeb | |||
dc3dfa1292 | |||
891ba6881b | |||
02a837c964 | |||
8cdb877df6 | |||
22d7af4b78 | |||
0fecfab2f0 | |||
e05c52be85 | |||
ea56a5d536 | |||
106228c2ee | |||
365fa0adc4 | |||
51dbc95750 | |||
a3eb6b2093 | |||
5045eeb867 | |||
f50b9de4a5 | |||
1c0ea5cbb1 | |||
5a4d287f67 | |||
e186bff4e4 | |||
2fb54f7de9 | |||
f0e282c6e1 | |||
05088ce02c | |||
f64356d75e | |||
7f327c3900 | |||
8104ac0df8 | |||
1cfb9250fa | |||
0315a2a3d5 | |||
0c13c32e82 | |||
2700d4d28c | |||
3a88a43505 | |||
b52aca643f | |||
fcf2e363d8 | |||
acca10cc34 | |||
c431deede0 | |||
15c7493584 | |||
addddb4342 | |||
9790b395e6 | |||
3cc3786505 | |||
59c4ed74e0 | |||
f8f0032d1e | |||
ba51ca58f3 | |||
9de28fdfc9 | |||
aeecf33763 | |||
d6d60249c1 | |||
9edd6fc3be | |||
009234612a | |||
528b3c8610 | |||
fe0a4844aa | |||
4b4cfc09c5 | |||
340ca0618c | |||
0b1b74e879 | |||
72533f1d14 | |||
298a87d349 | |||
926e1e336a | |||
503d5923c4 | |||
8c3d25f62d | |||
d8acf94a02 | |||
940d4965bc | |||
df971d4ec5 | |||
b4447b6d8c | |||
208aeb6640 | |||
bc1d236a85 | |||
34d3479e81 | |||
dba620baf2 | |||
c9da184b7f | |||
ff86c8af73 | |||
983ce045a9 | |||
4fbfbe8bb8 | |||
12be969ca2 | |||
93fa82c413 | |||
6c8336bcfe | |||
af6f24d668 | |||
acaf87095a | |||
afb7a2008f | |||
6361fcb6bb | |||
55727accf5 | |||
59bcf6cec2 | |||
6cd4f6cfe3 | |||
664f8e84b9 | |||
190590e1b5 | |||
125593be21 | |||
4f3a680a07 | |||
f4b67945cc | |||
fc769be789 | |||
b846a936b4 | |||
1e6ea91438 | |||
1a4f907925 | |||
c0b91a4879 | |||
dd61af5bb3 | |||
d511903872 | |||
50ca738d5c | |||
3d39ddf85c | |||
14cd3e9eea | |||
03a601d450 | |||
bd9dbc5fc8 | |||
3824daa865 | |||
6625d562e9 | |||
0abc854567 | |||
2a5cc62af7 | |||
6506baa7b6 | |||
292bfaad16 | |||
f7ac382498 | |||
96c9069a69 | |||
5018b24cfc | |||
261fc8b58f | |||
590d5e11e1 | |||
a2079ffb8c | |||
dc73036c7a | |||
f0dc1279c4 | |||
01a02f896f | |||
7eb57d4027 | |||
9878b8defc | |||
5b99199b6c | |||
eee7ab98cb | |||
4093b2cff2 | |||
3f509ce472 | |||
cffd6af1e1 | |||
2a5f824161 | |||
be6ae6b7ae | |||
10507904e8 | |||
e82ca9e749 | |||
84ce7d22bf | |||
7ff133687e | |||
0ff837baa1 | |||
474054f4d8 | |||
4645b8d35b | |||
4b4b75085c | |||
9b2ab66c0a | |||
0cd814db76 | |||
8c1a5bd9ad | |||
f6d43cdf46 | |||
bbc8a3eeef | |||
07f531a044 | |||
733a89a97a | |||
0e3b67383d | |||
c4616e3633 |
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,19 +1,15 @@
|
||||
/build*
|
||||
|
||||
Debug
|
||||
Debug*
|
||||
Release
|
||||
Release*
|
||||
|
||||
# Eclipse
|
||||
.settings
|
||||
.metadata
|
||||
.project
|
||||
.cproject
|
||||
__pycache__
|
||||
|
||||
.idea
|
||||
|
||||
!misc/eclipse/**/.cproject
|
||||
!misc/eclipse/**/.project
|
||||
|
||||
# Python
|
||||
__pycache__
|
||||
.idea
|
||||
|
||||
generators/*.db
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -15,7 +15,7 @@
|
||||
url = https://github.com/rmspacefish/lwgps.git
|
||||
[submodule "generators/fsfwgen"]
|
||||
path = generators/fsfwgen
|
||||
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-generators.git
|
||||
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
|
||||
[submodule "thirdparty/arcsec_star_tracker"]
|
||||
path = thirdparty/arcsec_star_tracker
|
||||
url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git
|
||||
|
@ -14,11 +14,13 @@ cmake_minimum_required(VERSION 3.13)
|
||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
if(TGT_BSP MATCHES "arm/q7s")
|
||||
option(Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
|
||||
option(EIVE_BUILD_WATCHDOG "Compile the OBSW watchdog insted" OFF)
|
||||
option(BUILD_Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
|
||||
endif()
|
||||
|
||||
option(ADD_ETL_LIB "Add ETL library" ON)
|
||||
option(ADD_JSON_LIB "Add JSON librara" ON)
|
||||
option(ADD_JSON_LIB "Add JSON library" ON)
|
||||
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
|
||||
|
||||
if(NOT FSFW_OSAL)
|
||||
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
||||
@ -32,8 +34,13 @@ endif()
|
||||
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
|
||||
pre_project_config()
|
||||
|
||||
set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME})
|
||||
if(EIVE_BUILD_WATCHDOG)
|
||||
set(PROJECT_NAME_TO_SET eive-watchdog)
|
||||
endif()
|
||||
|
||||
# Project Name
|
||||
project(eive_obsw ASM C CXX)
|
||||
project(${PROJECT_NAME_TO_SET} ASM C CXX)
|
||||
|
||||
################################################################################
|
||||
# Pre-Sources preparation
|
||||
@ -60,6 +67,7 @@ set(MISSION_PATH mission)
|
||||
set(TEST_PATH test/testtasks)
|
||||
set(LINUX_PATH linux)
|
||||
set(COMMON_PATH common)
|
||||
set(WATCHDOG_PATH watchdog)
|
||||
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
||||
|
||||
set(FSFW_HAL_LIB_PATH fsfw_hal)
|
||||
@ -82,24 +90,27 @@ if(TGT_BSP)
|
||||
OR TGT_BSP MATCHES "arm/beagleboneblack"
|
||||
)
|
||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||
if(NOT Q7S_SIMPLE_MODE)
|
||||
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||
set(ADD_LINUX_FILES TRUE)
|
||||
set(ADD_CSP_LIB TRUE)
|
||||
set(FSFW_HAL_ADD_LINUX ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${TGT_BSP} MATCHES "arm/raspberrypi")
|
||||
add_definitions(-DRASPBERRY_PI)
|
||||
if(TGT_BSP MATCHES "arm/raspberrypi")
|
||||
# Used by configure file
|
||||
set(RASPBERRY_PI ON)
|
||||
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
||||
endif()
|
||||
|
||||
if(${TGT_BSP} MATCHES "arm/beagleboneblack")
|
||||
add_definitions(-DBEAGLEBONEBLACK)
|
||||
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
||||
# Used by configure file
|
||||
set(BEAGLEBONEBLACK ON)
|
||||
endif()
|
||||
|
||||
if(${TGT_BSP} MATCHES "arm/q7s")
|
||||
add_definitions(-DXIPHOS_Q7S)
|
||||
if(TGT_BSP MATCHES "arm/q7s")
|
||||
# Used by configure file
|
||||
set(XIPHOS_Q7S ON)
|
||||
endif()
|
||||
else()
|
||||
# Required by FSFW library
|
||||
@ -107,22 +118,23 @@ else()
|
||||
endif()
|
||||
|
||||
# Configuration files
|
||||
if(NOT EIVE_BUILD_WATCHDOG)
|
||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
||||
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
||||
if(${TGT_BSP} MATCHES "arm/q7s")
|
||||
if(TGT_BSP MATCHES "arm/q7s")
|
||||
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
||||
elseif(${TGT_BSP} MATCHES "arm/raspberrypi")
|
||||
elseif(TGT_BSP MATCHES "arm/raspberrypi")
|
||||
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
||||
endif()
|
||||
endif()
|
||||
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
||||
|
||||
# Set common config path for FSFW
|
||||
set(FSFW_ADDITIONAL_INC_PATHS
|
||||
"${COMMON_PATH}/config"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
# Set for lwgps library
|
||||
set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
|
||||
|
||||
################################################################################
|
||||
# Executable and Sources
|
||||
@ -131,26 +143,26 @@ set(LWGPS_CONFIG_PATH "${COMMON_PATH}/config")
|
||||
# Add executable
|
||||
add_executable(${TARGET_NAME})
|
||||
|
||||
if(ADD_CSP_LIB)
|
||||
add_subdirectory(${CSP_LIB_PATH})
|
||||
endif()
|
||||
|
||||
if(ADD_ETL_LIB)
|
||||
add_subdirectory(${ETL_LIB_PATH})
|
||||
endif()
|
||||
|
||||
if(ADD_LINUX_FILES)
|
||||
add_subdirectory(${LINUX_PATH})
|
||||
endif()
|
||||
|
||||
if(ADD_JSON_LIB)
|
||||
add_subdirectory(${LIB_JSON_PATH})
|
||||
endif()
|
||||
|
||||
if(NOT EIVE_BUILD_WATCHDOG)
|
||||
if(ADD_LINUX_FILES)
|
||||
add_subdirectory(${LINUX_PATH})
|
||||
endif()
|
||||
add_subdirectory(${BSP_PATH})
|
||||
add_subdirectory(${COMMON_PATH})
|
||||
if(ADD_CSP_LIB)
|
||||
add_subdirectory(${CSP_LIB_PATH})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT Q7S_SIMPLE_MODE)
|
||||
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
||||
add_subdirectory(${LWGPS_LIB_PATH})
|
||||
add_subdirectory(${FSFW_PATH})
|
||||
add_subdirectory(${MISSION_PATH})
|
||||
@ -158,6 +170,9 @@ if(NOT Q7S_SIMPLE_MODE)
|
||||
add_subdirectory(${ARCSEC_LIB_PATH})
|
||||
endif()
|
||||
|
||||
if(EIVE_BUILD_WATCHDOG)
|
||||
add_subdirectory(${WATCHDOG_PATH})
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Post-Sources preparation
|
||||
@ -165,15 +180,27 @@ endif()
|
||||
|
||||
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux)
|
||||
|
||||
if(NOT Q7S_SIMPLE_MODE)
|
||||
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
||||
# Add libraries for all sources.
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_FSFW_NAME}
|
||||
${LIB_OS_NAME}
|
||||
${LIB_LWGPS_NAME}
|
||||
${LIB_ARCSEC}
|
||||
${LIB_CXX_FS}
|
||||
)
|
||||
|
||||
if(TGT_BSP MATCHES "arm/q7s")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_ARCSEC}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EIVE_BUILD_WATCHDOG)
|
||||
if(ADD_CSP_LIB)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_CSP_NAME}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ADD_ETL_LIB)
|
||||
@ -182,18 +209,16 @@ if(ADD_ETL_LIB)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ADD_CSP_LIB)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_CSP_NAME}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ADD_JSON_LIB)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_JSON_NAME}
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
${LIB_CXX_FS}
|
||||
)
|
||||
|
||||
# Add include paths for all sources.
|
||||
target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
@ -202,6 +227,11 @@ target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${ARCSEC_LIB_PATH}
|
||||
)
|
||||
|
||||
if(TGT_BSP MATCHES "arm/q7s")
|
||||
target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${ARCSEC_LIB_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(WARNING_FLAGS
|
||||
@ -249,11 +279,15 @@ if(NOT CMAKE_SIZE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EIVE_BUILD_WATCHDOG)
|
||||
set(TARGET_STRING "OBSW Watchdog")
|
||||
else()
|
||||
if(TGT_BSP)
|
||||
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
||||
else()
|
||||
set(TARGET_STRING "Target BSP: Hosted")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(CONCAT POST_BUILD_COMMENT
|
||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||
|
202
LICENSE
Normal file
202
LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
13
NOTICE
Normal file
13
NOTICE
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright 2021 Institute of Space Systems (IRS), University of Stuttgart
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
19
automation/Dockerfile-q7s
Normal file
19
automation/Dockerfile-q7s
Normal file
@ -0,0 +1,19 @@
|
||||
FROM ubuntu:focal
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get --yes upgrade
|
||||
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl
|
||||
|
||||
# Q7S root filesystem, required for cross-compilation.
|
||||
RUN mkdir -p /usr/rootfs; \
|
||||
curl https://buggy.irs.uni-stuttgart.de/eive/tools/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
|
||||
| tar -xz -C /usr/rootfs
|
||||
|
||||
# Cross compiler
|
||||
RUN mkdir -p /usr/tools; \
|
||||
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
|
||||
| tar -xz -C /usr/tools
|
||||
|
||||
|
||||
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
||||
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
49
automation/Jenkinsfile
vendored
Normal file
49
automation/Jenkinsfile
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Build Container') {
|
||||
when {
|
||||
changeset "automation/Dockerfile-q7s"
|
||||
branch 'develop'
|
||||
}
|
||||
steps {
|
||||
sh 'docker build -t eive-fsw-build-q7s:gcc8 - < automation/Dockerfile-q7s'
|
||||
|
||||
}
|
||||
}
|
||||
stage('Clean') {
|
||||
when {
|
||||
anyOf {
|
||||
changelog 'cleanCI'
|
||||
changeset '*.cmake'
|
||||
changeset 'CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh 'rm -rf build-q7s-debug'
|
||||
}
|
||||
}
|
||||
stage('Build Q7S') {
|
||||
agent {
|
||||
docker {
|
||||
image 'eive-fsw-build-q7s:gcc8'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir('build-q7s-debug') {
|
||||
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DFSFW_OSAL=linux ..'
|
||||
sh 'cmake --build . -j'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when {
|
||||
tag 'v*.*.*'
|
||||
}
|
||||
steps {
|
||||
sh 'echo Deploying'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,5 +6,3 @@ target_sources(${TARGET_NAME} PUBLIC
|
||||
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(boardconfig)
|
||||
|
||||
|
||||
|
@ -70,15 +70,15 @@ void initmission::initTasks() {
|
||||
}
|
||||
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||
}
|
||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||
}
|
||||
@ -142,8 +142,8 @@ void initmission::initTasks() {
|
||||
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
tmtcBridgeTask->startTask();
|
||||
tmtcPollingTask->startTask();
|
||||
|
||||
pusVerification->startTask();
|
||||
pusEvents->startTask();
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "ObjectFactory.h"
|
||||
|
||||
#include <OBSWConfig.h>
|
||||
#include "OBSWConfig.h"
|
||||
#include <objects/systemObjectList.h>
|
||||
#include <tmtc/apid.h>
|
||||
#include <tmtc/pusIds.h>
|
||||
@ -11,8 +10,13 @@
|
||||
#include <mission/core/GenericFactory.h>
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
|
||||
#include <fsfw/osal/common/UdpTcPollingTask.h>
|
||||
#include <fsfw/osal/common/UdpTmTcBridge.h>
|
||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||
#else
|
||||
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
||||
#include "fsfw/osal/common/TcpTmTcServer.h"
|
||||
#endif
|
||||
|
||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||
|
||||
@ -28,7 +32,7 @@ void Factory::setStaticFrameworkObjectIds(){
|
||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||
|
||||
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
|
||||
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||
// No storage object for now.
|
||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||
|
||||
@ -40,7 +44,18 @@ void ObjectFactory::produce(void* args){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||
sif::info << "Setting up UDP TMTC bridge with listener port " <<
|
||||
UdpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
|
||||
new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||
#else
|
||||
sif::info << "Setting up TCP TMTC bridge with listener port " <<
|
||||
TcpTmTcServer::DEFAULT_SERVER_PORT << std::endl;
|
||||
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||
#endif
|
||||
|
||||
new TestTask(objects::TEST_TASK);
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
namespace pcduSwitches {
|
||||
/* Switches are uint8_t datatype and go from 0 to 255 */
|
||||
enum switcherList {
|
||||
enum SwitcherList {
|
||||
Q7S,
|
||||
PAYLOAD_PCDU_CH1,
|
||||
RW,
|
||||
@ -22,7 +22,7 @@ namespace pcduSwitches {
|
||||
SUS_NOMINAL,
|
||||
SOLAR_CELL_EXP,
|
||||
PLOC,
|
||||
ACS_BORAD_SIDE_A,
|
||||
ACS_BOARD_SIDE_A,
|
||||
NUMBER_OF_SWITCHES
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "InitMission.h"
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
|
||||
#include <OBSWVersion.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef WIN32
|
||||
static const char* COMPILE_PRINTOUT = "Windows";
|
||||
#elif LINUX
|
||||
@ -20,8 +21,9 @@ int main(void)
|
||||
{
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
|
||||
<< SW_SUBVERSION << "." << SW_REVISION << " -- " << std::endl;
|
||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
||||
FSFW_REVISION << "--" << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
initmission::initMission();
|
||||
|
@ -36,6 +36,7 @@ void initmission::initMission() {
|
||||
|
||||
void initmission::initTasks() {
|
||||
TaskFactory* factory = TaskFactory::instance();
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
if(factory == nullptr) {
|
||||
/* Should never happen ! */
|
||||
return;
|
||||
@ -46,11 +47,11 @@ void initmission::initTasks() {
|
||||
void (*missedDeadlineFunc) (void) = nullptr;
|
||||
#endif
|
||||
|
||||
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
ReturnValue_t result = tmTcDistributor->addComponent(
|
||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
@ -66,33 +67,82 @@ void initmission::initTasks() {
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||
}
|
||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||
}
|
||||
|
||||
/* PUS Services */
|
||||
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
||||
std::vector<PeriodicTaskIF*> pusTasks;
|
||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||
|
||||
std::vector<PeriodicTaskIF*> pstTasks;
|
||||
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
std::vector<PeriodicTaskIF*> testTasks;
|
||||
createTestTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||
for(const auto& task: taskVector) {
|
||||
if(task != nullptr) {
|
||||
task->startTask();
|
||||
}
|
||||
else {
|
||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
|
||||
taskStarter(pusTasks, "PUS Tasks");
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
taskStarter(testTasks, "Test Tasks");
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
taskStarter(pstTasks, "PST Tasks");
|
||||
|
||||
#if OBSW_ADD_TEST_PST == 1
|
||||
if(startTestPst) {
|
||||
pstTestTask->startTask();
|
||||
}
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
}
|
||||
|
||||
void initmission::createPusTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*>& taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
taskVec.push_back(pusVerification);
|
||||
|
||||
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||
}
|
||||
taskVec.push_back(pusEvents);
|
||||
|
||||
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -102,8 +152,9 @@ void initmission::initTasks() {
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
taskVec.push_back(pusHighPrio);
|
||||
|
||||
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -121,8 +172,9 @@ void initmission::initTasks() {
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||
}
|
||||
taskVec.push_back(pusMedPrio);
|
||||
|
||||
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -133,24 +185,34 @@ void initmission::initTasks() {
|
||||
initmission::printAddObjectError("INT_ERR_RPRT",
|
||||
objects::INTERNAL_ERROR_REPORTER);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_TEST_PST == 1
|
||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||
result = pst::pstTest(pstTestTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "initmission::initTasks: ACS PST initialization failed!" << std::endl;
|
||||
taskVec.push_back(pusLowPrio);
|
||||
}
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
|
||||
PeriodicTaskIF* testTask = factory->createPeriodicTask(
|
||||
void initmission::createPstTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
||||
missedDeadlineFunc);
|
||||
result = pst::pstSpi(spiPst);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(spiPst);
|
||||
#endif
|
||||
}
|
||||
|
||||
void initmission::createTestTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*> &taskVec) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||
}
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
#if RPI_ADD_SPI_TEST == 1
|
||||
result = testTask->addComponent(objects::SPI_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -170,23 +232,16 @@ void initmission::initTasks() {
|
||||
}
|
||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
|
||||
pusVerification->startTask();
|
||||
pusEvents->startTask();
|
||||
pusHighPrio->startTask();
|
||||
pusMedPrio->startTask();
|
||||
pusLowPrio->startTask();
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
testTask->startTask();
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
bool startTestPst = true;
|
||||
static_cast<void>(startTestPst);
|
||||
#if OBSW_ADD_TEST_PST == 1
|
||||
pstTestTask->startTask();
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||
result = pst::pstTest(pstTestTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
||||
startTestPst = false;
|
||||
}
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,24 @@
|
||||
#ifndef BSP_LINUX_INITMISSION_H_
|
||||
#define BSP_LINUX_INITMISSION_H_
|
||||
|
||||
#include "fsfw/tasks/Typedef.h"
|
||||
#include <vector>
|
||||
|
||||
class PeriodicTaskIF;
|
||||
class TaskFactory;
|
||||
|
||||
namespace initmission {
|
||||
void initMission();
|
||||
void initTasks();
|
||||
|
||||
void createPstTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*> &taskVec);
|
||||
void createTestTasks(TaskFactory& factory,
|
||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*> &taskVec);
|
||||
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec);
|
||||
};
|
||||
|
||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <fsfw/hal/linux/uart/UartComIF.h>
|
||||
#include <fsfw/hal/linux/uart/UartCookie.h>
|
||||
#include <mission/devices/GPSHyperionHandler.h>
|
||||
#include <devConf.h>
|
||||
#include "ObjectFactory.h"
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
@ -9,16 +7,13 @@
|
||||
#include "OBSWConfig.h"
|
||||
#include "tmtc/apid.h"
|
||||
#include "tmtc/pusIds.h"
|
||||
#include "spiConf.h"
|
||||
|
||||
#include "linux/boardtest/LibgpiodTest.h"
|
||||
#include "linux/boardtest/SpiTestClass.h"
|
||||
#include "linux/boardtest/UartTestClass.h"
|
||||
|
||||
#include "mission/core/GenericFactory.h"
|
||||
#include "mission/utility/TmFunnel.h"
|
||||
#include "mission/devices/MGMHandlerLIS3MDL.h"
|
||||
#include "mission/devices/MGMHandlerRM3100.h"
|
||||
#include <mission/devices/GPSHyperionHandler.h>
|
||||
#include "mission/devices/GyroADIS16507Handler.h"
|
||||
|
||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||
@ -28,15 +23,24 @@
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
|
||||
/* UDP server includes */
|
||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
||||
#else
|
||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||
#endif
|
||||
|
||||
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h"
|
||||
#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw/hal/linux/rpi/GpioRPi.h"
|
||||
#include "fsfw/hal/common/gpio/GpioCookie.h"
|
||||
#include "fsfw/hal/linux/spi/SpiCookie.h"
|
||||
#include "fsfw/hal/linux/spi/SpiComIF.h"
|
||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
@ -45,7 +49,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||
|
||||
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
|
||||
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||
// No storage object for now.
|
||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||
|
||||
@ -59,12 +63,126 @@ void ObjectFactory::produce(void* args){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
|
||||
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
tmtcBridge->setMaxNumberOfPacketsStored(50);
|
||||
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||
#else
|
||||
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
tmtcBridge->setMaxNumberOfPacketsStored(50);
|
||||
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||
#endif
|
||||
|
||||
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||
GpioCookie* gpioCookie = nullptr;
|
||||
static_cast<void>(gpioCookie);
|
||||
|
||||
new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
||||
|
||||
std::string spiDev;
|
||||
SpiCookie* spiCookie = nullptr;
|
||||
static_cast<void>(spiCookie);
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
if(gpioCookie == nullptr) {
|
||||
gpioCookie = new GpioCookie();
|
||||
}
|
||||
// TODO: Missing pin for Gyro 2
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
|
||||
"MGM_0_LIS3", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
||||
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
|
||||
"MGM_2_LIS3", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
||||
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
|
||||
"GYRO_1_L3G", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
||||
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN,
|
||||
"GYRO_3_L3G", gpio::Direction::OUT, 1);
|
||||
gpioIF->addGpios(gpioCookie);
|
||||
|
||||
spiDev = "/dev/spidev0.1";
|
||||
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie, 0);
|
||||
mgmLis3Handler->setStartUpImmediately();
|
||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||
mgmLis3Handler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie, 0);
|
||||
mgmRm3100Handler->setStartUpImmediately();
|
||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie, 0);
|
||||
mgmLis3Handler->setStartUpImmediately();
|
||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||
mgmLis3Handler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie, 0);
|
||||
mgmRm3100Handler->setStartUpImmediately();
|
||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie);
|
||||
adisHandler->setStartUpImmediately();
|
||||
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie, 0);
|
||||
gyroL3gHandler->setStartUpImmediately();
|
||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
||||
gyroL3gHandler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie);
|
||||
adisHandler->setStartUpImmediately();
|
||||
|
||||
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
|
||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie, 0);
|
||||
gyroL3gHandler->setStartUpImmediately();
|
||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
||||
gyroL3gHandler->setToGoToNormalMode(true);
|
||||
#endif
|
||||
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
createTestTasks();
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
}
|
||||
|
||||
void ObjectFactory::createTestTasks() {
|
||||
|
||||
new TestTask(objects::TEST_TASK);
|
||||
|
||||
#if RPI_ADD_SPI_TEST == 1
|
||||
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
||||
#endif
|
||||
@ -89,53 +207,6 @@ void ObjectFactory::produce(void* args){
|
||||
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback);
|
||||
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
|
||||
|
||||
new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
||||
|
||||
std::string spiDev;
|
||||
SpiCookie* spiCookie = nullptr;
|
||||
static_cast<void>(spiCookie);
|
||||
|
||||
#if RPI_TEST_ACS_BOARD == 1
|
||||
if(gpioCookie == nullptr) {
|
||||
gpioCookie = new GpioCookie();
|
||||
}
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
|
||||
"MGM_0_LIS3", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
||||
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
|
||||
"MGM_2_LIS3", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
||||
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
|
||||
"GYRO_1_L3G", gpio::Direction::OUT, 1);
|
||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_L3G_CS, gpio::GYRO_2_BCM_PIN,
|
||||
"GYRO_2_L3G", gpio::Direction::OUT, 1);
|
||||
gpioIF->addGpios(gpioCookie);
|
||||
|
||||
spiDev = "/dev/spidev0.0";
|
||||
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie);
|
||||
mgmLis3Handler->setStartUpImmediately();
|
||||
|
||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie);
|
||||
mgmRm3100Handler->setStartUpImmediately();
|
||||
|
||||
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie);
|
||||
gyroL3gHandler->setStartUpImmediately();
|
||||
|
||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||
|
||||
#if RPI_TEST_ADIS16507 == 1
|
||||
if(gpioCookie == nullptr) {
|
||||
gpioCookie = new GpioCookie();
|
||||
@ -144,7 +215,7 @@ void ObjectFactory::produce(void* args){
|
||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||
gpioIF->addGpios(gpioCookie);
|
||||
|
||||
spiDev = "/dev/spidev0.0";
|
||||
spiDev = "/dev/spidev0.1";
|
||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
|
||||
nullptr, nullptr);
|
||||
@ -158,7 +229,7 @@ void ObjectFactory::produce(void* args){
|
||||
uartCookie->setToFlushInput(true);
|
||||
uartCookie->setReadCycles(6);
|
||||
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
|
||||
objects::UART_COM_IF, uartCookie);
|
||||
objects::UART_COM_IF, uartCookie, false);
|
||||
gpsHandler->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
namespace ObjectFactory {
|
||||
void setStatics();
|
||||
void produce(void* args);
|
||||
|
||||
void createTestTasks();
|
||||
};
|
||||
|
||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||
|
@ -15,20 +15,18 @@
|
||||
#define RPI_TEST_ACS_BOARD 0
|
||||
#endif
|
||||
|
||||
#define RPI_ADD_UART_TEST 1
|
||||
#if RPI_ADD_UART_TEST == 1
|
||||
#define RPI_TEST_GPS_DEVICE 0
|
||||
#endif
|
||||
#define RPI_ADD_UART_TEST 0
|
||||
|
||||
/* Adapt these values accordingly */
|
||||
namespace gpio {
|
||||
static constexpr uint8_t MGM_0_BCM_PIN = 0;
|
||||
static constexpr uint8_t MGM_1_BCM_PIN = 1;
|
||||
static constexpr uint8_t MGM_2_BCM_PIN = 17;
|
||||
static constexpr uint8_t MGM_3_BCM_PIN = 27;
|
||||
static constexpr uint8_t MGM_0_BCM_PIN = 17;
|
||||
static constexpr uint8_t MGM_1_BCM_PIN = 27;
|
||||
static constexpr uint8_t MGM_2_BCM_PIN = 22;
|
||||
static constexpr uint8_t MGM_3_BCM_PIN = 23;
|
||||
static constexpr uint8_t GYRO_0_BCM_PIN = 5;
|
||||
static constexpr uint8_t GYRO_1_BCM_PIN = 6;
|
||||
static constexpr uint8_t GYRO_2_BCM_PIN = 4;
|
||||
static constexpr uint8_t GYRO_2_BCM_PIN = 13;
|
||||
static constexpr uint8_t GYRO_3_BCM_PIN = 19;
|
||||
}
|
||||
|
||||
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "InitMission.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
|
@ -12,5 +12,6 @@ else()
|
||||
add_subdirectory(gpio)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(memory)
|
||||
add_subdirectory(spiCallbacks)
|
||||
add_subdirectory(callbacks)
|
||||
add_subdirectory(devices)
|
||||
endif()
|
||||
|
@ -1,35 +0,0 @@
|
||||
FROM ubuntu:latest
|
||||
# FROM alpine:latest
|
||||
|
||||
ENV TZ=Europe/Berlin
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN apt-get update && apt-get install -y curl cmake g++
|
||||
|
||||
# Q7S root filesystem, required for cross-compilation. Use IPv6 for curl
|
||||
RUN mkdir -p /usr/rootfs; \
|
||||
curl -6 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/dnfMy9kGpgynN6J/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz \
|
||||
| tar xvz -C /usr/rootfs
|
||||
# Q7S C++ cross-compiler. Use IPv6 for curl
|
||||
RUN mkdir -p /usr/tools; \
|
||||
curl -6 https://eive-cloud.irs.uni-stuttgart.de/index.php/s/RMsbHydJc6PSqcz/download/gcc-arm-linux-gnueabi.tar.gz \
|
||||
| tar xvz -C /usr/tools
|
||||
|
||||
# RUN apk add cmake make g++
|
||||
|
||||
# Required for cmake build
|
||||
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
||||
ENV PATH=$PATH:"/usr/tools/gcc-arm-linux-gnueabi/bin"
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
COPY . .
|
||||
|
||||
RUN set -ex; \
|
||||
rm -rf build-q7s; \
|
||||
mkdir build-q7s; \
|
||||
cd build-q7s; \
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux -DTGT_BSP="arm/q7s" ..;
|
||||
|
||||
ENTRYPOINT ["cmake", "--build", "build-q7s"]
|
||||
CMD ["-j"]
|
||||
# CMD ["bash"]
|
100
bsp_q7s/boardconfig/busConf.h
Normal file
100
bsp_q7s/boardconfig/busConf.h
Normal file
@ -0,0 +1,100 @@
|
||||
#ifndef BSP_Q7S_BOARDCONFIG_BUSCONF_H_
|
||||
#define BSP_Q7S_BOARDCONFIG_BUSCONF_H_
|
||||
|
||||
namespace q7s {
|
||||
|
||||
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spidev2.0";
|
||||
static constexpr char SPI_RW_DEV[] = "/dev/spidev3.0";
|
||||
|
||||
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
|
||||
|
||||
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3";
|
||||
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4";
|
||||
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL5";
|
||||
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
|
||||
|
||||
static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
|
||||
static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
|
||||
|
||||
/**************************************************************/
|
||||
/** OBC1E */
|
||||
/**************************************************************/
|
||||
static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "/amba_pl/gpio@42020000";
|
||||
static const char* const GPIO_GYRO_ADIS_LABEL = GPIO_MULTIPURPOSE_1V8_OBC1D;
|
||||
static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20
|
||||
static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22
|
||||
|
||||
/**************************************************************/
|
||||
/** OBC1F B0 */
|
||||
/**************************************************************/
|
||||
static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000";
|
||||
static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20;
|
||||
static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0;
|
||||
static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0;
|
||||
static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0;
|
||||
|
||||
|
||||
static constexpr uint32_t GPIO_RW_0_CS = 7; // B20
|
||||
static constexpr uint32_t GPIO_RW_1_CS = 3; // G22
|
||||
static constexpr uint32_t GPIO_RW_2_CS = 11; // E18
|
||||
static constexpr uint32_t GPIO_RW_3_CS = 6; // B19
|
||||
|
||||
static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22
|
||||
static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21
|
||||
static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18
|
||||
static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16
|
||||
static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17
|
||||
|
||||
// Active low enable pin (needs to be driven low for regular operations)
|
||||
static constexpr uint32_t GPIO_GYRO_0_ENABLE = 2; // H22
|
||||
|
||||
// Active low reset pin (needs to be driven high for regular operations)
|
||||
static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22
|
||||
static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21
|
||||
|
||||
static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18
|
||||
|
||||
/**************************************************************/
|
||||
/** OBC1F B1 */
|
||||
/**************************************************************/
|
||||
static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000";
|
||||
// Need to use chip name here for now because the label name is the name for
|
||||
// gpiochip 5 and gpiochip6
|
||||
static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6";
|
||||
static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP;
|
||||
static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18
|
||||
|
||||
/**************************************************************/
|
||||
/** OBC1C */
|
||||
/**************************************************************/
|
||||
static constexpr char GPIO_3V3_OBC1C[] = "/amba_pl/gpio@42040000";
|
||||
static const char* const GPIO_HEATER_LABEL = GPIO_3V3_OBC1C;
|
||||
static const char* const GPIO_SOLAR_ARR_DEPL_LABEL = GPIO_3V3_OBC1C;
|
||||
static constexpr uint32_t GPIO_HEATER_0_PIN = 6;
|
||||
static constexpr uint32_t GPIO_HEATER_1_PIN = 12;
|
||||
static constexpr uint32_t GPIO_HEATER_2_PIN = 7;
|
||||
static constexpr uint32_t GPIO_HEATER_3_PIN = 5;
|
||||
static constexpr uint32_t GPIO_HEATER_4_PIN = 3;
|
||||
static constexpr uint32_t GPIO_HEATER_5_PIN = 0;
|
||||
static constexpr uint32_t GPIO_HEATER_6_PIN = 1;
|
||||
static constexpr uint32_t GPIO_HEATER_7_PIN = 11;
|
||||
static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22
|
||||
|
||||
static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4;
|
||||
static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2;
|
||||
|
||||
static constexpr char GPIO_RW_SPI_MUX_LABEL[] = "zynq_gpio";
|
||||
// Uses EMIO interface to PL, starts at 54
|
||||
static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54;
|
||||
|
||||
static constexpr uint32_t SPI_MUX_BIT_1 = 13;
|
||||
static constexpr uint32_t SPI_MUX_BIT_2 = 14;
|
||||
static constexpr uint32_t SPI_MUX_BIT_3 = 15;
|
||||
static constexpr uint32_t SPI_MUX_BIT_4 = 16;
|
||||
static constexpr uint32_t SPI_MUX_BIT_5 = 17;
|
||||
static constexpr uint32_t SPI_MUX_BIT_6 = 9;
|
||||
static constexpr uint32_t EN_RW_CS = 17;
|
||||
|
||||
}
|
||||
|
||||
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
@ -5,6 +5,17 @@
|
||||
|
||||
#cmakedefine01 Q7S_SIMPLE_MODE
|
||||
|
||||
/*******************************************************************/
|
||||
/** All of the following flags should be enabled for mission code */
|
||||
/*******************************************************************/
|
||||
|
||||
//! Timers can mess up the code when debugging
|
||||
//! All of this should be enabled for mission code!
|
||||
|
||||
/*******************************************************************/
|
||||
/** Other flags */
|
||||
/*******************************************************************/
|
||||
|
||||
#define Q7S_SD_NONE 0
|
||||
#define Q7S_SD_COLD_REDUNDANT 1
|
||||
#define Q7S_SD_HOT_REDUNDANT 2
|
||||
@ -15,16 +26,8 @@
|
||||
// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them
|
||||
#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT
|
||||
|
||||
#define Q7S_ADD_RTD_DEVICES 0
|
||||
|
||||
/* Only one of those 2 should be enabled! */
|
||||
/* Add code for ACS board */
|
||||
#define OBSW_ADD_ACS_BOARD 0
|
||||
#if OBSW_ADD_ACS_BOARD == 0
|
||||
#define Q7S_ADD_SPI_TEST 0
|
||||
#endif
|
||||
|
||||
#define Q7S_ADD_SYRLINKS_HANDLER 1
|
||||
// Probably better if this is disabled for mission code. Convenient for development
|
||||
#define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1
|
||||
|
||||
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
|
||||
|
||||
|
@ -4,6 +4,11 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
enum SdCard {
|
||||
SDC0,
|
||||
SDC1
|
||||
};
|
||||
|
||||
FileSystemTest::FileSystemTest() {
|
||||
using namespace std;
|
||||
SdCard sdCard = SdCard::SDC0;
|
||||
|
@ -1,11 +1,6 @@
|
||||
#ifndef BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
||||
#define BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
||||
|
||||
enum SdCard {
|
||||
SDC0,
|
||||
SDC1
|
||||
};
|
||||
|
||||
class FileSystemTest {
|
||||
public:
|
||||
FileSystemTest();
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <bsp_q7s/core/CoreController.h>
|
||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include "Q7STestTask.h"
|
||||
@ -24,8 +25,9 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||
//testScratchApi();
|
||||
//testJsonLibDirect();
|
||||
//testDummyParams();
|
||||
FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
|
||||
testFileSystemHandlerDirect(opCode);
|
||||
//testProtHandler();
|
||||
//FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
|
||||
//testFileSystemHandlerDirect(opCode);
|
||||
return TestTask::performOneShotAction();
|
||||
}
|
||||
|
||||
@ -131,6 +133,87 @@ void Q7STestTask::testDummyParams() {
|
||||
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
||||
}
|
||||
|
||||
ReturnValue_t Q7STestTask::initialize() {
|
||||
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||
if(coreController == nullptr) {
|
||||
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
|
||||
std::endl;
|
||||
}
|
||||
return TestTask::initialize();
|
||||
}
|
||||
|
||||
void Q7STestTask::testProtHandler() {
|
||||
bool opPerformed = false;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
// If any chips are unlocked, lock them here
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true,
|
||||
opPerformed, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
|
||||
// unlock own copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
|
||||
opPerformed, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
if(not opPerformed) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||
}
|
||||
int retval = std::system("print-chip-prot-status.sh");
|
||||
if(retval != 0) {
|
||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||
}
|
||||
|
||||
// lock own copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
|
||||
opPerformed, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
if(not opPerformed) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||
}
|
||||
retval = std::system("print-chip-prot-status.sh");
|
||||
if(retval != 0) {
|
||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||
}
|
||||
|
||||
// unlock specific copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false,
|
||||
opPerformed, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
if(not opPerformed) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||
}
|
||||
retval = std::system("print-chip-prot-status.sh");
|
||||
if(retval != 0) {
|
||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||
}
|
||||
|
||||
// lock specific copy
|
||||
result = coreController->setBootCopyProtection(
|
||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true,
|
||||
opPerformed, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||
}
|
||||
if(not opPerformed) {
|
||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||
}
|
||||
retval = std::system("print-chip-prot-status.sh");
|
||||
if(retval != 0) {
|
||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||
}
|
||||
}
|
||||
|
||||
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
||||
auto fsHandler = ObjectManager::instance()->
|
||||
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||
|
@ -6,7 +6,10 @@
|
||||
class Q7STestTask: public TestTask {
|
||||
public:
|
||||
Q7STestTask(object_id_t objectId);
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
private:
|
||||
CoreController* coreController = nullptr;
|
||||
ReturnValue_t performOneShotAction() override;
|
||||
|
||||
void testSdCard();
|
||||
@ -15,6 +18,7 @@ private:
|
||||
void testScratchApi();
|
||||
void testJsonLibDirect();
|
||||
void testDummyParams();
|
||||
void testProtHandler();
|
||||
|
||||
enum FsOpCodes {
|
||||
CREATE_EMPTY_FILE_IN_TMP,
|
||||
|
@ -1,3 +1,4 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
rwSpiCallback.cpp
|
||||
gnssCallback.cpp
|
||||
)
|
26
bsp_q7s/callbacks/gnssCallback.cpp
Normal file
26
bsp_q7s/callbacks/gnssCallback.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "gnssCallback.h"
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
|
||||
ReturnValue_t gps::triggerGpioResetPin(void *args) {
|
||||
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
||||
if(args == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if (resetArgs->gpioComIF == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
gpioId_t gpioId;
|
||||
if(resetArgs->gnss1) {
|
||||
gpioId = gpioIds::GNSS_1_NRESET;
|
||||
|
||||
}
|
||||
else {
|
||||
gpioId = gpioIds::GNSS_0_NRESET;
|
||||
}
|
||||
resetArgs->gpioComIF->pullLow(gpioId);
|
||||
TaskFactory::delayTask(resetArgs->waitPeriodMs);
|
||||
resetArgs->gpioComIF->pullHigh(gpioId);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
19
bsp_q7s/callbacks/gnssCallback.h
Normal file
19
bsp_q7s/callbacks/gnssCallback.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||
|
||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
struct ResetArgs {
|
||||
bool gnss1 = false;
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
uint32_t waitPeriodMs = 100;
|
||||
};
|
||||
|
||||
namespace gps {
|
||||
|
||||
ReturnValue_t triggerGpioResetPin(void* args);
|
||||
|
||||
}
|
||||
|
||||
#endif /* BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_ */
|
@ -1,9 +1,10 @@
|
||||
#include <bsp_q7s/spiCallbacks/rwSpiCallback.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <mission/devices/RwHandler.h>
|
||||
#include <fsfw/hal/linux/spi/SpiCookie.h>
|
||||
#include <fsfw/hal/linux/UnixFileGuard.h>
|
||||
#include "rwSpiCallback.h"
|
||||
#include "devices/gpioIds.h"
|
||||
#include "mission/devices/RwHandler.h"
|
||||
|
||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
namespace rwSpiCallback {
|
||||
|
||||
@ -24,7 +25,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
||||
|
||||
int fileDescriptor = 0;
|
||||
std::string device = cookie->getSpiDevice();
|
||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback: ");
|
||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
||||
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
|
||||
return SpiComIF::OPENING_FILE_FAILED;
|
||||
@ -211,7 +212,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
||||
result = HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
cookie->assignTransferSize(decodedFrameLen);
|
||||
cookie->setTransferSize(decodedFrameLen);
|
||||
|
||||
closeSpi(gpioId, gpioIF, mutex);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/hal/linux/spi/SpiComIF.h>
|
||||
#include <fsfw/hal/common/gpio/GpioCookie.h>
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||
|
||||
|
||||
namespace rwSpiCallback {
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,51 @@
|
||||
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
|
||||
#include "events/subsystemIdRanges.h"
|
||||
|
||||
|
||||
class Timer;
|
||||
class SdCardManager;
|
||||
|
||||
class CoreController: public ExtendedControllerBase {
|
||||
public:
|
||||
enum Chip: uint8_t {
|
||||
CHIP_0,
|
||||
CHIP_1,
|
||||
NO_CHIP,
|
||||
SELF_CHIP,
|
||||
ALL_CHIP
|
||||
};
|
||||
|
||||
enum Copy: uint8_t {
|
||||
COPY_0,
|
||||
COPY_1,
|
||||
NO_COPY,
|
||||
SELF_COPY,
|
||||
ALL_COPY
|
||||
};
|
||||
|
||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||
static constexpr char VERSION_FILE[] = "/conf/sd_status";
|
||||
|
||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||
|
||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
|
||||
|
||||
CoreController(object_id_t objectId);
|
||||
virtual~ CoreController();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
@ -26,24 +57,128 @@ public:
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
void performControlOperation() override;
|
||||
|
||||
/**
|
||||
* Generate a file containing the chip lock/unlock states inside /tmp/chip_prot_status.txt
|
||||
* @return
|
||||
*/
|
||||
static ReturnValue_t generateChipStateFile();
|
||||
static ReturnValue_t incrementAllocationFailureCount();
|
||||
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
||||
|
||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||
|
||||
/**
|
||||
* Checks whether the target chip and copy are write protected and protect set them to a target
|
||||
* state where applicable.
|
||||
* @param targetChip
|
||||
* @param targetCopy
|
||||
* @param protect Target state
|
||||
* @param protOperationPerformed [out] Can be used to determine whether any operation
|
||||
* was performed
|
||||
* @param updateProtFile Specify whether the protection info file is updated
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy,
|
||||
bool protect, bool& protOperationPerformed, bool updateProtFile = true);
|
||||
|
||||
bool sdInitFinished() const;
|
||||
|
||||
private:
|
||||
static Chip CURRENT_CHIP;
|
||||
static Copy CURRENT_COPY;
|
||||
|
||||
// Designated value for rechecking FIFO open
|
||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||
int watchdogFifoFd = 0;
|
||||
|
||||
// States for SD state machine, which is used in non-blocking mode
|
||||
enum class SdStates {
|
||||
NONE,
|
||||
START,
|
||||
GET_INFO,
|
||||
SET_STATE_SELF,
|
||||
MOUNT_SELF,
|
||||
// Determine operations for other SD card, depending on redundancy configuration
|
||||
DETERMINE_OTHER,
|
||||
SET_STATE_OTHER,
|
||||
// Mount or unmount other
|
||||
MOUNT_UNMOUNT_OTHER,
|
||||
// Skip period because the shell command used to generate the info file sometimes is
|
||||
// missing the last performed operation if executed too early
|
||||
SKIP_CYCLE_BEFORE_INFO_UPDATE,
|
||||
UPDATE_INFO,
|
||||
// SD initialization done
|
||||
IDLE,
|
||||
// Used if SD switches or mount commands are issued via telecommand
|
||||
SET_STATE_FROM_COMMAND,
|
||||
};
|
||||
static constexpr bool BLOCKING_SD_INIT = false;
|
||||
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
|
||||
struct SdInfo {
|
||||
sd::SdCard pref = sd::SdCard::NONE;
|
||||
sd::SdState prefState = sd::SdState::OFF;
|
||||
sd::SdCard other = sd::SdCard::NONE;
|
||||
sd::SdState otherState = sd::SdState::OFF;
|
||||
std::string prefChar = "0";
|
||||
std::string otherChar = "1";
|
||||
SdStates state = SdStates::START;
|
||||
// Used to track whether a command was executed
|
||||
bool commandExecuted = true;
|
||||
bool initFinished = false;
|
||||
SdCardManager::SdStatePair currentState;
|
||||
uint16_t cycleCount = 0;
|
||||
// These two flags are related to external commanding
|
||||
bool commandIssued = false;
|
||||
bool commandFinished = false;
|
||||
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
||||
sd::SdCard commandedCard = sd::SdCard::NONE;
|
||||
sd::SdState commandedState = sd::SdState::OFF;
|
||||
};
|
||||
SdInfo sdInfo;
|
||||
|
||||
/**
|
||||
* Index 0: Chip 0 Copy 0
|
||||
* Index 1: Chip 0 Copy 1
|
||||
* Index 2: Chip 1 Copy 0
|
||||
* Index 3: Chip 1 Copy 1
|
||||
*/
|
||||
std::array<bool, 4> protArray;
|
||||
PeriodicOperationDivider opDivider;
|
||||
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode);
|
||||
|
||||
ReturnValue_t sdCardInit();
|
||||
ReturnValue_t sdCardSetup(SdCardManager& sdcMan, SdCardManager::SdStatusPair& statusPair,
|
||||
sd::SdCard sdCard, sd::SdStatus status, std::string sdString);
|
||||
ReturnValue_t sdCardColdRedundantInit(SdCardManager* sdcMan,
|
||||
SdCardManager::SdStatusPair& statusPair);
|
||||
ReturnValue_t initVersionFile();
|
||||
ReturnValue_t initBootCopy();
|
||||
ReturnValue_t initWatchdogFifo();
|
||||
ReturnValue_t initSdCardBlocking();
|
||||
void initPrint();
|
||||
|
||||
ReturnValue_t versionFileInit();
|
||||
ReturnValue_t sdStateMachine();
|
||||
void updateSdInfoOther();
|
||||
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
||||
bool printOutput = true);
|
||||
ReturnValue_t sdColdRedundantBlockingInit();
|
||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||
void determinePreferredSdCard();
|
||||
void executeNextExternalSdCommand();
|
||||
void checkExternalSdCommandStatus();
|
||||
|
||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size);
|
||||
ReturnValue_t actionPerformReboot(const uint8_t *data, size_t size);
|
||||
|
||||
void performWatchdogControlOperation();
|
||||
|
||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
|
||||
bool allCopies, uint8_t arrIdx);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||
|
@ -57,13 +57,14 @@ void initmission::initTasks() {
|
||||
void (*missedDeadlineFunc) (void) = nullptr;
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||
@ -82,19 +83,20 @@ void initmission::initTasks() {
|
||||
}
|
||||
|
||||
/* UDP bridge */
|
||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("UDP_BRIDGE", objects::UDP_BRIDGE);
|
||||
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
|
||||
}
|
||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("UDP_POLLING", objects::UDP_POLLING_TASK);
|
||||
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||
}
|
||||
|
||||
# if BOARD_TE0720 == 0
|
||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||
// because it is a non-essential background task
|
||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||
@ -103,8 +105,9 @@ void initmission::initTasks() {
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||
}
|
||||
#endif /* BOARD_TE0720 */
|
||||
|
||||
#if TEST_CCSDS_BRIDGE == 1
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
||||
@ -117,8 +120,11 @@ void initmission::initTasks() {
|
||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||
std::vector<PeriodicTaskIF*> pstTasks;
|
||||
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
std::vector<PeriodicTaskIF*> testTasks;
|
||||
createTestTasks(*factory, missedDeadlineFunc, testTasks);
|
||||
#endif
|
||||
|
||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||
for(const auto& task: taskVector) {
|
||||
@ -133,9 +139,11 @@ void initmission::initTasks() {
|
||||
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
tmtcBridgeTask->startTask();
|
||||
tmtcPollingTask->startTask();
|
||||
#if BOARD_TE0720 == 0
|
||||
coreController->startTask();
|
||||
#endif
|
||||
|
||||
taskStarter(pstTasks, "PST task vector");
|
||||
taskStarter(pusTasks, "PUS task vector");
|
||||
@ -143,10 +151,13 @@ void initmission::initTasks() {
|
||||
taskStarter(testTasks, "Test task vector");
|
||||
#endif
|
||||
|
||||
#if TEST_CCSDS_BRIDGE == 1
|
||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||
ptmeTestTask->startTask();
|
||||
#endif
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
fsTask->startTask();
|
||||
#endif
|
||||
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
}
|
||||
@ -156,7 +167,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
#if BOARD_TE0720 == 0
|
||||
/* Polling Sequence Table Default */
|
||||
#if Q7S_ADD_SPI_TEST == 0
|
||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
||||
missedDeadlineFunc);
|
||||
@ -194,9 +205,9 @@ void initmission::createPstTasks(TaskFactory& factory,
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||
}
|
||||
taskVec.push_back(i2cPst);
|
||||
taskVec.push_back(gomSpacePstTask);
|
||||
#else /* BOARD_TE7020 == 0 */
|
||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
|
||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
||||
missedDeadlineFunc);
|
||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||
@ -278,25 +289,29 @@ void initmission::createPusTasks(TaskFactory &factory,
|
||||
|
||||
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
#endif
|
||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||
#if OBSW_ADD_TEST_TASK == 1
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||
}
|
||||
#endif /* OBSW_ADD_TEST_TASK == 1 */
|
||||
|
||||
#if Q7S_ADD_SPI_TEST == 1
|
||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||
result = testTask->addComponent(objects::SPI_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||
}
|
||||
#endif
|
||||
#if BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1
|
||||
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||
}
|
||||
#endif /* BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1 */
|
||||
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
||||
taskVec.push_back(testTask);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,24 +2,27 @@
|
||||
#define BSP_Q7S_OBJECTFACTORY_H_
|
||||
|
||||
class LinuxLibgpioIF;
|
||||
class UartComIF;
|
||||
class SpiComIF;
|
||||
|
||||
namespace ObjectFactory {
|
||||
|
||||
void setStatics();
|
||||
void produce(void* args);
|
||||
|
||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF);
|
||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
||||
SpiComIF** spiComIF);
|
||||
void createTmpComponents();
|
||||
void createPcduComponents();
|
||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
|
||||
void createHeaterComponents();
|
||||
void createSolarArrayDeploymentComponents();
|
||||
void createSyrlinksComponents();
|
||||
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createTestComponents();
|
||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,11 +2,15 @@
|
||||
#include "OBSWVersion.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "InitMission.h"
|
||||
#include "watchdogConf.h"
|
||||
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
static int OBSW_ALREADY_RUNNING = -2;
|
||||
|
||||
int obsw::obsw() {
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
@ -15,11 +19,20 @@ int obsw::obsw() {
|
||||
#else
|
||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||
#endif
|
||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
||||
FSFW_REVISION << "--" << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
||||
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||
// or systemd service!
|
||||
if(std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||
sif::warning << "File " << watchdog::RUNNING_FILE_NAME << " exists so the software might "
|
||||
"already be running. Aborting.." << std::endl;
|
||||
return OBSW_ALREADY_RUNNING;
|
||||
}
|
||||
#endif
|
||||
initmission::initMission();
|
||||
|
||||
for(;;) {
|
||||
|
5
bsp_q7s/devices/CMakeLists.txt
Normal file
5
bsp_q7s/devices/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
PlocSupervisorHandler.cpp
|
||||
PlocUpdater.cpp
|
||||
PlocMemoryDumper.cpp
|
||||
)
|
206
bsp_q7s/devices/PlocMemoryDumper.cpp
Normal file
206
bsp_q7s/devices/PlocMemoryDumper.cpp
Normal file
@ -0,0 +1,206 @@
|
||||
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "PlocMemoryDumper.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId) :
|
||||
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||
}
|
||||
|
||||
PlocMemoryDumper::~PlocMemoryDumper() {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMemoryDumper::initialize() {
|
||||
|
||||
ReturnValue_t result = SystemObject::initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = commandActionHelper.initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = actionHelper.initialize(commandQueue);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
||||
readCommandQueue();
|
||||
doStateMachine();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
||||
|
||||
if (state != State::IDLE) {
|
||||
return IS_BUSY;
|
||||
}
|
||||
|
||||
switch (actionId) {
|
||||
case DUMP_MRAM: {
|
||||
size_t deserializeSize = sizeof(mram.startAddress) + sizeof(mram.endAddress);
|
||||
SerializeAdapter::deSerialize(&mram.startAddress, &data, &deserializeSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
SerializeAdapter::deSerialize(&mram.endAddress, &data, &deserializeSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (mram.endAddress > MAX_MRAM_ADDRESS) {
|
||||
return MRAM_ADDRESS_TOO_HIGH;
|
||||
}
|
||||
if (mram.endAddress <= mram.startAddress) {
|
||||
return MRAM_INVALID_ADDRESS_COMBINATION;
|
||||
}
|
||||
state = State::COMMAND_FIRST_MRAM_DUMP;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
sif::warning << "PlocMemoryDumper::executeAction: Received command with invalid action id"
|
||||
<< std::endl;
|
||||
return INVALID_ACTION_ID;
|
||||
}
|
||||
}
|
||||
|
||||
return EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() {
|
||||
return commandQueue;
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::readCommandQueue() {
|
||||
CommandMessage message;
|
||||
ReturnValue_t result;
|
||||
|
||||
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
|
||||
result = commandQueue->receiveMessage(&message)) {
|
||||
if (result != RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
result = actionHelper.handleActionMessage(&message);
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result = commandActionHelper.handleReply(&message);
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sif::debug << "PlocMemoryDumper::readCommandQueue: Received message with invalid format"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::doStateMachine() {
|
||||
switch (state) {
|
||||
case State::IDLE:
|
||||
break;
|
||||
case State::COMMAND_FIRST_MRAM_DUMP:
|
||||
commandNextMramDump(PLOC_SPV::FIRST_MRAM_DUMP);
|
||||
break;
|
||||
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
||||
commandNextMramDump(PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
|
||||
break;
|
||||
case State::EXECUTING_MRAM_DUMP:
|
||||
break;
|
||||
default:
|
||||
sif::debug << "PlocMemoryDumper::doStateMachine: Invalid state" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId,
|
||||
uint8_t step) {
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) {
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
||||
switch (pendingCommand) {
|
||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||
if (mram.endAddress == mram.startAddress) {
|
||||
triggerEvent(MRAM_DUMP_FINISHED);
|
||||
state = State::IDLE;
|
||||
}
|
||||
else {
|
||||
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sif::debug << "PlocMemoryDumper::completionSuccessfulReceived: Invalid pending command"
|
||||
<< std::endl;
|
||||
state = State::IDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId,
|
||||
ReturnValue_t returnCode) {
|
||||
switch(pendingCommand) {
|
||||
case(PLOC_SPV::FIRST_MRAM_DUMP):
|
||||
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
||||
break;
|
||||
default:
|
||||
sif::debug << "PlocMemoryDumper::completionFailedReceived: Invalid pending command "
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
state = State::IDLE;
|
||||
}
|
||||
|
||||
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
uint32_t tempStartAddress = 0;
|
||||
uint32_t tempEndAddress = 0;
|
||||
|
||||
if (mram.endAddress - mram.startAddress > MAX_MRAM_DUMP_SIZE) {
|
||||
tempStartAddress = mram.startAddress;
|
||||
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
||||
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
||||
mram.lastStartAddress = tempStartAddress;
|
||||
}
|
||||
else {
|
||||
tempStartAddress = mram.startAddress;
|
||||
tempEndAddress = mram.endAddress;
|
||||
mram.startAddress = mram.endAddress;
|
||||
}
|
||||
|
||||
MemoryParams params(tempStartAddress, tempEndAddress);
|
||||
|
||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
dumpCommand, ¶ms);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
||||
<< "with start address " << tempStartAddress << " and end address "
|
||||
<< tempEndAddress << std::endl;
|
||||
triggerEvent(SEND_MRAM_DUMP_FAILED, result, tempStartAddress);
|
||||
state = State::IDLE;
|
||||
pendingCommand = NONE;
|
||||
return;
|
||||
}
|
||||
state = State::EXECUTING_MRAM_DUMP;
|
||||
pendingCommand = dumpCommand;
|
||||
return;
|
||||
}
|
||||
|
115
bsp_q7s/devices/PlocMemoryDumper.h
Normal file
115
bsp_q7s/devices/PlocMemoryDumper.h
Normal file
@ -0,0 +1,115 @@
|
||||
#ifndef MISSION_DEVICES_PLOCMEMORYDUMPER_H_
|
||||
#define MISSION_DEVICES_PLOCMEMORYDUMPER_H_
|
||||
|
||||
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
||||
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/action/CommandActionHelper.h"
|
||||
#include "fsfw/action/ActionHelper.h"
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/action/CommandsActionsIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
|
||||
* created to perform large dumps of PLOC memories.
|
||||
*
|
||||
* @details Currently the PLOC supervisor only implements the functionality to dump the MRAM.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class PlocMemoryDumper : public SystemObject,
|
||||
public HasActionsIF,
|
||||
public ExecutableObjectIF,
|
||||
public HasReturnvaluesIF,
|
||||
public CommandsActionsIF {
|
||||
public:
|
||||
|
||||
static const ActionId_t NONE = 0;
|
||||
static const ActionId_t DUMP_MRAM = 1;
|
||||
|
||||
PlocMemoryDumper(object_id_t objectId);
|
||||
virtual ~PlocMemoryDumper();
|
||||
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
MessageQueueId_t getCommandQueue() const;
|
||||
ReturnValue_t initialize() override;
|
||||
MessageQueueIF* getCommandQueuePtr() override;
|
||||
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint32_t QUEUE_SIZE = 10;
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.
|
||||
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
|
||||
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
||||
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MEMORY_DUMPER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Failed to send mram dump command to supervisor handler
|
||||
//! P1: Return value of commandAction function
|
||||
//! P2: Start address of MRAM to dump with this command
|
||||
static const Event SEND_MRAM_DUMP_FAILED = MAKE_EVENT(0, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Received completion failure report form PLOC supervisor handler
|
||||
//! P1: MRAM start address of failing dump command
|
||||
static const Event MRAM_DUMP_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] MRAM dump finished successfully
|
||||
static const Event MRAM_DUMP_FINISHED = MAKE_EVENT(2, severity::LOW);
|
||||
|
||||
// Maximum size of mram dump which can be retrieved with one command
|
||||
static const uint32_t MAX_MRAM_DUMP_SIZE = 100000;
|
||||
static const uint32_t MAX_MRAM_ADDRESS = 0x7d000;
|
||||
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
CommandActionHelper commandActionHelper;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
|
||||
enum class State: uint8_t {
|
||||
IDLE,
|
||||
COMMAND_FIRST_MRAM_DUMP,
|
||||
COMMAND_CONSECUTIVE_MRAM_DUMP,
|
||||
EXECUTING_MRAM_DUMP
|
||||
};
|
||||
|
||||
State state = State::IDLE;
|
||||
|
||||
ActionId_t pendingCommand = NONE;
|
||||
|
||||
typedef struct MemoryInfo {
|
||||
// Stores the start address of the next memory range to dump
|
||||
uint32_t startAddress;
|
||||
uint32_t endAddress;
|
||||
// Stores the start address of the last sent dump command
|
||||
uint32_t lastStartAddress;
|
||||
} MemoryInfo_t;
|
||||
|
||||
MemoryInfo_t mram = {0, 0, 0};
|
||||
|
||||
void readCommandQueue();
|
||||
void doStateMachine();
|
||||
|
||||
/**
|
||||
* @brief Sends the next mram dump command to the PLOC supervisor handler.
|
||||
*/
|
||||
void commandNextMramDump(ActionId_t dumpCommand);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PLOCMEMORYDUMPER_H_ */
|
1530
bsp_q7s/devices/PlocSupervisorHandler.cpp
Normal file
1530
bsp_q7s/devices/PlocSupervisorHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,11 @@
|
||||
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||
|
||||
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
#include <bsp_q7s/memory/SdCardManager.h>
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <mission/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||
#include <cstring>
|
||||
#include <fsfw/hal/linux/uart/UartComIF.h>
|
||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||
@ -63,10 +64,30 @@ private:
|
||||
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
||||
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
||||
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0 for PS, 1 for PL and 2 for INT
|
||||
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
||||
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid timeouts must be in the range between 1000 and 360000 ms.
|
||||
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
|
||||
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
||||
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
|
||||
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be larger than 21.
|
||||
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
|
||||
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1 and 2.
|
||||
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
|
||||
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
||||
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
|
||||
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe commands are invalid (e.g. start address bigger than stop address)
|
||||
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
|
||||
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with other apid.
|
||||
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
|
||||
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
||||
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
|
||||
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have been created with the reception of the first dump packet.
|
||||
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] PLOC supervrisor crc failure in telemetry packet
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor crc failure in telemetry packet
|
||||
static const Event SUPV_MEMORY_READ_RPT_CRC_FAILURE = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] PLOC supervisor received acknowledgment failure report
|
||||
static const Event SUPV_ACK_FAILURE = MAKE_EVENT(2, severity::LOW);
|
||||
@ -80,18 +101,6 @@ private:
|
||||
|
||||
uint8_t commandBuffer[PLOC_SPV::MAX_COMMAND_SIZE];
|
||||
|
||||
/**
|
||||
* @brief This object is incremented each time a packet is sent or received. By checking the
|
||||
* packet sequence count of a received packet, no packets can be lost without noticing
|
||||
* it. Only the least significant 14 bits represent the packet sequence count in a
|
||||
* space packet. Thus the maximum value amounts to 16383 (0x3FFF).
|
||||
* @note Normally this should never happen because the PLOC replies are always sent in a
|
||||
* fixed order. However, the PLOC software checks this value and will return an ACK
|
||||
* failure report in case the sequence count is not incremented with each transferred
|
||||
* space packet.
|
||||
*/
|
||||
uint16_t packetSequenceCount = 0x3FFF;
|
||||
|
||||
/**
|
||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||
* because the PLOC sends as reply to each command at least one acknowledgment and execution
|
||||
@ -99,10 +108,34 @@ private:
|
||||
*/
|
||||
DeviceCommandId_t nextReplyId = PLOC_SPV::NONE;
|
||||
|
||||
PLOC_SPV::HkSet hkset;
|
||||
|
||||
UartComIF* uartComIf = nullptr;
|
||||
|
||||
PLOC_SPV::HkSet hkset;
|
||||
PLOC_SPV::BootStatusReport bootStatusReport;
|
||||
PLOC_SPV::LatchupStatusReport latchupStatusReport;
|
||||
|
||||
/** Number of expected replies following the MRAM dump command */
|
||||
uint32_t expectedMramDumpPackets = 0;
|
||||
uint32_t receivedMramDumpPackets = 0;
|
||||
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
|
||||
bool packetInBuffer = false;
|
||||
/** Points to the next free position in the space packet buffer */
|
||||
uint16_t bufferTop = 0;
|
||||
|
||||
/** This buffer is used to concatenate space packets received in two different read steps */
|
||||
uint8_t spacePacketBuffer[PLOC_SPV::MAX_PACKET_SIZE];
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
|
||||
/** Path to PLOC specific files on SD card */
|
||||
std::string plocFilePath = "ploc";
|
||||
std::string activeMramFile;
|
||||
|
||||
/** Setting this variable to true will enable direct downlink of MRAM packets */
|
||||
bool downlinkMramDump = false;
|
||||
|
||||
/**
|
||||
* @brief This function checks the crc of the received PLOC reply.
|
||||
*
|
||||
@ -141,6 +174,14 @@ private:
|
||||
*/
|
||||
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief This function calls the function to check the CRC of the received boot status report
|
||||
* and fills the associated dataset with the boot status information.
|
||||
*/
|
||||
ReturnValue_t handleBootStatusReport(const uint8_t* data);
|
||||
|
||||
ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
|
||||
|
||||
/**
|
||||
* @brief Depending on the current active command, this function sets the reply id of the
|
||||
* next reply after a successful acknowledgment report has been received. This is
|
||||
@ -165,7 +206,6 @@ private:
|
||||
*/
|
||||
void prepareEmptyCmd(uint16_t apid);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
||||
*/
|
||||
@ -187,6 +227,43 @@ private:
|
||||
|
||||
void prepareRestartTriesCmd(const uint8_t * commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to enable or disable the
|
||||
* watchdogs on the PLOC.
|
||||
*/
|
||||
void prepareWatchdogsEnableCmd(const uint8_t * commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to set the watchdog timer
|
||||
* of one of the three watchdogs (PS, PL, INT).
|
||||
*/
|
||||
ReturnValue_t prepareWatchdogsConfigTimeoutCmd(const uint8_t * commandData);
|
||||
|
||||
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
|
||||
DeviceCommandId_t deviceCommand);
|
||||
ReturnValue_t prepareAutoCalibrateAlertCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAlertIrqFilterCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareSetAdcSweetPeriodCmd(const uint8_t* commandData);
|
||||
void prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
|
||||
void prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
|
||||
void prepareSetAdcThresholdCmd(const uint8_t* commandData);
|
||||
void prepareEnableNvmsCmd(const uint8_t* commandData);
|
||||
void prepareSelectNvmCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
|
||||
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
|
||||
ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
|
||||
void preparePrintCpuStatsCmd(const uint8_t* commandData);
|
||||
void prepareSetDbgVerbosityCmd(const uint8_t* commandData);
|
||||
void prepareSetGpioCmd(const uint8_t* commandData);
|
||||
void prepareReadGpioCmd(const uint8_t* commandData);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Copies the content of a space packet to the command buffer.
|
||||
*/
|
||||
void packetToOutBuffer(uint8_t* packetData, size_t fullSize);
|
||||
|
||||
/**
|
||||
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||
* all previously enabled commands and resets the exepected replies variable of an
|
||||
@ -208,6 +285,58 @@ private:
|
||||
* the variable expectedReplies of an active command will be set to 0.
|
||||
*/
|
||||
void disableExeReportReply();
|
||||
|
||||
/**
|
||||
* @brief Function is called in scanForReply and fills the spacePacketBuffer with the read
|
||||
* data until a full packet has been received.
|
||||
*/
|
||||
ReturnValue_t parseMramPackets(const uint8_t *packet, size_t remainingSize, size_t* foundlen);
|
||||
|
||||
/**
|
||||
* @brief This function generates the Service 8 packets for the MRAM dump data.
|
||||
*/
|
||||
ReturnValue_t handleMramDumpPacket(DeviceCommandId_t id);
|
||||
|
||||
/**
|
||||
* @brief With this function the number of expected replies following an MRAM dump command
|
||||
* will be increased. This is necessary to release the command in case not all replies
|
||||
* have been received.
|
||||
*/
|
||||
void increaseExpectedMramReplies(DeviceCommandId_t id);
|
||||
|
||||
/**
|
||||
* @brief Function checks if the packet written to the space packet buffer is really a
|
||||
* MRAM dump packet.
|
||||
*/
|
||||
ReturnValue_t checkMramPacketApid();
|
||||
|
||||
/**
|
||||
* @brief Writes the data of the MRAM dump to a file. The file will be created when receiving
|
||||
* the first packet.
|
||||
*/
|
||||
ReturnValue_t handleMramDumpFile(DeviceCommandId_t id);
|
||||
|
||||
/**
|
||||
* @brief Extracts the length field of a spacePacket referenced by the spacePacket pointer.
|
||||
*
|
||||
* @param spacePacket Pointer to the buffer holding the space packet.
|
||||
*
|
||||
* @return The value stored in the length field of the data field.
|
||||
*/
|
||||
uint16_t readSpacePacketLength(uint8_t* spacePacket);
|
||||
|
||||
/**
|
||||
* @brief Extracts the sequence flags from a space packet referenced by the spacePacket
|
||||
* pointer.
|
||||
*
|
||||
* @param spacePacket Pointer to the buffer holding the space packet.
|
||||
*
|
||||
* @return uint8_t where the two least significant bits hold the sequence flags.
|
||||
*/
|
||||
uint8_t readSequenceFlags(uint8_t* spacePacket);
|
||||
|
||||
ReturnValue_t createMramDumpFile();
|
||||
ReturnValue_t getTimeStampString(std::string& timeStamp);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
436
bsp_q7s/devices/PlocUpdater.cpp
Normal file
436
bsp_q7s/devices/PlocUpdater.cpp
Normal file
@ -0,0 +1,436 @@
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "PlocUpdater.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
PlocUpdater::PlocUpdater(object_id_t objectId) :
|
||||
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||
}
|
||||
|
||||
PlocUpdater::~PlocUpdater() {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::initialize() {
|
||||
#if BOARD_TE0720 == 0
|
||||
sdcMan = SdCardManager::instance();
|
||||
#endif
|
||||
ReturnValue_t result = SystemObject::initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = commandActionHelper.initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = actionHelper.initialize(commandQueue);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::performOperation(uint8_t operationCode) {
|
||||
readCommandQueue();
|
||||
doStateMachine();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
|
||||
if (state != State::IDLE) {
|
||||
return IS_BUSY;
|
||||
}
|
||||
|
||||
if (size > MAX_PLOC_UPDATE_PATH) {
|
||||
return NAME_TOO_LONG;
|
||||
}
|
||||
|
||||
switch (actionId) {
|
||||
case UPDATE_A_UBOOT:
|
||||
image = Image::A;
|
||||
partition = Partition::UBOOT;
|
||||
break;
|
||||
case UPDATE_A_BITSTREAM:
|
||||
image = Image::A;
|
||||
partition = Partition::BITSTREAM;
|
||||
break;
|
||||
case UPDATE_A_LINUX:
|
||||
image = Image::A;
|
||||
partition = Partition::LINUX_OS;
|
||||
break;
|
||||
case UPDATE_A_APP_SW:
|
||||
image = Image::A;
|
||||
partition = Partition::APP_SW;
|
||||
break;
|
||||
case UPDATE_B_UBOOT:
|
||||
image = Image::B;
|
||||
partition = Partition::UBOOT;
|
||||
break;
|
||||
case UPDATE_B_BITSTREAM:
|
||||
image = Image::B;
|
||||
partition = Partition::BITSTREAM;
|
||||
break;
|
||||
case UPDATE_B_LINUX:
|
||||
image = Image::B;
|
||||
partition = Partition::LINUX_OS;
|
||||
break;
|
||||
case UPDATE_B_APP_SW:
|
||||
image = Image::B;
|
||||
partition = Partition::APP_SW;
|
||||
break;
|
||||
default:
|
||||
return INVALID_ACTION_ID;
|
||||
}
|
||||
|
||||
result = getImageLocation(data, size);
|
||||
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
state = State::UPDATE_AVAILABLE;
|
||||
|
||||
return EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
MessageQueueId_t PlocUpdater::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
MessageQueueIF* PlocUpdater::getCommandQueuePtr() {
|
||||
return commandQueue;
|
||||
}
|
||||
|
||||
void PlocUpdater::readCommandQueue() {
|
||||
CommandMessage message;
|
||||
ReturnValue_t result;
|
||||
|
||||
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
|
||||
result = commandQueue->receiveMessage(&message)) {
|
||||
if (result != RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
result = actionHelper.handleActionMessage(&message);
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result = commandActionHelper.handleReply(&message);
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sif::debug << "PlocUpdater::readCommandQueue: Received message with invalid format"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocUpdater::doStateMachine() {
|
||||
switch (state) {
|
||||
case State::IDLE:
|
||||
break;
|
||||
case State::UPDATE_AVAILABLE:
|
||||
commandUpdateAvailable();
|
||||
break;
|
||||
case State::UPDATE_TRANSFER:
|
||||
commandUpdatePacket();
|
||||
break;
|
||||
case State::UPDATE_VERIFY:
|
||||
commandUpdateVerify();
|
||||
break;
|
||||
case State::COMMAND_EXECUTING:
|
||||
break;
|
||||
default:
|
||||
sif::debug << "PlocUpdater::doStateMachine: Invalid state" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::checkNameLength(size_t size) {
|
||||
if (size > MAX_PLOC_UPDATE_PATH) {
|
||||
return NAME_TOO_LONG;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
||||
ReturnValue_t result = checkNameLength(size);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
// Check if file is stored on SD card and if associated SD card is mounted
|
||||
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||
if (!isSdCardMounted(sd::SLOT_0)) {
|
||||
sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 0 not mounted" << std::endl;
|
||||
return SD_NOT_MOUNTED;
|
||||
}
|
||||
}
|
||||
else if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||
if (!isSdCardMounted(sd::SLOT_0)) {
|
||||
sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 1 not mounted" << std::endl;
|
||||
return SD_NOT_MOUNTED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//update image not stored on SD card
|
||||
}
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
|
||||
updateFile = std::string(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
// Check if file exists
|
||||
if(not std::filesystem::exists(updateFile)) {
|
||||
return FILE_NOT_EXISTS;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
|
||||
SdCardManager::SdStatePair active;
|
||||
ReturnValue_t result = sdcMan->getSdCardActiveStatus(active);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocUpdater::isSdCardMounted: Failed to get SD card active state";
|
||||
return false;
|
||||
}
|
||||
if (sdCard == sd::SLOT_0) {
|
||||
if (active.first == sd::MOUNTED) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (sdCard == sd::SLOT_1) {
|
||||
if (active.second == sd::MOUNTED) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sif::debug << "PlocUpdater::isSdCardMounted: Unknown SD card specified" << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif /* #if BOARD_TE0720 == 0 */
|
||||
|
||||
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
|
||||
uint8_t step) {
|
||||
}
|
||||
|
||||
void PlocUpdater::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) {
|
||||
}
|
||||
|
||||
void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||
|
||||
}
|
||||
|
||||
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
||||
switch (pendingCommand) {
|
||||
case (PLOC_SPV::UPDATE_AVAILABLE):
|
||||
state = State::UPDATE_TRANSFER;
|
||||
break;
|
||||
case (PLOC_SPV::UPDATE_IMAGE_DATA):
|
||||
if (remainingPackets == 0) {
|
||||
packetsSent = 0; // Reset packets sent variable for next update sequence
|
||||
state = State::UPDATE_VERIFY;
|
||||
}
|
||||
else {
|
||||
state = State::UPDATE_TRANSFER;
|
||||
}
|
||||
break;
|
||||
case (PLOC_SPV::UPDATE_VERIFY):
|
||||
triggerEvent(UPDATE_FINISHED);
|
||||
state = State::IDLE;
|
||||
pendingCommand = PLOC_SPV::NONE;
|
||||
break;
|
||||
default:
|
||||
sif::debug << "PlocUpdater::completionSuccessfulReceived: Invalid pending command"
|
||||
<< std::endl;
|
||||
state = State::IDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocUpdater::completionFailedReceived(ActionId_t actionId,
|
||||
ReturnValue_t returnCode) {
|
||||
switch(pendingCommand) {
|
||||
case(PLOC_SPV::UPDATE_AVAILABLE): {
|
||||
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::UPDATE_IMAGE_DATA): {
|
||||
triggerEvent(UPDATE_TRANSFER_FAILED, packetsSent);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::UPDATE_VERIFY): {
|
||||
triggerEvent(UPDATE_VERIFY_FAILED);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command "
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
state = State::IDLE;
|
||||
}
|
||||
|
||||
void PlocUpdater::commandUpdateAvailable() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
if (not std::filesystem::exists(updateFile)) {
|
||||
triggerEvent(UPDATE_FILE_NOT_EXISTS, static_cast<uint8_t>(state));
|
||||
state = State::IDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream file(updateFile, std::ifstream::binary);
|
||||
file.seekg(0, file.end);
|
||||
imageSize = static_cast<size_t>(file.tellg());
|
||||
file.close();
|
||||
|
||||
numOfUpdatePackets = imageSize / MAX_SP_DATA ;
|
||||
if (imageSize % MAX_SP_DATA) {
|
||||
numOfUpdatePackets++;
|
||||
}
|
||||
|
||||
remainingPackets = numOfUpdatePackets;
|
||||
packetsSent = 0;
|
||||
|
||||
calcImageCrc();
|
||||
|
||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
||||
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
|
||||
|
||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(), packet.getFullSize());
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||
<< " packet to supervisor handler" << std::endl;
|
||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_AVAILABLE);
|
||||
state = State::IDLE;
|
||||
pendingCommand = PLOC_SPV::NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
pendingCommand = PLOC_SPV::UPDATE_AVAILABLE;
|
||||
state = State::COMMAND_EXECUTING;
|
||||
return;
|
||||
}
|
||||
|
||||
void PlocUpdater::commandUpdatePacket() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
uint16_t payloadLength = 0;
|
||||
|
||||
if (not std::filesystem::exists(updateFile)) {
|
||||
triggerEvent(UPDATE_FILE_NOT_EXISTS, static_cast<uint8_t>(state), packetsSent);
|
||||
state = State::IDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
std::ifstream file(updateFile, std::ifstream::binary);
|
||||
file.seekg(packetsSent * MAX_SP_DATA, file.beg);
|
||||
|
||||
if (remainingPackets == 1) {
|
||||
payloadLength = imageSize - static_cast<uint16_t>(file.tellg());
|
||||
}
|
||||
else {
|
||||
payloadLength = MAX_SP_DATA;
|
||||
}
|
||||
|
||||
PLOC_SPV::UpdatePacket packet(payloadLength);
|
||||
file.read(reinterpret_cast<char*>(packet.getDataFieldPointer()), payloadLength);
|
||||
file.close();
|
||||
// sequence count of first packet is 1
|
||||
packet.setPacketSequenceCount((packetsSent + 1) & PLOC_SPV::SEQUENCE_COUNT_MASK);
|
||||
if (numOfUpdatePackets > 1) {
|
||||
adjustSequenceFlags(packet);
|
||||
}
|
||||
packet.makeCrc();
|
||||
|
||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(), packet.getFullSize());
|
||||
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
||||
<< " packet to supervisor handler" << std::endl;
|
||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_IMAGE_DATA);
|
||||
state = State::IDLE;
|
||||
pendingCommand = PLOC_SPV::NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
remainingPackets--;
|
||||
packetsSent++;
|
||||
|
||||
pendingCommand = PLOC_SPV::UPDATE_IMAGE_DATA;
|
||||
state = State::COMMAND_EXECUTING;
|
||||
}
|
||||
|
||||
void PlocUpdater::commandUpdateVerify() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
||||
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
|
||||
|
||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||
PLOC_SPV::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||
<< " packet to supervisor handler" << std::endl;
|
||||
triggerEvent(ACTION_COMMANDING_FAILED, result, PLOC_SPV::UPDATE_VERIFY);
|
||||
state = State::IDLE;
|
||||
pendingCommand = PLOC_SPV::NONE;
|
||||
return;
|
||||
}
|
||||
state = State::COMMAND_EXECUTING;
|
||||
pendingCommand = PLOC_SPV::UPDATE_VERIFY;
|
||||
return;
|
||||
}
|
||||
|
||||
void PlocUpdater::calcImageCrc() {
|
||||
std::ifstream file(updateFile, std::ifstream::binary);
|
||||
file.seekg(0, file.end);
|
||||
uint32_t count;
|
||||
uint32_t bit;
|
||||
uint32_t remainder = INITIAL_REMAINDER_32;
|
||||
char input;
|
||||
for (count = 0; count < imageSize; count++) {
|
||||
file.seekg(count, file.beg);
|
||||
file.read(&input, 1);
|
||||
remainder ^= (input << 16);
|
||||
for (bit = 8; bit > 0; --bit) {
|
||||
if (remainder & TOPBIT_32) {
|
||||
remainder = (remainder << 1) ^ POLYNOMIAL_32;
|
||||
} else {
|
||||
remainder = (remainder << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
imageCrc = (remainder ^ FINAL_XOR_VALUE_32);
|
||||
}
|
||||
|
||||
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
||||
if (packetsSent == 0) {
|
||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
||||
}
|
||||
else if (remainingPackets == 1) {
|
||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
||||
}
|
||||
else {
|
||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
||||
}
|
||||
}
|
||||
|
189
bsp_q7s/devices/PlocUpdater.h
Normal file
189
bsp_q7s/devices/PlocUpdater.h
Normal file
@ -0,0 +1,189 @@
|
||||
#ifndef MISSION_DEVICES_PLOCUPDATER_H_
|
||||
#define MISSION_DEVICES_PLOCUPDATER_H_
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||
|
||||
#include "fsfw/action/CommandActionHelper.h"
|
||||
#include "fsfw/action/ActionHelper.h"
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/action/CommandsActionsIF.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief An object of this class can be used to perform the software updates of the PLOC. The
|
||||
* software update will be read from one of the SD cards, split into multiple space
|
||||
* packets and sent to the PlocSupervisorHandler.
|
||||
*
|
||||
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition A
|
||||
* and Partition B)
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class PlocUpdater : public SystemObject,
|
||||
public HasActionsIF,
|
||||
public ExecutableObjectIF,
|
||||
public HasReturnvaluesIF,
|
||||
public CommandsActionsIF {
|
||||
public:
|
||||
|
||||
static const ActionId_t UPDATE_A_UBOOT = 0;
|
||||
static const ActionId_t UPDATE_A_BITSTREAM = 1;
|
||||
static const ActionId_t UPDATE_A_LINUX = 2;
|
||||
static const ActionId_t UPDATE_A_APP_SW = 3;
|
||||
static const ActionId_t UPDATE_B_UBOOT = 4;
|
||||
static const ActionId_t UPDATE_B_BITSTREAM = 5;
|
||||
static const ActionId_t UPDATE_B_LINUX = 6;
|
||||
static const ActionId_t UPDATE_B_APP_SW = 7;
|
||||
|
||||
PlocUpdater(object_id_t objectId);
|
||||
virtual ~PlocUpdater();
|
||||
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
MessageQueueId_t getCommandQueue() const;
|
||||
ReturnValue_t initialize() override;
|
||||
MessageQueueIF* getCommandQueuePtr() override;
|
||||
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||
|
||||
private:
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Updater is already performing an update
|
||||
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
|
||||
//! [EXPORT] : [COMMENT] Received update command with invalid path string (too long).
|
||||
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA1);
|
||||
//! [EXPORT] : [COMMENT] Received command to initiate update but SD card with update image not mounted.
|
||||
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA2);
|
||||
//! [EXPORT] : [COMMENT] Update file received with update command does not exist.
|
||||
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA3);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_UPDATER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Try to read update file but the file does not exist.
|
||||
//! P1: Indicates in which state the file read fails
|
||||
//! P2: During the update transfer the second parameter gives information about the number of already sent packets
|
||||
static const Event UPDATE_FILE_NOT_EXISTS = MAKE_EVENT(0, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to send command to supervisor handler
|
||||
//! P1: Return value of CommandActionHelper::commandAction
|
||||
//! P2: Action ID of command to send
|
||||
static const Event ACTION_COMMANDING_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor handler replied action message indicating a command execution failure of the update available command
|
||||
static const Event UPDATE_AVAILABLE_FAILED = MAKE_EVENT(2, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor handler failed to transfer an update space packet.
|
||||
//! P1: Parameter holds the number of update packets already sent (inclusive the failed packet)
|
||||
static const Event UPDATE_TRANSFER_FAILED = MAKE_EVENT(3, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Supervisor failed to execute the update verify command.
|
||||
static const Event UPDATE_VERIFY_FAILED = MAKE_EVENT(4, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] MPSoC update successful completed
|
||||
static const Event UPDATE_FINISHED = MAKE_EVENT(5, severity::INFO);
|
||||
|
||||
static const uint32_t QUEUE_SIZE = config::PLOC_UPDATER_QUEUE_SIZE;
|
||||
static const size_t MAX_PLOC_UPDATE_PATH = 50;
|
||||
static const size_t SD_PREFIX_LENGTH = 8;
|
||||
// Maximum size of update payload data per space packet (max size of space packet is 1024 bytes)
|
||||
static const size_t MAX_SP_DATA = 1016;
|
||||
|
||||
static const uint32_t TOPBIT_32 = (1 << 31);
|
||||
static const uint32_t POLYNOMIAL_32 = 0x04C11DB7;
|
||||
static const uint32_t INITIAL_REMAINDER_32 = 0xFFFFFFFF;
|
||||
static const uint32_t FINAL_XOR_VALUE_32 = 0xFFFFFFFF;
|
||||
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
#endif
|
||||
CommandActionHelper commandActionHelper;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
|
||||
enum class State: uint8_t {
|
||||
IDLE,
|
||||
UPDATE_AVAILABLE,
|
||||
UPDATE_TRANSFER,
|
||||
UPDATE_VERIFY,
|
||||
COMMAND_EXECUTING
|
||||
};
|
||||
|
||||
State state = State::IDLE;
|
||||
|
||||
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
||||
|
||||
enum class Image: uint8_t {
|
||||
NONE,
|
||||
A,
|
||||
B
|
||||
};
|
||||
|
||||
Image image = Image::NONE;
|
||||
|
||||
enum class Partition: uint8_t {
|
||||
NONE,
|
||||
UBOOT,
|
||||
BITSTREAM,
|
||||
LINUX_OS,
|
||||
APP_SW
|
||||
};
|
||||
|
||||
Partition partition = Partition::NONE;
|
||||
|
||||
uint32_t packetsSent = 0;
|
||||
uint32_t remainingPackets = 0;
|
||||
// Number of packets required to transfer the update image
|
||||
uint32_t numOfUpdatePackets = 0;
|
||||
|
||||
std::string updateFile;
|
||||
uint32_t imageSize = 0;
|
||||
uint32_t imageCrc = 0;
|
||||
|
||||
void readCommandQueue();
|
||||
void doStateMachine();
|
||||
|
||||
/**
|
||||
* @brief Extracts the path and name of the update image from the service 8 command data.
|
||||
*/
|
||||
ReturnValue_t getImageLocation(const uint8_t* data, size_t size);
|
||||
|
||||
ReturnValue_t checkNameLength(size_t size);
|
||||
|
||||
/**
|
||||
* @brief Prepares and sends update available command to PLOC supervisor handler.
|
||||
*/
|
||||
void commandUpdateAvailable();
|
||||
|
||||
/**
|
||||
* @brief Prepares and sends and update packet to the PLOC supervisor handler.
|
||||
*/
|
||||
void commandUpdatePacket();
|
||||
|
||||
/**
|
||||
* @brief Prepares and sends the update verification packet to the PLOC supervisor handler.
|
||||
*/
|
||||
void commandUpdateVerify();
|
||||
|
||||
#if BOARD_TE0720 == 0
|
||||
/**
|
||||
* @brief Checks whether the SD card to read from is mounted or not.
|
||||
*/
|
||||
bool isSdCardMounted(sd::SdCard sdCard);
|
||||
#endif
|
||||
|
||||
void calcImageCrc();
|
||||
|
||||
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PLOCUPDATER_H_ */
|
33
bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h
Normal file
33
bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_
|
||||
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_
|
||||
|
||||
#include <fsfw/src/fsfw/serialize/SerialLinkedListAdapter.h>
|
||||
|
||||
class MemoryParams: public SerialLinkedListAdapter<SerializeIF> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param startAddress Start of address range to dump
|
||||
* @param endAddress End of address range to dump
|
||||
*/
|
||||
MemoryParams(uint32_t startAddress, uint32_t endAddress) :
|
||||
startAddress(startAddress), endAddress(endAddress) {
|
||||
setLinks();
|
||||
}
|
||||
private:
|
||||
|
||||
void setLinks() {
|
||||
setStart(&startAddress);
|
||||
startAddress.setNext(&endAddress);
|
||||
}
|
||||
|
||||
SerializeElement<uint32_t> startAddress;
|
||||
SerializeElement<uint32_t> endAddress;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */
|
1609
bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h
Normal file
1609
bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,9 @@
|
||||
#include "gpioCallbacks.h"
|
||||
#include "busConf.h"
|
||||
#include <devices/gpioIds.h>
|
||||
|
||||
#include <fsfw/hal/linux/gpio/LinuxLibgpioIF.h>
|
||||
#include <fsfw/hal/common/gpio/GpioCookie.h>
|
||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
|
||||
@ -23,30 +24,31 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
|
||||
|
||||
GpioCookie* spiMuxGpios = new GpioCookie;
|
||||
|
||||
GpiodRegularByLabel* spiMuxBit = nullptr;
|
||||
/** Setting mux bit 1 to low will disable IC21 on the interface board */
|
||||
GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("gpiochip7"), 13,
|
||||
std::string("SPI Mux Bit 1"), gpio::OUT, 0);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1);
|
||||
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1,
|
||||
"SPI Mux Bit 1", gpio::OUT, gpio::LOW);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
||||
/** Setting mux bit 2 to low disables IC1 on the TCS board */
|
||||
GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("gpiochip7"), 14,
|
||||
std::string("SPI Mux Bit 2"), gpio::OUT, 0);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2);
|
||||
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2,
|
||||
"SPI Mux Bit 2", gpio::OUT, gpio::LOW);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
||||
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
||||
GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("gpiochip7"), 15,
|
||||
std::string("SPI Mux Bit 3"), gpio::OUT, 0);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3);
|
||||
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3,
|
||||
"SPI Mux Bit 3", gpio::OUT, gpio::LOW);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
||||
/** The following gpios can take arbitrary initial values */
|
||||
GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("gpiochip7"), 16,
|
||||
std::string("SPI Mux Bit 4"), gpio::OUT, 0);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4);
|
||||
GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("gpiochip7"), 17,
|
||||
std::string("SPI Mux Bit 5"), gpio::OUT, 0);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5);
|
||||
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 18,
|
||||
std::string("SPI Mux Bit 6"), gpio::OUT, 0);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6);
|
||||
GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17,
|
||||
std::string("EN_RW_CS"), gpio::OUT, 1);
|
||||
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4,
|
||||
"SPI Mux Bit 4", gpio::OUT, gpio::LOW);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
|
||||
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5,
|
||||
"SPI Mux Bit 5", gpio::OUT, gpio::LOW);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
|
||||
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6,
|
||||
"SPI Mux Bit 6", gpio::OUT, gpio::LOW);
|
||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
|
||||
GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1,
|
||||
q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH);
|
||||
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||
|
||||
result = gpioComInterface->addGpios(spiMuxGpios);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
||||
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
||||
|
||||
#include <fsfw/hal/common/gpio/gpioDefinitions.h>
|
||||
#include <fsfw/hal/common/gpio/GpioIF.h>
|
||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||
|
||||
|
||||
namespace gpioCallbacks {
|
||||
|
@ -41,8 +41,10 @@ void FileSystemHandler::fileSystemHandlerLoop() {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
while(true) {
|
||||
if(opCounter % 5 == 0) {
|
||||
if(coreCtrl->sdInitFinished()) {
|
||||
fileSystemCheckup();
|
||||
}
|
||||
}
|
||||
result = mq->receiveMessage(&filemsg);
|
||||
if(result == MessageQueueIF::EMPTY) {
|
||||
break;
|
||||
@ -72,16 +74,16 @@ void FileSystemHandler::fileSystemHandlerLoop() {
|
||||
}
|
||||
|
||||
void FileSystemHandler::fileSystemCheckup() {
|
||||
SdCardManager::SdStatusPair statusPair;
|
||||
SdCardManager::SdStatePair statusPair;
|
||||
sdcMan->getSdCardActiveStatus(statusPair);
|
||||
sd::SdCard preferredSdCard;
|
||||
sdcMan->getPreferredSdCard(preferredSdCard);
|
||||
if((preferredSdCard == sd::SdCard::SLOT_0) and
|
||||
(statusPair.first == sd::SdStatus::MOUNTED)) {
|
||||
(statusPair.first == sd::SdState::MOUNTED)) {
|
||||
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||
}
|
||||
else if((preferredSdCard == sd::SdCard::SLOT_1) and
|
||||
(statusPair.second == sd::SdStatus::MOUNTED)) {
|
||||
(statusPair.second == sd::SdState::MOUNTED)) {
|
||||
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
||||
}
|
||||
else {
|
||||
@ -111,6 +113,11 @@ MessageQueueId_t FileSystemHandler::getCommandQueue() const {
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::initialize() {
|
||||
coreCtrl = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||
if(coreCtrl == nullptr) {
|
||||
sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle" <<
|
||||
std::endl;
|
||||
}
|
||||
sdcMan = SdCardManager::instance();
|
||||
sd::SdCard preferredSdCard;
|
||||
ReturnValue_t result = sdcMan->getPreferredSdCard(preferredSdCard);
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class CoreController;
|
||||
|
||||
class FileSystemHandler: public SystemObject,
|
||||
public ExecutableObjectIF,
|
||||
public HasFileSystemIF {
|
||||
@ -47,6 +49,7 @@ public:
|
||||
void* args = nullptr) override;
|
||||
|
||||
private:
|
||||
CoreController* coreCtrl = nullptr;
|
||||
MessageQueueIF* mq = nullptr;
|
||||
std::string currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||
static constexpr uint32_t FS_MAX_QUEUE_SIZE = config::OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <fsfw/osal/linux/Timer.h>
|
||||
#include "SdCardManager.h"
|
||||
#include "scratchApi.h"
|
||||
|
||||
@ -6,13 +7,16 @@
|
||||
#include "fsfw/ipc/MutexFactory.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <filesystem>
|
||||
#include <cstring>
|
||||
|
||||
SdCardManager* SdCardManager::factoryInstance = nullptr;
|
||||
|
||||
SdCardManager::SdCardManager() {
|
||||
SdCardManager::SdCardManager(): cmdExecutor(256) {
|
||||
}
|
||||
|
||||
SdCardManager::~SdCardManager() {
|
||||
@ -30,11 +34,19 @@ SdCardManager* SdCardManager::instance() {
|
||||
}
|
||||
|
||||
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
|
||||
SdStatusPair* statusPair) {
|
||||
SdStatePair* statusPair) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
std::unique_ptr<SdStatusPair> sdStatusPtr;
|
||||
if(doMountSdCard) {
|
||||
if(not blocking) {
|
||||
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
|
||||
" not configured for blocking operation. "
|
||||
"Forcing blocking mode.." << std::endl;
|
||||
blocking = true;
|
||||
}
|
||||
}
|
||||
std::unique_ptr<SdStatePair> sdStatusPtr;
|
||||
if(statusPair == nullptr) {
|
||||
sdStatusPtr = std::make_unique<SdStatusPair>();
|
||||
sdStatusPtr = std::make_unique<SdStatePair>();
|
||||
statusPair = sdStatusPtr.get();
|
||||
result = getSdCardActiveStatus(*statusPair);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -49,20 +61,19 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
sd::SdStatus targetStatus;
|
||||
sd::SdState currentState;
|
||||
if(sdCard == sd::SdCard::SLOT_0) {
|
||||
targetStatus = statusPair->first;
|
||||
currentState = statusPair->first;
|
||||
}
|
||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
||||
targetStatus = statusPair->second;
|
||||
currentState = statusPair->second;
|
||||
}
|
||||
else {
|
||||
// Should not happen
|
||||
targetStatus = sd::SdStatus::OFF;
|
||||
currentState = sd::SdState::OFF;
|
||||
}
|
||||
|
||||
auto switchCall = [&]() {
|
||||
if(targetStatus == sd::SdStatus::ON) {
|
||||
if(currentState == sd::SdState::ON) {
|
||||
if(not doMountSdCard) {
|
||||
return ALREADY_ON;
|
||||
}
|
||||
@ -70,18 +81,15 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
||||
return mountSdCard(sdCard);
|
||||
}
|
||||
}
|
||||
else if(targetStatus == sd::SdStatus::MOUNTED) {
|
||||
return ALREADY_MOUNTED;
|
||||
else if(currentState == sd::SdState::MOUNTED) {
|
||||
result = ALREADY_MOUNTED;
|
||||
}
|
||||
else if(targetStatus == sd::SdStatus::OFF) {
|
||||
return setSdCardState(sdCard, true);
|
||||
else if(currentState == sd::SdState::OFF) {
|
||||
result = setSdCardState(sdCard, true);
|
||||
}
|
||||
else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
result = HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
};
|
||||
|
||||
result = switchCall();
|
||||
|
||||
if(result != HasReturnvaluesIF::RETURN_OK or not doMountSdCard) {
|
||||
return result;
|
||||
@ -91,12 +99,19 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
||||
}
|
||||
|
||||
ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard,
|
||||
SdStatusPair* statusPair) {
|
||||
std::pair<sd::SdStatus, sd::SdStatus> active;
|
||||
SdStatePair* statusPair) {
|
||||
std::pair<sd::SdState, sd::SdState> active;
|
||||
ReturnValue_t result = getSdCardActiveStatus(active);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
if(doUnmountSdCard) {
|
||||
if(not blocking) {
|
||||
sif::warning << "SdCardManager::switchOffSdCard: Two-step command but manager is"
|
||||
" not configured for blocking operation. Forcing blocking mode.." << std::endl;
|
||||
blocking = true;
|
||||
}
|
||||
}
|
||||
// Not allowed, this function turns off one SD card
|
||||
if(sdCard == sd::SdCard::BOTH) {
|
||||
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
|
||||
@ -104,12 +119,12 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if(sdCard == sd::SdCard::SLOT_0) {
|
||||
if(active.first == sd::SdStatus::OFF) {
|
||||
if(active.first == sd::SdState::OFF) {
|
||||
return ALREADY_OFF;
|
||||
}
|
||||
}
|
||||
else if(sdCard == sd::SdCard::SLOT_1) {
|
||||
if(active.second == sd::SdStatus::OFF) {
|
||||
if(active.second == sd::SdState::OFF) {
|
||||
return ALREADY_OFF;
|
||||
}
|
||||
}
|
||||
@ -126,6 +141,9 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
||||
|
||||
ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
||||
using namespace std;
|
||||
if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
|
||||
return CommandExecutor::COMMAND_PENDING;
|
||||
}
|
||||
string sdstring = "";
|
||||
string statestring = "";
|
||||
if(sdCard == sd::SdCard::SLOT_0) {
|
||||
@ -135,23 +153,24 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
||||
sdstring = "1";
|
||||
}
|
||||
if(on) {
|
||||
currentOp = Operations::SWITCHING_ON;
|
||||
statestring = "on";
|
||||
}
|
||||
else {
|
||||
currentOp = Operations::SWITCHING_OFF;
|
||||
statestring = "off";
|
||||
}
|
||||
ostringstream command;
|
||||
command << "q7hw sd set " << sdstring << " " << statestring;
|
||||
int result = system(command.str().c_str());
|
||||
if(result == 0) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
cmdExecutor.load(command.str(), blocking, printCmdOutput);
|
||||
ReturnValue_t result = cmdExecutor.execute();
|
||||
if(blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::setSdCardState");
|
||||
}
|
||||
sif::warning << "SdCardManager::setSdCardState: system call failed with code " <<
|
||||
result << std::endl;
|
||||
return SYSTEM_CALL_ERROR;
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatusPair& active) {
|
||||
ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatePair& active) {
|
||||
using namespace std;
|
||||
if(not filesystem::exists(SD_STATE_FILE)) {
|
||||
return STATUS_FILE_NEXISTS;
|
||||
@ -174,6 +193,9 @@ ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatusPair& active) {
|
||||
|
||||
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
||||
using namespace std;
|
||||
if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
|
||||
return CommandExecutor::COMMAND_PENDING;
|
||||
}
|
||||
if(sdCard == sd::SdCard::BOTH) {
|
||||
sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH"
|
||||
<< std::endl;
|
||||
@ -195,16 +217,22 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
||||
return MOUNT_ERROR;
|
||||
}
|
||||
|
||||
string sdMountCommand = "mount " + mountDev + " " + mountPoint;
|
||||
int result = system(sdMountCommand.c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "SdCardManager::mountSdCard");
|
||||
return SYSTEM_CALL_ERROR;
|
||||
if(not blocking) {
|
||||
currentOp = Operations::MOUNTING;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
string sdMountCommand = "mount " + mountDev + " " + mountPoint;
|
||||
cmdExecutor.load(sdMountCommand, blocking, printCmdOutput);
|
||||
ReturnValue_t result = cmdExecutor.execute();
|
||||
if(blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
||||
if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
|
||||
return CommandExecutor::COMMAND_PENDING;
|
||||
}
|
||||
using namespace std;
|
||||
if(sdCard == sd::SdCard::BOTH) {
|
||||
sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH"
|
||||
@ -229,34 +257,53 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
||||
sif::warning << "SdCardManager::unmountSdCard: Mount point is empty!" << std::endl;
|
||||
}
|
||||
string sdUnmountCommand = "umount " + mountPoint;
|
||||
int result = system(sdUnmountCommand.c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "SdCardManager::unmountSdCard");
|
||||
return SYSTEM_CALL_ERROR;
|
||||
if(not blocking) {
|
||||
currentOp = Operations::UNMOUNTING;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
cmdExecutor.load(sdUnmountCommand, blocking, printCmdOutput);
|
||||
ReturnValue_t result = cmdExecutor.execute();
|
||||
if(blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::unmountSdCard");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t SdCardManager::sanitizeState(SdStatusPair* statusPair, sd::SdCard prefSdCard) {
|
||||
std::unique_ptr<SdStatusPair> sdStatusPtr;
|
||||
ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard prefSdCard) {
|
||||
std::unique_ptr<SdStatePair> sdStatusPtr;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
// Enforce blocking operation for now. Be careful to reset it when returning prematurely!
|
||||
bool resetNonBlockingState = false;
|
||||
if(not this->blocking) {
|
||||
blocking = true;
|
||||
resetNonBlockingState = true;
|
||||
}
|
||||
if(prefSdCard == sd::SdCard::NONE) {
|
||||
ReturnValue_t result = getPreferredSdCard(prefSdCard);
|
||||
result = getPreferredSdCard(prefSdCard);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {}
|
||||
}
|
||||
if(statusPair == nullptr) {
|
||||
sdStatusPtr = std::make_unique<SdStatusPair>();
|
||||
sdStatusPtr = std::make_unique<SdStatePair>();
|
||||
statusPair = sdStatusPtr.get();
|
||||
getSdCardActiveStatus(*statusPair);
|
||||
}
|
||||
|
||||
if(statusPair->first == sd::SdStatus::ON) {
|
||||
return mountSdCard(prefSdCard);
|
||||
if(statusPair->first == sd::SdState::ON) {
|
||||
result = mountSdCard(prefSdCard);
|
||||
}
|
||||
|
||||
return switchOnSdCard(prefSdCard, true, statusPair);
|
||||
result = switchOnSdCard(prefSdCard, true, statusPair);
|
||||
if(resetNonBlockingState) {
|
||||
blocking = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void SdCardManager::processSdStatusLine(std::pair<sd::SdStatus, sd::SdStatus> &active,
|
||||
void SdCardManager::resetState() {
|
||||
cmdExecutor.reset();
|
||||
currentOp = Operations::IDLE;
|
||||
}
|
||||
|
||||
void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState> &active,
|
||||
std::string& line, uint8_t& idx, sd::SdCard& currentSd) {
|
||||
using namespace std;
|
||||
istringstream iss(line);
|
||||
@ -278,28 +325,28 @@ void SdCardManager::processSdStatusLine(std::pair<sd::SdStatus, sd::SdStatus> &a
|
||||
|
||||
if(word == "on") {
|
||||
if(currentSd == sd::SdCard::SLOT_0) {
|
||||
active.first = sd::SdStatus::ON;
|
||||
active.first = sd::SdState::ON;
|
||||
}
|
||||
else {
|
||||
active.second = sd::SdStatus::ON;
|
||||
active.second = sd::SdState::ON;
|
||||
}
|
||||
}
|
||||
else if (word == "off") {
|
||||
if(currentSd == sd::SdCard::SLOT_0) {
|
||||
active.first = sd::SdStatus::OFF;
|
||||
active.first = sd::SdState::OFF;
|
||||
}
|
||||
else {
|
||||
active.second = sd::SdStatus::OFF;
|
||||
active.second = sd::SdState::OFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mountLine) {
|
||||
if(currentSd == sd::SdCard::SLOT_0) {
|
||||
active.first = sd::SdStatus::MOUNTED;
|
||||
active.first = sd::SdState::MOUNTED;
|
||||
}
|
||||
else {
|
||||
active.second = sd::SdStatus::MOUNTED;
|
||||
active.second = sd::SdState::MOUNTED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,15 +376,17 @@ ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
|
||||
}
|
||||
|
||||
ReturnValue_t SdCardManager::updateSdCardStateFile() {
|
||||
if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
|
||||
return CommandExecutor::COMMAND_PENDING;
|
||||
}
|
||||
// Use q7hw utility and pipe the command output into the state file
|
||||
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
|
||||
int result = std::system(updateCmd.c_str());
|
||||
if(result == 0) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
|
||||
ReturnValue_t result = cmdExecutor.execute();
|
||||
if(blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
|
||||
}
|
||||
sif::warning << "SdCardManager::updateSdCardStateFile: system call failed with code " <<
|
||||
result << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string SdCardManager::getCurrentMountPrefix(sd::SdCard prefSdCard) {
|
||||
@ -354,3 +403,56 @@ std::string SdCardManager::getCurrentMountPrefix(sd::SdCard prefSdCard) {
|
||||
return SD_1_MOUNT_POINT;
|
||||
}
|
||||
}
|
||||
|
||||
SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations ¤tOp) {
|
||||
CommandExecutor::States state = cmdExecutor.getCurrentState();
|
||||
if(state == CommandExecutor::States::IDLE or state == CommandExecutor::States::COMMAND_LOADED) {
|
||||
return OpStatus::IDLE;
|
||||
}
|
||||
currentOp = this->currentOp;
|
||||
bool bytesRead = false;
|
||||
|
||||
#if OBSW_ENABLE_TIMERS == 1
|
||||
Timer timer;
|
||||
timer.setTimer(100);
|
||||
uint32_t remainingTimeMs = 0;
|
||||
#endif
|
||||
while(true) {
|
||||
ReturnValue_t result = cmdExecutor.check(bytesRead);
|
||||
// This timer can prevent deadlocks due to missconfigurations
|
||||
#if OBSW_ENABLE_TIMERS == 1
|
||||
timer.getTimer(&remainingTimeMs);
|
||||
if(remainingTimeMs == 0) {
|
||||
sif::error << "SdCardManager::checkCurrentOp: Timeout!" << std::endl;
|
||||
return OpStatus::FAIL;
|
||||
}
|
||||
#endif
|
||||
switch(result) {
|
||||
case(CommandExecutor::BYTES_READ): {
|
||||
continue;
|
||||
}
|
||||
case(CommandExecutor::EXECUTION_FINISHED): {
|
||||
return OpStatus::SUCCESS;
|
||||
}
|
||||
case(HasReturnvaluesIF::RETURN_OK): {
|
||||
return OpStatus::ONGOING;
|
||||
}
|
||||
case(HasReturnvaluesIF::RETURN_FAILED): {
|
||||
return OpStatus::FAIL;
|
||||
}
|
||||
default: {
|
||||
sif::warning << "SdCardManager::checkCurrentOp: Unhandled case" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SdCardManager::setBlocking(bool blocking) {
|
||||
this->blocking = blocking;
|
||||
}
|
||||
|
||||
void SdCardManager::setPrintCommandOutput(bool print) {
|
||||
this->printCmdOutput = print;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
||||
#define BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
||||
|
||||
#include <fsfw/osal/linux/CommandExecutor.h>
|
||||
#include "definitions.h"
|
||||
#include "returnvalues/classIds.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
@ -8,10 +9,13 @@
|
||||
#include "fsfw/events/Event.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
#include <poll.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <array>
|
||||
|
||||
class MutexIF;
|
||||
|
||||
@ -22,16 +26,34 @@ class MutexIF;
|
||||
class SdCardManager {
|
||||
friend class SdCardAccess;
|
||||
public:
|
||||
using SdStatusPair = std::pair<sd::SdStatus, sd::SdStatus>;
|
||||
enum class Operations {
|
||||
SWITCHING_ON,
|
||||
SWITCHING_OFF,
|
||||
MOUNTING,
|
||||
UNMOUNTING,
|
||||
IDLE
|
||||
};
|
||||
|
||||
enum class OpStatus {
|
||||
IDLE,
|
||||
TIMEOUT,
|
||||
ONGOING,
|
||||
SUCCESS,
|
||||
FAIL
|
||||
};
|
||||
|
||||
using SdStatePair = std::pair<sd::SdState, sd::SdState>;
|
||||
|
||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
|
||||
|
||||
static constexpr ReturnValue_t ALREADY_ON =
|
||||
static constexpr ReturnValue_t OP_ONGOING =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
||||
static constexpr ReturnValue_t ALREADY_MOUNTED =
|
||||
static constexpr ReturnValue_t ALREADY_ON =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
|
||||
static constexpr ReturnValue_t ALREADY_OFF =
|
||||
static constexpr ReturnValue_t ALREADY_MOUNTED =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
|
||||
static constexpr ReturnValue_t ALREADY_OFF =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 3);
|
||||
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
|
||||
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
|
||||
@ -42,6 +64,8 @@ public:
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
|
||||
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14);
|
||||
static constexpr ReturnValue_t POPEN_CALL_ERROR =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 15);
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
|
||||
|
||||
@ -90,7 +114,7 @@ public:
|
||||
* SYSTEM_CALL_ERROR on system error
|
||||
*/
|
||||
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
|
||||
SdStatusPair* statusPair = nullptr);
|
||||
SdStatePair* statusPair = nullptr);
|
||||
|
||||
/**
|
||||
* Switch off the specified SD card.
|
||||
@ -102,13 +126,15 @@ public:
|
||||
* SYSTEM_CALL_ERROR on system error
|
||||
*/
|
||||
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
|
||||
SdStatusPair* statusPair = nullptr);
|
||||
SdStatePair* statusPair = nullptr);
|
||||
|
||||
/**
|
||||
* Update the state file or creates one if it does not exist. You need to call this
|
||||
* function before calling #sdCardActive
|
||||
* @return - RETURN_OK if the state file was updated successfully
|
||||
* - SYSTEM_CALL_ERROR if the call to create the status file failed
|
||||
* @return
|
||||
* - RETURN_OK if the state file was updated successfully
|
||||
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
|
||||
* - RETURN_FAILED: blocking command failed
|
||||
*/
|
||||
ReturnValue_t updateSdCardStateFile();
|
||||
|
||||
@ -123,7 +149,7 @@ public:
|
||||
* should call #updateSdCardStateFile again in that case
|
||||
* - STATUS_FILE_NEXISTS if the status file does not exist
|
||||
*/
|
||||
ReturnValue_t getSdCardActiveStatus(SdStatusPair& active);
|
||||
ReturnValue_t getSdCardActiveStatus(SdStatePair& active);
|
||||
|
||||
/**
|
||||
* Mount the specified SD card. This is necessary to use it.
|
||||
@ -143,28 +169,43 @@ public:
|
||||
* In case that there is a discrepancy between the preferred SD card and the currently
|
||||
* mounted one, this function will sanitize the state by attempting to mount the
|
||||
* currently preferred SD card. If the caller already has state information, it can be
|
||||
* passed into the function.
|
||||
* passed into the function. For now, this operation will be enforced in blocking mode.
|
||||
* @param statusPair Current SD card status capture with #getSdCardActiveStatus
|
||||
* @param prefSdCard Preferred SD card captured with #getPreferredSdCard
|
||||
* @throws std::bad_alloc if one of the two arguments was a nullptr and an allocation failed
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t sanitizeState(SdStatusPair* statusPair = nullptr,
|
||||
ReturnValue_t sanitizeState(SdStatePair* statusPair = nullptr,
|
||||
sd::SdCard prefSdCard = sd::SdCard::NONE);
|
||||
|
||||
/**
|
||||
* If sd::SdCard::NONE is passed as an argument, this funtion will get the currently
|
||||
* If sd::SdCard::NONE is passed as an argument, this function will get the currently
|
||||
* preferred SD card from the scratch buffer.
|
||||
* @param prefSdCardPtr
|
||||
* @return
|
||||
*/
|
||||
std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE);
|
||||
|
||||
OpStatus checkCurrentOp(Operations& currentOp);
|
||||
|
||||
/**
|
||||
* If there are issues with the state machine, it can be reset with this function
|
||||
*/
|
||||
void resetState();
|
||||
|
||||
void setBlocking(bool blocking);
|
||||
void setPrintCommandOutput(bool print);
|
||||
private:
|
||||
CommandExecutor cmdExecutor;
|
||||
Operations currentOp = Operations::IDLE;
|
||||
bool blocking = false;
|
||||
bool printCmdOutput = true;
|
||||
|
||||
SdCardManager();
|
||||
|
||||
ReturnValue_t setSdCardState(sd::SdCard sdCard, bool on);
|
||||
|
||||
void processSdStatusLine(SdStatusPair& active, std::string& line, uint8_t& idx,
|
||||
void processSdStatusLine(SdStatePair& active, std::string& line, uint8_t& idx,
|
||||
sd::SdCard& currentSd);
|
||||
|
||||
std::string currentPrefix;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
namespace sd {
|
||||
|
||||
enum SdStatus: uint8_t {
|
||||
enum SdState: uint8_t {
|
||||
OFF = 0,
|
||||
ON = 1,
|
||||
// A mounted SD card is on as well
|
||||
|
@ -11,6 +11,10 @@ int simple::simple() {
|
||||
{
|
||||
FileSystemTest fileSystemTest;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TE0720_GPIO_TEST
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef BSP_Q7S_SPI_Q7SSPICOMIF_H_
|
||||
#define BSP_Q7S_SPI_Q7SSPICOMIF_H_
|
||||
|
||||
#include <fsfw/hal/linux/spi/SpiComIF.h>
|
||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -11,17 +11,6 @@ if(LINK_LWIP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINK_HAL)
|
||||
message(STATUS "Linking against ${LIB_HAL_NAME} HAL library")
|
||||
if(LIB_HAL_NAME)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC
|
||||
${LIB_HAL_NAME}
|
||||
)
|
||||
else()
|
||||
message(WARNING "HAL library name not set!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINKER_SCRIPT)
|
||||
target_link_options(${TARGET_NAME} PRIVATE
|
||||
-T${LINKER_SCRIPT}
|
||||
@ -52,11 +41,14 @@ target_compile_options(${TARGET_NAME} PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:ASM>:${ASM_FLAGS}>
|
||||
)
|
||||
|
||||
set(STRIPPED_TARGET_NAME ${TARGET_NAME}-stripped)
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary ${TARGET_NAME} ${TARGET_NAME}.bin
|
||||
COMMENT "Generating binary file ${CMAKE_PROJECT_NAME}.bin.."
|
||||
COMMAND ${CMAKE_STRIP} --strip-all ${TARGET_NAME} -o ${STRIPPED_TARGET_NAME}
|
||||
BYPRODUCTS ${STRIPPED_TARGET_NAME}
|
||||
COMMENT "Generating stripped executable ${STRIPPED_TARGET_NAME}.."
|
||||
)
|
||||
|
||||
endfunction()
|
@ -53,9 +53,9 @@ endif()
|
||||
|
||||
|
||||
if(TGT_BSP)
|
||||
if (${TGT_BSP} MATCHES "arm/raspberrypi" OR ${TGT_BSP} MATCHES "arm/beagleboneblack")
|
||||
if (TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||
set(BSP_PATH "bsp_linux_board")
|
||||
elseif(${TGT_BSP} MATCHES "arm/q7s")
|
||||
elseif(TGT_BSP MATCHES "arm/q7s")
|
||||
set(BSP_PATH "bsp_q7s")
|
||||
else()
|
||||
message(WARNING "CMake not configured for this target!")
|
||||
|
@ -1,5 +1,8 @@
|
||||
if(DEFINED ENV{Q7S_SYSROOT})
|
||||
set(ENV{Q7S_ROOTFS} $ENV{Q7S_SYSROOT})
|
||||
endif()
|
||||
# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command
|
||||
if(NOT DEFINED ENV{Q7S_SYSROOT})
|
||||
if(NOT DEFINED ENV{Q7S_ROOTFS})
|
||||
# Sysroot has not been cached yet and was not set in environment either
|
||||
if(NOT DEFINED SYSROOT_PATH)
|
||||
message(FATAL_ERROR
|
||||
@ -7,7 +10,7 @@ if(NOT DEFINED ENV{Q7S_SYSROOT})
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(SYSROOT_PATH "$ENV{Q7S_SYSROOT}" CACHE PATH "Q7S root filesystem path")
|
||||
set(SYSROOT_PATH "$ENV{Q7S_ROOTFS}" CACHE PATH "Q7S root filesystem path")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED ENV{CROSS_COMPILE})
|
||||
@ -42,6 +45,7 @@ find_program (CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX} REQUIRED)
|
||||
# Useful utilities, not strictly necessary
|
||||
find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
|
||||
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
|
||||
find_program(CMAKE_STRIP ${CROSS_COMPILE_STRIP})
|
||||
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
set(CMAKE_SYSROOT "${SYSROOT_PATH}")
|
||||
@ -54,6 +58,7 @@ set(CMAKE_SYSTEM_PROCESSOR "armv7")
|
||||
set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC})
|
||||
set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX})
|
||||
|
||||
if(EIVE_SYSROOT_MAGIC)
|
||||
# List of library dirs where LD has to look. Pass them directly through gcc.
|
||||
set(LIB_DIRS
|
||||
"${SYSROOT_PATH}/usr/include"
|
||||
@ -69,6 +74,7 @@ set(COMMON_FLAGS "-I${SYSROOT_PATH}/usr/lib")
|
||||
foreach(LIB ${LIB_DIRS})
|
||||
set(COMMON_FLAGS "${COMMON_FLAGS} -L${LIB} -Wl,-rpath-link,${LIB}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(CMAKE_PREFIX_PATH
|
||||
"${CMAKE_PREFIX_PATH}"
|
||||
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Debug-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=OFF"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Debug-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Release-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Release-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
35
cmake/scripts/BeagleBoneBlack/crosscompile/make-debug-cfg.sh
Executable file
35
cmake/scripts/BeagleBoneBlack/crosscompile/make-debug-cfg.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Debug-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
35
cmake/scripts/BeagleBoneBlack/crosscompile/make-release-cfg.sh
Executable file
35
cmake/scripts/BeagleBoneBlack/crosscompile/make-release-cfg.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Release-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
35
cmake/scripts/BeagleBoneBlack/make-debug-cfg.sh
Executable file
35
cmake/scripts/BeagleBoneBlack/make-debug-cfg.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/beagleboneblack"
|
||||
build_generator=""
|
||||
builddir="build-Debug-BBB"
|
||||
defines="LINUX_CROSS_COMPILE=OFF"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${builddir}" -d "${defines}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator=""
|
||||
os_fsfw="host"
|
||||
build_dir="Release-Host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -l"${build_dir}"
|
@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator=""
|
||||
os_fsfw="host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb"
|
@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator=""
|
||||
os_fsfw="host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size"
|
32
cmake/scripts/Host/make-debug-cfg.sh
Executable file
32
cmake/scripts/Host/make-debug-cfg.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator="Unix Makefiles"
|
||||
os_fsfw="host"
|
||||
builddir="build-Debug-Host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
32
cmake/scripts/Host/make-release-cfg.sh
Executable file
32
cmake/scripts/Host/make-release-cfg.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator="Unix Makefiles"
|
||||
os_fsfw="host"
|
||||
builddir="build-Release-Host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator=""
|
||||
build_dir="build-Debug-Host"
|
||||
os_fsfw="host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l"${build_dir}"
|
32
cmake/scripts/Host/ninja-debug-cfg.sh
Executable file
32
cmake/scripts/Host/ninja-debug-cfg.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_generator="Ninja"
|
||||
os_fsfw="host"
|
||||
builddir="build-Debug-Host"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -26,7 +27,6 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
||||
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -26,6 +27,6 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}"
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "create_cmake_cfg.sh not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -26,7 +27,7 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||
# Use this if commands are added which should not be printed
|
||||
# set +x
|
||||
|
36
cmake/scripts/Q7S/make-debug-cfg.sh
Executable file
36
cmake/scripts/Q7S/make-debug-cfg.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Debug-Q7S"
|
||||
build_generator=""
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
||||
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -29,6 +30,6 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
35
cmake/scripts/Q7S/make-size-cfg.sh
Executable file
35
cmake/scripts/Q7S/make-size-cfg.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Release-Q7S"
|
||||
build_generator=""
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "size" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -27,7 +28,7 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${build_dir}"
|
||||
# set +x
|
||||
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -27,7 +28,7 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
||||
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -18,7 +19,7 @@ os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Simple-Q7S"
|
||||
build_generator=""
|
||||
definitions="Q7S_SIMPLE_MODE=On"
|
||||
definitions="BUILD_Q7S_SIMPLE_MODE=On"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
python="py"
|
||||
@ -30,6 +31,6 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${build_dir}" -d "${definitions}"
|
||||
# set +x
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -18,7 +19,7 @@ os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Simple-Q7S"
|
||||
build_generator="Ninja"
|
||||
definitions="Q7S_SIMPLE_MODE=On"
|
||||
definitions="BUILD_Q7S_SIMPLE_MODE=On"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
@ -28,7 +29,7 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l "${build_dir}" -d "${definitions}"
|
||||
# set +x
|
||||
|
37
cmake/scripts/Q7S/watchdog/make-debug-cfg.sh
Executable file
37
cmake/scripts/Q7S/watchdog/make-debug-cfg.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Debug-Watchdog"
|
||||
build_generator=""
|
||||
definitions="EIVE_BUILD_WATCHDOG=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-d "${definitions}" -l"${build_dir}"
|
||||
# set +x
|
||||
|
@ -16,8 +16,9 @@ fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Debug-Q7S"
|
||||
build_dir="build-Release-Watchdog"
|
||||
build_generator=""
|
||||
definitions="EIVE_BUILD_WATCHDOG=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
python="py"
|
||||
@ -29,7 +30,7 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
|
||||
-d "${definitions} -l"${build_dir}"
|
||||
# set +x
|
||||
|
35
cmake/scripts/Q7S/watchdog/ninja-debug-cfg.sh
Executable file
35
cmake/scripts/Q7S/watchdog/ninja-debug-cfg.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Debug-Watchdog"
|
||||
build_generator="Ninja"
|
||||
definitions="EIVE_BUILD_WATCHDOG=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-d "${definitions}" -l "${build_dir}"
|
||||
# set +x
|
||||
|
35
cmake/scripts/Q7S/watchdog/ninja-release-cfg.sh
Executable file
35
cmake/scripts/Q7S/watchdog/ninja-release-cfg.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/q7s"
|
||||
build_dir="build-Release-Watchdog"
|
||||
build_generator="Ninja"
|
||||
definitions="EIVE_BUILD_WATCHDOG=ON"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
python="py"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
python="python3"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
|
||||
-d "${definitions}" -l"${build_dir}"
|
||||
# set +x
|
||||
|
@ -1,19 +1,21 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/raspberrypi"
|
||||
build_generator=""
|
||||
@ -29,7 +31,6 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
||||
|
33
cmake/scripts/RPi/make-release-cfg.sh
Executable file
33
cmake/scripts/RPi/make-release-cfg.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/raspberrypi"
|
||||
build_generator=""
|
||||
build_dir="build-Release-RPi"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
os_fsfw="linux"
|
||||
tgt_bsp="arm/raspberrypi"
|
||||
build_generator=""
|
||||
build_dir="build-Release-RPi"
|
||||
if [ "${OS}" = "Windows_NT" ]; then
|
||||
build_generator="MinGW Makefiles"
|
||||
# Could be other OS but this works for now.
|
||||
else
|
||||
build_generator="Unix Makefiles"
|
||||
fi
|
||||
|
||||
python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
counter=0
|
||||
cfg_script_name="cmake-build-cfg.py"
|
||||
while [ ${counter} -lt 5 ]
|
||||
do
|
||||
cd ..
|
||||
if [ -f "cmake_build_config.py" ];then
|
||||
if [ -f ${cfg_script_name} ];then
|
||||
break
|
||||
fi
|
||||
counter=$((counter=counter + 1))
|
||||
done
|
||||
|
||||
if [ "${counter}" -ge 5 ];then
|
||||
echo "cmake_build_config.py not found in upper directories!"
|
||||
echo "${cfg_script_name} not found in upper directories!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -27,7 +28,7 @@ fi
|
||||
|
||||
echo "Running command (without the leading +):"
|
||||
set -x # Print command
|
||||
${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \
|
||||
-l"${build_dir}"
|
||||
# set +x
|
||||
|
@ -4,7 +4,7 @@
|
||||
const char* const SW_NAME = "eive";
|
||||
|
||||
#define SW_VERSION 1
|
||||
#define SW_SUBVERSION 5
|
||||
#define SW_SUBVERSION 7
|
||||
#define SW_REVISION 0
|
||||
|
||||
#endif /* COMMON_CONFIG_OBSWVERSION_H_ */
|
||||
|
@ -13,12 +13,15 @@ enum commonClassIds: uint8_t {
|
||||
HEATER_HANDLER, //HEATER
|
||||
SYRLINKS_HANDLER, //SYRLINKS
|
||||
IMTQ_HANDLER, //IMTQ
|
||||
RW_HANDLER, //Reaction Wheels
|
||||
STR_HANDLER, //Star tracker
|
||||
PLOC_MPSOC_HANDLER, //PLOC MPSoC
|
||||
PLOC_SUPERVISOR_HANDLER, //PLOC Supervisor
|
||||
RW_HANDLER, //RWHA
|
||||
STR_HANDLER, //STRH
|
||||
PLOC_MPSOC_HANDLER, //PLMP
|
||||
PLOC_SUPERVISOR_HANDLER, //PLSV
|
||||
SUS_HANDLER, //SUSS
|
||||
CCSDS_IP_CORE_BRIDGE, // IP Core interface
|
||||
CCSDS_IP_CORE_BRIDGE, //IPCI
|
||||
PLOC_UPDATER, //PLUD
|
||||
GOM_SPACE_HANDLER, //GOMS
|
||||
PLOC_MEMORY_DUMPER, //PLMEMDUMP
|
||||
COMMON_CLASS_ID_END // [EXPORT] : [END]
|
||||
};
|
||||
|
||||
|
@ -3,5 +3,8 @@
|
||||
|
||||
#define OBSW_ADD_LWGPS_TEST 0
|
||||
|
||||
// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally
|
||||
// because UDP packets are not allowed in the VPN
|
||||
#define OBSW_USE_TMTC_TCP_BRIDGE 1
|
||||
|
||||
#endif /* COMMON_CONFIG_COMMONCONFIG_H_ */
|
||||
|
@ -8,8 +8,8 @@ enum commonObjects: uint32_t {
|
||||
/* First Byte 0x50-0x52 reserved for PUS Services **/
|
||||
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
|
||||
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
||||
UDP_BRIDGE = 0x50000300,
|
||||
UDP_POLLING_TASK = 0x50000400,
|
||||
TMTC_BRIDGE = 0x50000300,
|
||||
TMTC_POLLING_TASK = 0x50000400,
|
||||
FILE_SYSTEM_HANDLER = 0x50000500,
|
||||
|
||||
/* 0x43 ('C') for Controllers */
|
||||
@ -75,12 +75,15 @@ enum commonObjects: uint32_t {
|
||||
GPS0_HANDLER = 0x44130045,
|
||||
GPS1_HANDLER = 0x44130146,
|
||||
|
||||
RW1 = 0x44120001,
|
||||
RW2 = 0x44120002,
|
||||
RW3 = 0x44120003,
|
||||
RW4 = 0x44120004,
|
||||
RW1 = 0x44120047,
|
||||
RW2 = 0x44120148,
|
||||
RW3 = 0x44120249,
|
||||
RW4 = 0x44120350,
|
||||
|
||||
START_TRACKER = 0x44130001
|
||||
START_TRACKER = 0x44130001,
|
||||
|
||||
PLOC_UPDATER = 0x44330000,
|
||||
PLOC_MEMORY_DUMPER = 0x44330001
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ enum: uint8_t {
|
||||
STR_HANDLER = 114,
|
||||
PLOC_SUPERVISOR_HANDLER = 115,
|
||||
FILE_SYSTEM = 116,
|
||||
PLOC_UPDATER = 117,
|
||||
PLOC_MEMORY_DUMPER = 118,
|
||||
COMMON_SUBSYSTEM_ID_END
|
||||
};
|
||||
}
|
||||
|
50
common/config/devConf.h
Normal file
50
common/config/devConf.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef COMMON_CONFIG_DEVCONF_H_
|
||||
#define COMMON_CONFIG_DEVCONF_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <fsfw_hal/linux/spi/spiDefinitions.h>
|
||||
|
||||
/**
|
||||
* SPI configuration will be contained here to let the device handlers remain independent
|
||||
* of SPI specific properties.
|
||||
*/
|
||||
namespace spi {
|
||||
|
||||
// Default values, changing them is not supported for now
|
||||
static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000;
|
||||
static constexpr uint32_t LIS3_TRANSITION_DELAY = 10000;
|
||||
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
|
||||
static constexpr uint32_t RM3100_TRANSITION_DELAY = 10000;
|
||||
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000;
|
||||
static constexpr uint32_t L3G_TRANSITION_DELAY = 10000;
|
||||
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
|
||||
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000;
|
||||
static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t RW_SPEED = 300'000;
|
||||
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
|
||||
|
||||
static constexpr uint32_t RTD_SPEED = 2'000'000;
|
||||
|
||||
}
|
||||
|
||||
namespace uart {
|
||||
|
||||
static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
|
||||
static constexpr uint32_t SYRLINKS_BAUD = 38400;
|
||||
static constexpr uint32_t GNSS_BAUD = 9600;
|
||||
static constexpr uint32_t PLOC_MPSOC_BAUD = 115200;
|
||||
static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200;
|
||||
static constexpr uint32_t STAR_TRACKER_BAUD = 115200;
|
||||
|
||||
}
|
||||
|
||||
#endif /* COMMON_CONFIG_DEVCONF_H_ */
|
@ -1,34 +0,0 @@
|
||||
#ifndef COMMON_CONFIG_SPICONF_H_
|
||||
#define COMMON_CONFIG_SPICONF_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <fsfw/hal/linux/spi/spiDefinitions.h>
|
||||
|
||||
/**
|
||||
* SPI configuration will be contained here to let the device handlers remain independent
|
||||
* of SPI specific properties.
|
||||
*/
|
||||
namespace spi {
|
||||
|
||||
/* Default values, changing them is not supported for now */
|
||||
static constexpr uint32_t DEFAULT_LIS3_SPEED = 3'900'000;
|
||||
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
|
||||
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_L3G_SPEED = 3'900'000;
|
||||
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
|
||||
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t DEFAULT_ADIS16507_SPEED = 976'000;
|
||||
static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;
|
||||
|
||||
static constexpr uint32_t RW_SPEED = 300000;
|
||||
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
|
||||
|
||||
}
|
||||
|
||||
#endif /* COMMON_CONFIG_SPICONF_H_ */
|
BIN
doc/img/eive-logo.png
Normal file
BIN
doc/img/eive-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user