fsfwgen update #267
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -11,7 +11,7 @@
|
||||
path = thirdparty/lwgps
|
||||
url = https://github.com/rmspacefish/lwgps.git
|
||||
[submodule "generators/fsfwgen"]
|
||||
path = generators/fsfwgen
|
||||
path = generators/deps/fsfwgen
|
||||
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
|
||||
[submodule "thirdparty/arcsec_star_tracker"]
|
||||
path = thirdparty/arcsec_star_tracker
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 7f3e5e42bb209aa6d2f71ce644340fd27e9cc29b
|
||||
Subproject commit 5abbf42e9f9b48cc244faabe88dc845e66cd0d24
|
@ -1,3 +1,4 @@
|
||||
Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
2200;0x0898;STORE_SEND_WRITE_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2201;0x0899;STORE_WRITE_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
2202;0x089a;STORE_SEND_READ_FAILED;LOW;;fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
|
||||
|
|
@ -110,6 +110,7 @@
|
||||
0x54000010;SPI_TEST
|
||||
0x54000020;UART_TEST
|
||||
0x54000030;I2C_TEST
|
||||
0x54000040;DUMMY_COM_IF
|
||||
0x5400AFFE;DUMMY_HANDLER
|
||||
0x5400CAFE;DUMMY_INTERFACE
|
||||
0x54123456;LIBGPIOD_TEST
|
||||
|
|
File diff suppressed because it is too large
Load Diff
1
generators/deps/fsfwgen
Submodule
1
generators/deps/fsfwgen
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a5dee6e41749508a85842a931e6f1d210aee2031
|
@ -4,17 +4,19 @@ Event exporter.
|
||||
import datetime
|
||||
import time
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from fsfwgen.events.event_parser import (
|
||||
handle_csv_export,
|
||||
handle_cpp_export,
|
||||
SubsystemDefinitionParser,
|
||||
EventParser,
|
||||
EventDictT,
|
||||
)
|
||||
from fsfwgen.parserbase.file_list_parser import FileListParser
|
||||
from fsfwgen.utility.printer import PrettyPrinter
|
||||
from fsfwgen.utility.file_management import copy_file
|
||||
from fsfwgen.core import get_console_logger
|
||||
from fsfwgen.logging import get_console_logger
|
||||
from definitions import BspType, ROOT_DIR, OBSW_ROOT_DIR
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
@ -31,24 +33,28 @@ 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 +62,21 @@ 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
|
||||
]
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def parse_events(
|
||||
@ -77,7 +90,6 @@ def parse_events(
|
||||
PrettyPrinter.pprint(event_list)
|
||||
# Delay for clean printout
|
||||
time.sleep(0.1)
|
||||
# xml_test()
|
||||
if generate_csv:
|
||||
handle_csv_export(
|
||||
file_name=CSV_FILENAME, event_list=event_list, file_separator=FILE_SEPARATOR
|
||||
@ -96,17 +108,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)
|
||||
def generate_event_list() -> EventDictT:
|
||||
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
|
||||
)
|
||||
@ -116,6 +130,6 @@ def generate_event_list() -> list:
|
||||
event_parser.obsw_root_path = OBSW_ROOT_DIR
|
||||
event_parser.set_moving_window_mode(moving_window_size=7)
|
||||
event_table = event_parser.parse_files()
|
||||
event_list = sorted(event_table.items())
|
||||
LOGGER.info(f"Found {len(event_list)} entries")
|
||||
return event_list
|
||||
events_sorted = dict(sorted(event_table.items()))
|
||||
LOGGER.info(f"Found {len(events_sorted)} entries")
|
||||
return events_sorted
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 207 translations.
|
||||
* @details
|
||||
* Generated on: 2022-06-10 18:08:57
|
||||
* Generated on: 2022-06-21 01:20:13
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 169ad98cdeebe3ccfd1b78938934496a20b6a294
|
@ -7,10 +7,8 @@ from returnvalues.returnvalues_parser import parse_returnvalues
|
||||
from fsfwgen.core import (
|
||||
return_generic_args_parser,
|
||||
init_printout,
|
||||
get_console_logger,
|
||||
ParserTypes,
|
||||
)
|
||||
|
||||
from fsfwgen.logging import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
@ -20,7 +18,7 @@ def main():
|
||||
parser = return_generic_args_parser()
|
||||
args = parser.parse_args()
|
||||
if args.type == "objects":
|
||||
LOGGER.info(f"Generating objects data..")
|
||||
LOGGER.info(f"Generating objects data")
|
||||
time.sleep(0.05)
|
||||
parse_objects()
|
||||
elif args.type == "events":
|
||||
|
@ -3,8 +3,9 @@ Object exporter.
|
||||
"""
|
||||
import datetime
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from fsfwgen.core import get_console_logger
|
||||
from fsfwgen.logging import get_console_logger
|
||||
from fsfwgen.objects.objects import (
|
||||
sql_object_exporter,
|
||||
ObjectDefinitionParser,
|
||||
@ -46,11 +47,11 @@ CSV_COPY_DEST = f"{OBSW_ROOT_DIR}/tmtc/config/objects.csv"
|
||||
FILE_SEPARATOR = ";"
|
||||
|
||||
|
||||
OBJECTS_PATH = f"{FSFW_CONFIG_ROOT}/objects/systemObjectList.h"
|
||||
FRAMEWORK_OBJECT_PATH = (
|
||||
OBJECTS_PATH = Path(f"{FSFW_CONFIG_ROOT}/objects/systemObjectList.h")
|
||||
FRAMEWORK_OBJECT_PATH = Path(
|
||||
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/objectmanager/frameworkObjects.h"
|
||||
)
|
||||
COMMON_OBJECTS_PATH = f"{OBSW_ROOT_DIR}/common/config/commonObjects.h"
|
||||
COMMON_OBJECTS_PATH = Path(f"{OBSW_ROOT_DIR}/common/config/commonObjects.h")
|
||||
OBJECTS_DEFINITIONS = [OBJECTS_PATH, FRAMEWORK_OBJECT_PATH, COMMON_OBJECTS_PATH]
|
||||
|
||||
SQL_DELETE_OBJECTS_CMD = """
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 131 translations.
|
||||
* Generated on: 2022-06-10 18:08:53
|
||||
* Contains 132 translations.
|
||||
* Generated on: 2022-06-21 00:51:33
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -118,6 +118,7 @@ const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *UART_TEST_STRING = "UART_TEST";
|
||||
const char *I2C_TEST_STRING = "I2C_TEST";
|
||||
const char *DUMMY_COM_IF_STRING = "DUMMY_COM_IF";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
@ -364,6 +365,8 @@ const char *translateObject(object_id_t object) {
|
||||
return UART_TEST_STRING;
|
||||
case 0x54000030:
|
||||
return I2C_TEST_STRING;
|
||||
case 0x54000040:
|
||||
return DUMMY_COM_IF_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
|
@ -3,10 +3,16 @@
|
||||
"""Part of the MIB export tools for the EIVE project by.
|
||||
Returnvalue exporter.
|
||||
"""
|
||||
from fsfwgen.core import get_console_logger
|
||||
from pathlib import Path
|
||||
|
||||
from fsfwgen.logging import get_console_logger
|
||||
from fsfwgen.utility.file_management import copy_file
|
||||
from fsfwgen.parserbase.file_list_parser import FileListParser
|
||||
from fsfwgen.returnvalues.returnvalues_parser import InterfaceParser, ReturnValueParser
|
||||
from fsfwgen.returnvalues.returnvalues_parser import (
|
||||
InterfaceParser,
|
||||
ReturnValueParser,
|
||||
RetvalDictT,
|
||||
)
|
||||
from fsfwgen.utility.sql_writer import SqlWriter
|
||||
from fsfwgen.utility.printer import PrettyPrinter
|
||||
|
||||
@ -24,8 +30,8 @@ MAX_STRING_LENGTH = 32
|
||||
|
||||
BSP_SELECT = BspType.BSP_Q7S
|
||||
BSP_DIR_NAME = BSP_SELECT.value
|
||||
CSV_RETVAL_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_returnvalues.csv"
|
||||
CSV_COPY_DEST = f"{OBSW_ROOT_DIR}/tmtc/config/returnvalues.csv"
|
||||
CSV_RETVAL_FILENAME = Path(f"{ROOT_DIR}/{BSP_SELECT.value}_returnvalues.csv")
|
||||
CSV_COPY_DEST = Path(f"{OBSW_ROOT_DIR}/tmtc/config/returnvalues.csv")
|
||||
ADD_LINUX_FOLDER = False
|
||||
|
||||
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
||||
@ -45,6 +51,7 @@ RETURNVALUE_SOURCES = [
|
||||
f"{OBSW_ROOT_DIR}/fsfw/",
|
||||
f"{BSP_PATH}",
|
||||
]
|
||||
RETVAL_SRCS_AS_PATH = [Path(x) for x in RETURNVALUE_SOURCES]
|
||||
|
||||
if ADD_LINUX_FOLDER:
|
||||
RETURNVALUE_SOURCES.append(f"{OBSW_ROOT_DIR}/linux")
|
||||
@ -73,7 +80,7 @@ VALUES(?,?,?,?,?)
|
||||
def parse_returnvalues():
|
||||
returnvalue_table = generate_returnvalue_table()
|
||||
if EXPORT_TO_FILE:
|
||||
ReturnValueParser.export_to_file(
|
||||
ReturnValueParser.export_to_csv(
|
||||
CSV_RETVAL_FILENAME, returnvalue_table, FILE_SEPARATOR
|
||||
)
|
||||
if COPY_CSV_FILE:
|
||||
@ -95,7 +102,7 @@ def generate_returnvalue_table():
|
||||
file_list=INTERFACE_DEFINITION_FILES, print_table=PRINT_TABLES
|
||||
)
|
||||
interfaces = interface_parser.parse_files()
|
||||
header_parser = FileListParser(RETURNVALUE_SOURCES)
|
||||
header_parser = FileListParser(RETVAL_SRCS_AS_PATH)
|
||||
header_list = header_parser.parse_header_files(True, "Parsing header file list: ")
|
||||
returnvalue_parser = ReturnValueParser(interfaces, header_list, PRINT_TABLES)
|
||||
returnvalue_parser.obsw_root_path = OBSW_ROOT_DIR
|
||||
@ -105,13 +112,19 @@ def generate_returnvalue_table():
|
||||
return returnvalue_table
|
||||
|
||||
|
||||
def sql_retval_exporter(returnvalue_table, db_filename: str):
|
||||
def sql_retval_exporter(returnvalue_table: RetvalDictT, db_filename: str):
|
||||
sql_writer = SqlWriter(db_filename=db_filename)
|
||||
sql_writer.open(SQL_CREATE_RETURNVALUES_CMD)
|
||||
for entry in returnvalue_table.items():
|
||||
sql_writer.write_entries(
|
||||
SQL_INSERT_RETURNVALUES_CMD,
|
||||
(entry[0], entry[1][2], entry[1][4], entry[1][3], entry[1][1]),
|
||||
(
|
||||
entry[0],
|
||||
entry[1].name,
|
||||
entry[1].description,
|
||||
entry[1].unique_id,
|
||||
entry[1].subsystem_name,
|
||||
),
|
||||
)
|
||||
sql_writer.commit()
|
||||
sql_writer.close()
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 207 translations.
|
||||
* @details
|
||||
* Generated on: 2022-06-10 18:08:57
|
||||
* Generated on: 2022-06-21 01:20:13
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 131 translations.
|
||||
* Generated on: 2022-06-10 18:08:53
|
||||
* Contains 132 translations.
|
||||
* Generated on: 2022-06-21 00:51:33
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -118,6 +118,7 @@ const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *UART_TEST_STRING = "UART_TEST";
|
||||
const char *I2C_TEST_STRING = "I2C_TEST";
|
||||
const char *DUMMY_COM_IF_STRING = "DUMMY_COM_IF";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
@ -364,6 +365,8 @@ const char *translateObject(object_id_t object) {
|
||||
return UART_TEST_STRING;
|
||||
case 0x54000030:
|
||||
return I2C_TEST_STRING;
|
||||
case 0x54000040:
|
||||
return DUMMY_COM_IF_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit c9d35df27741f7cd6250c27ed9771e9979c6c5e7
|
||||
Subproject commit eced453886859b1dd3daf0943eda2835acdfa71c
|
Loading…
Reference in New Issue
Block a user