TAS PLOC SUPV 3 #326

Merged
muellerr merged 9 commits from mueller/tas_ploc_supv_3 into develop 2022-11-28 18:26:44 +01:00
5 changed files with 55 additions and 28 deletions
Showing only changes of commit 2338d951c7 - Show all commits

View File

@ -22,24 +22,38 @@ def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Processing arguments for CMake build configuration." description="Processing arguments for CMake build configuration."
) )
parser.add_argument("-o", "--osal", type=str, choices=["freertos", "linux", "rtems", "host"],
help="FSFW OSAL. Valid arguments: host, linux, rtems, freertos")
parser.add_argument( parser.add_argument(
"-b", "--buildtype", type=str, choices=["debug", "release", "size", "reldeb"], "-o",
"--osal",
type=str,
choices=["freertos", "linux", "rtems", "host"],
help="FSFW OSAL. Valid arguments: host, linux, rtems, freertos",
)
parser.add_argument(
"-b",
"--buildtype",
type=str,
choices=["debug", "release", "size", "reldeb"],
help="CMake build type. Valid arguments: debug, release, size, reldeb (Release with Debug " help="CMake build type. Valid arguments: debug, release, size, reldeb (Release with Debug "
"Information)", default="debug" "Information)",
default="debug",
) )
parser.add_argument("-l", "--builddir", type=str, help="Specify build directory.") parser.add_argument("-l", "--builddir", type=str, help="Specify build directory.")
parser.add_argument( parser.add_argument(
"-g", "--generator", type=str, help="CMake Generator", choices=['make', 'ninja'] "-g", "--generator", type=str, help="CMake Generator", choices=["make", "ninja"]
) )
parser.add_argument( parser.add_argument(
"-d", "--defines", "-d",
"--defines",
help="Additional custom defines passed to CMake (supply without -D prefix!)", help="Additional custom defines passed to CMake (supply without -D prefix!)",
nargs="*", type=str nargs="*",
type=str,
) )
parser.add_argument( parser.add_argument(
"-t", "--target-bsp", type=str, help="Target BSP, combination of architecture and machine" "-t",
"--target-bsp",
type=str,
help="Target BSP, combination of architecture and machine",
) )
args = parser.parse_args() args = parser.parse_args()
@ -59,13 +73,13 @@ def main():
if args.generator is None: if args.generator is None:
generator_cmake_arg = "" generator_cmake_arg = ""
else: else:
if args.generator == 'make': if args.generator == "make":
if os.name == 'nt': if os.name == "nt":
generator_cmake_arg = '-G "MinGW Makefiles"' generator_cmake_arg = '-G "MinGW Makefiles"'
else: else:
generator_cmake_arg = '-G "Unix Makefiles"' generator_cmake_arg = '-G "Unix Makefiles"'
elif args.generator == 'ninja': elif args.generator == "ninja":
generator_cmake_arg = '-G Ninja' generator_cmake_arg = "-G Ninja"
else: else:
generator_cmake_arg = args.generator generator_cmake_arg = args.generator
@ -79,7 +93,7 @@ def main():
cmake_build_type = "RelWithDebInfo" cmake_build_type = "RelWithDebInfo"
if args.target_bsp is not None: if args.target_bsp is not None:
cmake_target_cfg_cmd = f"-DTGT_BSP=\"{args.target_bsp}\"" cmake_target_cfg_cmd = f'-DTGT_BSP="{args.target_bsp}"'
else: else:
cmake_target_cfg_cmd = "" cmake_target_cfg_cmd = ""
@ -92,10 +106,12 @@ def main():
build_folder = cmake_build_type build_folder = cmake_build_type
if args.builddir is not None: if args.builddir is not None:
build_folder = args.builddir build_folder = args.builddir
build_path = source_location + os.path.sep + build_folder build_path = source_location + os.path.sep + build_folder
if os.path.isdir(build_path): if os.path.isdir(build_path):
remove_old_dir = input(f"{build_folder} folder already exists. Remove old directory? [y/n]: ") remove_old_dir = input(
f"{build_folder} folder already exists. Remove old directory? [y/n]: "
)
if str(remove_old_dir).lower() in ["yes", "y", 1]: if str(remove_old_dir).lower() in ["yes", "y", 1]:
remove_old_dir = True remove_old_dir = True
else: else:
@ -109,17 +125,19 @@ def main():
print(f"Navigating into build directory: {build_path}") print(f"Navigating into build directory: {build_path}")
os.chdir(build_folder) os.chdir(build_folder)
cmake_command = f"cmake {generator_cmake_arg} -DFSFW_OSAL=\"{osal}\" " \ cmake_command = (
f"-DCMAKE_BUILD_TYPE=\"{cmake_build_type}\" {cmake_target_cfg_cmd} " \ f'cmake {generator_cmake_arg} -DFSFW_OSAL="{osal}" '
f"{define_string} {source_location}" f'-DCMAKE_BUILD_TYPE="{cmake_build_type}" {cmake_target_cfg_cmd} '
f"{define_string} {source_location}"
)
# Remove redundant spaces # Remove redundant spaces
cmake_command = ' '.join(cmake_command.split()) cmake_command = " ".join(cmake_command.split())
print("Running CMake command: ") print("Running CMake command: ")
print(f"\" {cmake_command} \"") print(f'" {cmake_command} "')
os.system(cmake_command) os.system(cmake_command)
print("-- CMake configuration done. --") print("-- CMake configuration done. --")
def rm_build_dir(path: str): def rm_build_dir(path: str):
# On windows the permissions of the build directory may have been set to read-only. If this # On windows the permissions of the build directory may have been set to read-only. If this
# is the case the permissions are changed before trying to delete the directory. # is the case the permissions are changed before trying to delete the directory.
@ -134,7 +152,9 @@ def determine_source_location() -> str:
index += 1 index += 1
os.chdir("..") os.chdir("..")
if index >= 5: if index >= 5:
print("Error: Could not find source directory (determined by looking for fsfw folder!)") print(
"Error: Could not find source directory (determined by looking for fsfw folder!)"
)
sys.exit(1) sys.exit(1)
return os.getcwd() return os.getcwd()

View File

@ -379,6 +379,11 @@ ReturnValue_t PlocSupvUartManager::writeUpdatePackets() {
ProgressPrinter::HALF_PERCENT); ProgressPrinter::HALF_PERCENT);
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */ #endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
uint8_t tempData[supv::WriteMemory::CHUNK_MAX + 1]{}; uint8_t tempData[supv::WriteMemory::CHUNK_MAX + 1]{};
if (not std::filesystem::exists(update.file)) {
sif::error << "PlocSupvUartManager::writeUpdatePackets: File "
<< update.file << " does not exist" << std::endl;
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
}
std::ifstream file(update.file, std::ifstream::binary); std::ifstream file(update.file, std::ifstream::binary);
uint16_t dataLength = 0; uint16_t dataLength = 0;
ccsds::SequenceFlags seqFlags; ccsds::SequenceFlags seqFlags;

View File

@ -253,7 +253,7 @@ class PlocSupvUartManager : public DeviceCommunicationIF,
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{}; std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
bool printTc = false; bool printTc = true;
bool debugMode = false; bool debugMode = false;
bool timestamping = true; bool timestamping = true;

View File

@ -17,7 +17,9 @@ def main():
def prompt_ssh_key_removal(): def prompt_ssh_key_removal():
do_remove_key = input("Do you want to remove problematic keys on localhost ([Y]/n)?: ") do_remove_key = input(
"Do you want to remove problematic keys on localhost ([Y]/n)?: "
)
if not do_remove_key.lower() in ["y", "yes", "1", ""]: if not do_remove_key.lower() in ["y", "yes", "1", ""]:
sys.exit(1) sys.exit(1)
port = 0 port = 0
@ -65,7 +67,7 @@ def handle_args():
"--flatsat", "--flatsat",
default=False, default=False,
action="store_true", action="store_true",
help="Copy to flatsat instead" help="Copy to flatsat instead",
) )
# Positional argument(s) # Positional argument(s)
parser.add_argument( parser.add_argument(
@ -86,7 +88,7 @@ def build_cmd(args):
address = "eive@flatsat.eive.absatvirt.lw" address = "eive@flatsat.eive.absatvirt.lw"
else: else:
address = "root@localhost" address = "root@localhost"
port_args=f"-P {args.port}" port_args = f"-P {args.port}"
if args.invert: if args.invert:
if target == "": if target == "":
target = "." target = "."

2
tmtc

@ -1 +1 @@
Subproject commit a54ae782d46f6f405df8e62ab80b556f971df369 Subproject commit a47ca5c901e340f4c07bbb778dd63bb61554dbc4