Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ build_fw_deploy
build_fw_deploy_wsl
build_fw_dev
build_fw_dev_wsl
build_fw_chimera
build_fw_test
build_fw_test_wsl

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ENDIF ()
# ======== Code Time ========
option(PLATFORM "The platform to build for, either \"firmware\" or \"dimos\"" "firmware")
option(TARGET "The target to build for. Choose between \"binary\" and \"test\"." "binary")
option(FIRMWARE_TARGET "The firmware target to build for. Choose between \"dev\" and \"chimera\"." "dev")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make it so that firmware builds have chimera and non-chimera targets? achieved by making seperate chimera targets

message("")
message("⚙️ Configuring for \"${PLATFORM}\" platform and \"${TARGET}\" build target")
IF ("${PLATFORM}" STREQUAL "firmware")
Expand Down
18 changes: 18 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@
"CMAKE_BUILD_TYPE": "Debug",
"PLATFORM": "firmware",
"TARGET": "binary",
"FIRMWARE_TARGET": "dev",
"USE_COMMIT_INFO": "ON",
"BOOTLOAD": "ON",
"WATCHDOG": "ON"
},
"binaryDir": "build_fw_dev"
},
{
"name": "FW Chimera",
"description": "Chimera build for the Firmware, including debug information.",
"inherits": "FW Dev",
"cacheVariables": {
"FIRMWARE_TARGET": "chimera",
"BOOTLOAD": "OFF",
"WATCHDOG": "OFF"
},
"binaryDir": "build_fw_chimera"
},
{
"name": "FW Deploy",
"description": "Deployment build for the Firmware, including optimizations and no debug information.",
Expand All @@ -29,6 +41,7 @@
"CMAKE_BUILD_TYPE": "Release",
"PLATFORM": "firmware",
"TARGET": "binary",
"FIRMWARE_TARGET": "dev",
"USE_COMMIT_INFO": "ON",
"BOOTLOAD": "ON",
"WATCHDOG": "ON"
Expand All @@ -40,6 +53,11 @@
"inherits": "FW Dev",
"generator": "Ninja"
},
{
"name": "FW Chimera Ninja",
"inherits": "FW Chimera",
"generator": "Ninja"
},
{
"name": "FW Deploy Ninja",
"inherits": "FW Deploy",
Expand Down
8 changes: 5 additions & 3 deletions firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ ENDIF ()
add_subdirectory(third_party)
add_subdirectory(shared)
IF ("${TARGET}" STREQUAL "binary")
# add_subdirectory(chimera)
add_subdirectory(chimera_v2)
add_subdirectory(dev)
IF ("${FIRMWARE_TARGET}" STREQUAL "chimera")
add_subdirectory(chimera_v2)
add_compile_definitions(USE_CHIMERA)
ENDIF ()
ENDIF ()
add_subdirectory(logfs)
add_subdirectory(quintuna)
add_subdirectory(dev)
add_subdirectory(hexray)
17 changes: 15 additions & 2 deletions firmware/dev/f4dev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ set(IOC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/f4dev.ioc")
set(LINKER_SCRIPT "${LINKER_DIR}/stm32f412rgtx/stm32f412rgtx_app_only.ld")

file(GLOB_RECURSE EMBEDDED_SRCS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/hw/*.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/tasks.cpp")
if(NOT USE_CHIMERA)
list(REMOVE_ITEM EMBEDDED_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/hw/hw_chimeraConfig_v2.c")
endif()

list(FILTER HW_SRCS EXCLUDE REGEX ".*/hw_chimeraConfig_v2\\.c$")

file(GLOB CUBEMX_SRCS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Src/*.c")
list(REMOVE_ITEM CUBEMX_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Src/sysmem.c")
Expand All @@ -22,14 +27,19 @@ list(APPEND EMBEDDED_SRCS
"${SHARED_HW_INCLUDE_DIR_CPP}/hw_can_f4.cpp"
"${SHARED_IO_INCLUDE_DIR_CPP}/io_time.cpp"
"${SHARED_IO_INCLUDE_DIR}/io_canQueue.c"
"${SHARED_HW_INCLUDE_DIR}/hw_chimera_v2.c"
# "${SHARED_HW_INCLUDE_DIR}/hw_utils.c"
"${SHARED_HW_INCLUDE_DIR}/hw_ubsan.c"
"${SHARED_HW_INCLUDE_DIR}/hw_error.c"
"${SHARED_HW_INCLUDE_DIR}/hw_freeRtosConfigs.c"
"${SHARED_HW_INCLUDE_DIR}/hw_bootup.c"
)

if ("${FIRMWARE_TARGET}" STREQUAL "chimera")
list(APPEND EMBEDDED_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_chimera_v2.c"
)
endif ()

set(EMBEDDED_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw" "${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Inc" "${CMAKE_CURRENT_SOURCE_DIR}/src"
"${SHARED_IO_INCLUDE_DIR}" "${SHARED_HW_INCLUDE_DIR}" "${SHARED_APP_INCLUDE_DIR}"
Expand Down Expand Up @@ -88,6 +98,9 @@ IF ("${TARGET}" STREQUAL "binary")
"${CMAKE_CURRENT_BINARY_DIR}/app"
)

target_link_libraries("f4dev.elf" PRIVATE "f4dev_stm32" "f4dev_commit_info" "chimera_v2_proto_cm4")
target_link_libraries("f4dev.elf" PRIVATE "f4dev_stm32" "f4dev_commit_info")
if ("${FIRMWARE_TARGET}" STREQUAL "chimera")
target_link_libraries("f4dev.elf" PRIVATE "chimera_v2_proto_cm4")
endif ()
target_compile_definitions("f4dev.elf" PRIVATE "HAL_SPI_MODULE_ENABLED" NO_BOOTLOADER)
ENDIF ()
13 changes: 11 additions & 2 deletions firmware/quintuna/BMS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ set(IO_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/io" "${SHARED_IO_INCLUDE_DI
file(GLOB_RECURSE HW_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw/*.c"
)
list(FILTER HW_SRCS EXCLUDE REGEX ".*/hw_chimeraConfig_v2\\.c$")
list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_usb.c"
"${SHARED_HW_INCLUDE_DIR}/hw_spi.c"
Expand All @@ -42,7 +43,6 @@ list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_error.c"
"${SHARED_HW_INCLUDE_DIR}/hw_can_h7.c"
"${SHARED_HW_INCLUDE_DIR}/hw_pwmInput.c"
"${SHARED_HW_INCLUDE_DIR}/hw_chimera_v2.c"
"${SHARED_HW_INCLUDE_DIR}/hw_watchdog.c"
"${SHARED_HW_INCLUDE_DIR}/hw_utils.c"
"${SHARED_HW_INCLUDE_DIR}/hw_ubsan.c"
Expand All @@ -52,6 +52,12 @@ list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_freeRtosConfigs.c"
"${SHARED_HW_INCLUDE_DIR}/hw_bootup.c"
)
if ("${FIRMWARE_TARGET}" STREQUAL "chimera")
list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_chimera_v2.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw/hw_chimeraConfig_v2.c"
)
endif()
set(HW_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw"
"${SHARED_HW_INCLUDE_DIR}"
Expand Down Expand Up @@ -121,7 +127,10 @@ if ("${TARGET}" STREQUAL "binary")
"${CMAKE_CURRENT_BINARY_DIR}/app"
)

target_link_libraries("quintuna_BMS_app.elf" PRIVATE "quintuna_BMS_stm32" "quintuna_BMS_jsoncan" "quintuna_BMS_commit_info" "chimera_v2_proto_cm7")
target_link_libraries("quintuna_BMS_app.elf" PRIVATE "quintuna_BMS_stm32" "quintuna_BMS_jsoncan" "quintuna_BMS_commit_info")
if ("${FIRMWARE_TARGET}" STREQUAL "chimera")
target_link_libraries("quintuna_BMS_app.elf" PRIVATE "chimera_v2_proto_cm7")
endif()
target_compile_definitions("quintuna_BMS_app.elf" PUBLIC TARGET_HV_SUPPLY)

if ("${BOOTLOAD}" STREQUAL "ON")
Expand Down
20 changes: 15 additions & 5 deletions firmware/quintuna/BMS/src/cubemx/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const osThreadAttr_t Task1Hz_attributes = {
.stack_size = sizeof(Task1HzBuffer),
.priority = (osPriority_t)osPriorityAboveNormal,
};
#ifdef USE_CHIMERA
/* Definitions for TaskChimera */
osThreadId_t TaskChimeraHandle;
uint32_t TaskChimeraBuffer[512];
Expand All @@ -135,6 +136,7 @@ const osThreadAttr_t TaskChimera_attributes = {
.stack_size = sizeof(TaskChimeraBuffer),
.priority = (osPriority_t)osPriorityHigh,
};
#endif
/* Definitions for TaskLtcVoltages */
osThreadId_t TaskLtcVoltagesHandle;
uint32_t TaskLtcVoltagesBuffer[512];
Expand Down Expand Up @@ -208,11 +210,13 @@ void RunTaskCanRx(void *argument);
void RunTaskCanTx(void *argument);
void RunTask1kHz(void *argument);
void RunTask1Hz(void *argument);
void RunTaskChimera(void *argument);
void RunTaskLtcVoltages(void *argument);
void RunTaskLtcTemps(void *argument);
void RunTaskLtcDiag(void *argument);
void RunTaskInit(void *argument);
#ifdef USE_CHIMERA
void RunTaskChimera(void *argument);
#endif
void RunTaskLtcVoltages(void *argument);
void RunTaskLtcTemps(void *argument);
void RunTaskLtcDiag(void *argument);
void RunTaskInit(void *argument);

/* USER CODE BEGIN PFP */

Expand Down Expand Up @@ -303,8 +307,10 @@ int main(void)
/* creation of Task1Hz */
Task1HzHandle = osThreadNew(RunTask1Hz, NULL, &Task1Hz_attributes);

#ifdef USE_CHIMERA
/* creation of TaskChimera */
TaskChimeraHandle = osThreadNew(RunTaskChimera, NULL, &TaskChimera_attributes);
#endif

/* creation of TaskLtcVoltages */
TaskLtcVoltagesHandle = osThreadNew(RunTaskLtcVoltages, NULL, &TaskLtcVoltages_attributes);
Expand Down Expand Up @@ -1241,6 +1247,7 @@ void RunTask1Hz(void *argument)
/* USER CODE END RunTask1Hz */
}

#ifdef USE_CHIMERA
/* USER CODE BEGIN Header_RunTaskChimera */
/**
* @brief Function implementing the TaskChimera thread.
Expand All @@ -1255,6 +1262,7 @@ void RunTaskChimera(void *argument)
tasks_runChimera();
/* USER CODE END RunTaskChimera */
}
#endif

/* USER CODE BEGIN Header_RunTaskLtcVoltages */
/**
Expand Down Expand Up @@ -1319,7 +1327,9 @@ void RunTaskInit(void *argument)

xTaskNotifyGive(Task1kHzHandle);
xTaskNotifyGive(Task100HzHandle);
#ifdef USE_CHIMERA
xTaskNotifyGive(TaskChimeraHandle);
#endif
xTaskNotifyGive(Task1HzHandle);
xTaskNotifyGive(TaskLtcVoltagesHandle);
xTaskNotifyGive(TaskLtcTempsHandle);
Expand Down
8 changes: 8 additions & 0 deletions firmware/quintuna/BMS/src/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
#include "hw_gpios.h"
#include "hw_resetReason.h"

#ifdef USE_CHIMERA
// chimera
#include "hw_chimeraConfig_v2.h"
#include "hw_chimera_v2.h"
#endif

#include <FreeRTOS.h>
#include <cmsis_os2.h>
Expand All @@ -36,10 +38,12 @@
// Define this guy to use CAN2 for talking to the Elcon.
// #define CHARGER_CAN

#ifdef USE_CHIMERA
void tasks_runChimera(void)
{
hw_chimera_v2_task(&chimera_v2_config);
}
#endif

void tasks_preInit(void)
{
Expand Down Expand Up @@ -119,7 +123,9 @@ void tasks_run1Hz(void)
uint32_t start_ticks = osKernelGetTickCount();
for (;;)
{
#ifdef USE_CHIMERA
if (!hw_chimera_v2_enabled)
#endif
{
jobs_run1Hz_tick();
}
Expand All @@ -141,7 +147,9 @@ void tasks_run100Hz(void)
uint32_t start_ticks = osKernelGetTickCount();
for (;;)
{
#ifdef USE_CHIMERA
if (!hw_chimera_v2_enabled)
#endif
{
jobs_run100Hz_tick();
}
Expand Down
2 changes: 2 additions & 0 deletions firmware/quintuna/BMS/src/tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ _Noreturn void tasks_run100Hz(void);
_Noreturn void tasks_run1kHz(void);
_Noreturn void tasks_runCanTx(void);
_Noreturn void tasks_runCanRx(void);
#ifdef USE_CHIMERA
_Noreturn void tasks_runChimera(void);
#endif
_Noreturn void tasks_runLtcVoltages(void);
_Noreturn void tasks_runLtcTemps(void);
_Noreturn void tasks_runLtcDiagnostics(void);
17 changes: 13 additions & 4 deletions firmware/quintuna/CRIT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(IO_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/io" "${SHARED_IO_INCLUDE_DI
file(GLOB_RECURSE HW_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw/*.c"
)
list(FILTER HW_SRCS EXCLUDE REGEX ".*/hw_chimeraConfig_v2\\.c$")
list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_error.c"
"${SHARED_HW_INCLUDE_DIR}/hw_hardFaultHandler.c"
Expand All @@ -37,15 +38,20 @@ list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_usb.c"
"${SHARED_HW_INCLUDE_DIR}/hw_pwmOutput.c"
"${SHARED_HW_INCLUDE_DIR}/hw_bootup.c"
"${SHARED_HW_INCLUDE_DIR}/hw_chimera_v2.c"
"${SHARED_HW_INCLUDE_DIR}/hw_ubsan.c"
"${SHARED_HW_INCLUDE_DIR}/hw_resetReason.c"
"${SHARED_HW_INCLUDE_DIR}/hw_utils.c"
"${SHARED_HW_INCLUDE_DIR}/hw_bootup.c"
"${SHARED_HW_INCLUDE_DIR}/hw_freeRtosConfigs.c"
"${SHARED_HW_INCLUDE_DIR}/hw_assert.c"
"${SHARED_HW_INCLUDE_DIR}/hw_watchdog.c"
"${SHARED_HW_INCLUDE_DIR}/hw_resetReason.c"
)
if ("${FIRMWARE_TARGET}" STREQUAL "chimera")
list(APPEND HW_SRCS
"${SHARED_HW_INCLUDE_DIR}/hw_chimera_v2.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw/hw_chimeraConfig_v2.c"
)
endif()

set(HW_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw"
"${SHARED_HW_INCLUDE_DIR}"
Expand Down Expand Up @@ -118,7 +124,10 @@ if ("${TARGET}" STREQUAL "binary")
"${CMAKE_CURRENT_BINARY_DIR}/app"
)

target_link_libraries("quintuna_CRIT_app.elf" PRIVATE "quintuna_CRIT_stm32" "quintuna_CRIT_jsoncan" "quintuna_CRIT_commit_info" "chimera_v2_proto_cm4" m)
target_link_libraries("quintuna_CRIT_app.elf" PRIVATE "quintuna_CRIT_stm32" "quintuna_CRIT_jsoncan" "quintuna_CRIT_commit_info" m)
if ("${FIRMWARE_TARGET}" STREQUAL "chimera")
target_link_libraries("quintuna_CRIT_app.elf" PRIVATE "chimera_v2_proto_cm4")
endif()

if ("${BOOTLOAD}" STREQUAL "ON")
file(GLOB BOOT_SRCS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/boot/*.c")
Expand Down
10 changes: 9 additions & 1 deletion firmware/quintuna/CRIT/src/cubemx/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const osThreadAttr_t TaskCanTx_attributes = {
.stack_size = sizeof(TaskCanTxBuffer),
.priority = (osPriority_t)osPriorityNormal,
};
#ifdef USE_CHIMERA
/* Definitions for TaskChimera */
osThreadId_t TaskChimeraHandle;
uint32_t TaskChimeraBuffer[512];
Expand All @@ -122,6 +123,7 @@ const osThreadAttr_t TaskChimera_attributes = {
.stack_size = sizeof(TaskChimeraBuffer),
.priority = (osPriority_t)osPriorityHigh,
};
#endif
/* USER CODE BEGIN PV */

/* USER CODE END PV */
Expand All @@ -138,7 +140,9 @@ void RunTask1Hz(void *argument);
void RunTask100Hz(void *argument);
void RunTaskCanRx(void *argument);
void RunTaskCanTx(void *argument);
void RunTaskChimera(void *argument);
#ifdef USE_CHIMERA
void RunTaskChimera(void *argument);
#endif

/* USER CODE BEGIN PFP */

Expand Down Expand Up @@ -219,8 +223,10 @@ int main(void)
/* creation of TaskCanTx */
TaskCanTxHandle = osThreadNew(RunTaskCanTx, NULL, &TaskCanTx_attributes);

#ifdef USE_CHIMERA
/* creation of TaskChimera */
TaskChimeraHandle = osThreadNew(RunTaskChimera, NULL, &TaskChimera_attributes);
#endif

/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
Expand Down Expand Up @@ -607,6 +613,7 @@ void RunTaskCanTx(void *argument)
/* USER CODE END RunTaskCanTx */
}

#ifdef USE_CHIMERA
/* USER CODE BEGIN Header_RunTaskChimera */
/**
* @brief Function implementing the TaskChimera thread.
Expand All @@ -621,6 +628,7 @@ void RunTaskChimera(void *argument)
tasks_runChimera();
/* USER CODE END RunTaskChimera */
}
#endif

/**
* @brief Period elapsed callback in non blocking mode
Expand Down
Loading
Loading