Skip to content

Commit

Permalink
Quintuna VC Bring Up (#1393)
Browse files Browse the repository at this point in the history
### Changelist 
Configured CMake and CubeMx.

### Testing Done
Can load CMake and build binaries.

### Resolved Tickets

---------

Co-authored-by: Aditya-Dhiman4 <[email protected]>
Co-authored-by: Edwin <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent 39f9052 commit a8000a8
Show file tree
Hide file tree
Showing 26 changed files with 4,216 additions and 0 deletions.
1 change: 1 addition & 0 deletions firmware/quintuna/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set(QUINTUNA_DIR "${FIRMWARE_DIR}/quintuna")
add_subdirectory(CRIT)
add_subdirectory(RSM)
add_subdirectory(VC)
118 changes: 118 additions & 0 deletions firmware/quintuna/VC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
message("")
message("⚙️ Configuring VC (Quintuna)")
set(ARM_CORE "cm7")
set(LINKER_SCRIPT "${LINKER_DIR}/stm32h733vgtx/stm32h733vgtx_app.ld")

file(GLOB_RECURSE SYSTEM_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Src/*.c"
)
set(SYSTEM_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/src"
)

file(GLOB_RECURSE APP_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/app/*.cpp")
list(APPEND APP_SRCS
"${SHARED_APP_INCLUDE_DIR_CPP}/app_stateMachine.cpp"
"${SHARED_APP_INCLUDE_DIR_CPP}/app_timer.cpp"
)
set(APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/app" "${SHARED_APP_INCLUDE_DIR_CPP}")

file(GLOB_RECURSE IO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/io/*.cpp")
list(APPEND IO_SRCS
""
)
set(IO_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src/io" "${SHARED_IO_INCLUDE_DIR_CPP}")

file(GLOB_RECURSE HW_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw/*.cpp"
)
list(APPEND HW_SRCS
""
)
set(HW_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/src/hw"
"${SHARED_HW_INCLUDE_DIR_CPP}"
)

if ("${TARGET}" STREQUAL "binary")
set(SRCS ${APP_SRCS} ${IO_SRCS} ${HW_SRCS} ${TASKS_SRCS} ${SYSTEM_SRCS})
set(INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${IO_INCLUDE_DIRS} ${HW_INCLUDE_DIRS} ${SYSTEM_INCLUDE_DIRS})
embedded_binary("quintuna_VC_app" "${SRCS}" "${INCLUDE_DIRS}" "${LINKER_SCRIPT}" "${ARM_CORE}")

# Bootloader files.
file(GLOB_RECURSE BOOT_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/boot/*.c")
set(BOOT_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/boot" "${CMAKE_CURRENT_SOURCE_DIR}/boot/cubemx/Inc")

# Build bootloader.
stm32h7_boot_binary(
"quintuna_VC_boot"
"${BOOT_SRCS}"
"${BOOT_INCLUDE_DIRS}"
"quintuna_VC"
"${CMAKE_CURRENT_SOURCE_DIR}/boot/cubemx/Src/syscalls.c"
"${CMAKE_CURRENT_SOURCE_DIR}/boot/cubemx/VC_boot.ioc"
)

set(IOC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/VC.ioc")
generate_stm32cube_code("VC" "${IOC_PATH}")

# STM HAL Library
set(STM32_HAL_SRCS
"stm32h7xx_hal_adc_ex.c"
"stm32h7xx_hal_adc.c"
"stm32h7xx_hal_cortex.c"
"stm32h7xx_hal_dma_ex.c"
"stm32h7xx_hal_dma.c"
"stm32h7xx_hal_exti.c"
"stm32h7xx_hal_fdcan.c"
"stm32h7xx_hal_gpio.c"
"stm32h7xx_hal_iwdg.c"
"stm32h7xx_hal_pwr_ex.c"
"stm32h7xx_hal_rcc_ex.c"
"stm32h7xx_hal_rcc.c"
"stm32h7xx_hal_tim_ex.c"
"stm32h7xx_hal_tim.c"
"stm32h7xx_hal_uart_ex.c"
"stm32h7xx_hal_uart.c"
"stm32h7xx_ll_sdmmc.c"
"stm32h7xx_hal_sd_ex.c"
"stm32h7xx_hal_sd.c"
"stm32h7xx_hal.c"
"stm32h7xx_hal_i2c.c"
"stm32h7xx_hal_i2c_ex.c"
)

stm32h733xx_cube_library(
"quintuna_VC_stm32cube"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Inc"
"${STM32_HAL_SRCS}"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Src/syscalls.c"
"${MD5_LOCATION}"
)

# JSONCAN
jsoncan_embedded_library(VC quintuna "${CMAKE_CURRENT_BINARY_DIR}" ${ARM_CORE})

# CommitInfo
commit_info_library(
"quintuna_VC_app.elf"
"quintuna_VC_commit_info"
"${CMAKE_CURRENT_BINARY_DIR}/app"
"${ARM_CORE}"
)

target_link_libraries("quintuna_VC_jsoncan" PRIVATE "quintuna_VC_stm32cube")
target_link_libraries("quintuna_VC_app.elf" PRIVATE "quintuna_VC_stm32cube" "quintuna_VC_jsoncan" "quintuna_VC_commit_info" "debug_modules")
target_link_libraries("quintuna_VC_boot.elf" PRIVATE "quintuna_VC_commit_info")

embedded_image(
"quintuna_VC"
"quintuna_VC_app.hex"
"${CMAKE_CURRENT_BINARY_DIR}/quintuna_VC_app.hex"
"quintuna_VC_boot.hex"
"${CMAKE_CURRENT_BINARY_DIR}/quintuna_VC_boot.hex"
)

elseif ("${TARGET}" STREQUAL "test")
endif ()
5 changes: 5 additions & 0 deletions firmware/quintuna/VC/boot/bootloaderConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#define START_UPDATE_ID 1210
#define UPDATE_ACK_ID 1211
#define STATUS_10HZ_ID 1219
70 changes: 70 additions & 0 deletions firmware/quintuna/VC/boot/cubemx/Inc/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C"
{
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
Loading

0 comments on commit a8000a8

Please sign in to comment.