fsfwgen update
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-06-20 18:05:05 +02:00
parent 83c93a9637
commit d4a1cb9f62
12 changed files with 627 additions and 1023 deletions

View File

@ -4,6 +4,7 @@ Event exporter.
import datetime
import time
import os
from pathlib import Path
from fsfwgen.events.event_parser import (
handle_csv_export,
@ -31,24 +32,24 @@ MOVE_CSV_FILE = True
PARSE_HOST_BSP = True
# Store these files relative to the events folder
CPP_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.cpp"
CPP_H_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.h"
CPP_FILENAME = Path(f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.cpp")
CPP_H_FILENAME = Path(f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.h")
BSP_SELECT = BspType.BSP_Q7S
BSP_DIR_NAME = BSP_SELECT.value
# Store this file in the root of the generators folder
CSV_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_events.csv"
CSV_COPY_DEST = f"{OBSW_ROOT_DIR}/tmtc/config/events.csv"
CSV_FILENAME = Path(f"{ROOT_DIR}/{BSP_SELECT.value}_events.csv")
CSV_COPY_DEST = Path(f"{OBSW_ROOT_DIR}/tmtc/config/events.csv")
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/linux/fsfwconfig"
FSFW_CONFIG_ROOT = Path(f"{OBSW_ROOT_DIR}/linux/fsfwconfig")
else:
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}/fsfwconfig"
FSFW_CONFIG_ROOT = Path(f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}/fsfwconfig")
CPP_COPY_DESTINATION = f"{FSFW_CONFIG_ROOT}/events/"
CPP_COPY_DESTINATION = Path(f"{FSFW_CONFIG_ROOT}/events/")
FILE_SEPARATOR = ";"
SUBSYSTEM_DEFINITION_DESTINATIONS = [
@ -56,14 +57,19 @@ SUBSYSTEM_DEFINITION_DESTINATIONS = [
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/events/fwSubsystemIdRanges.h",
f"{OBSW_ROOT_DIR}/common/config/commonSubsystemIds.h",
]
SUBSYSTEM_DEFS_DEST_AS_PATH = [Path(x) for x in SUBSYSTEM_DEFINITION_DESTINATIONS]
HEADER_DEFINITION_DESTINATIONS = [
f"{OBSW_ROOT_DIR}/mission/",
f"{OBSW_ROOT_DIR}/fsfw/",
f"{FSFW_CONFIG_ROOT}",
f"{OBSW_ROOT_DIR}/test/",
f"{OBSW_ROOT_DIR}/bsp_q7s",
f"{OBSW_ROOT_DIR}/bsp_q7s/",
f"{OBSW_ROOT_DIR}/linux/",
]
HEADER_DEFINITION_DESTINATIONS_AS_PATH = [
Path(x) for x in HEADER_DEFINITION_DESTINATIONS
]
def parse_events(
@ -96,17 +102,19 @@ def parse_events(
header_file_name=CPP_H_FILENAME,
)
if COPY_CPP_FILE:
LOGGER.info(f"EventParser: Copying CPP translation file to {CPP_COPY_DESTINATION}")
LOGGER.info(
f"EventParser: Copying CPP translation file to {CPP_COPY_DESTINATION}"
)
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
copy_file(CPP_H_FILENAME, CPP_COPY_DESTINATION)
def generate_event_list() -> list:
subsystem_parser = SubsystemDefinitionParser(SUBSYSTEM_DEFINITION_DESTINATIONS)
subsystem_parser = SubsystemDefinitionParser(SUBSYSTEM_DEFS_DEST_AS_PATH)
subsystem_table = subsystem_parser.parse_files()
LOGGER.info(f"Found {len(subsystem_table)} subsystem definitions.")
PrettyPrinter.pprint(subsystem_table)
event_header_parser = FileListParser(HEADER_DEFINITION_DESTINATIONS)
event_header_parser = FileListParser(HEADER_DEFINITION_DESTINATIONS_AS_PATH)
event_headers = event_header_parser.parse_header_files(
True, "Parsing event header file list:\n", True
)