-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Changelist - Set up CMake and STM32 for FSM on quintuna <!-- Give a list of the changes covered in this PR. This will help both you and the reviewer keep this PR within scope. --> ### Testing Done - it builds <!-- Outline the testing that was done to demonstrate the changes are solid. This could be unit tests, integration tests, testing on the car, etc. Include relevant code snippets, screenshots, etc as needed. --> ### Resolved Tickets none (there might be one) <!-- Link any tickets that this PR resolves. --> --------- Co-authored-by: Edwin <[email protected]>
- Loading branch information
Showing
30 changed files
with
5,484 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
message("") | ||
message("⚙️ Configuring FSM (Quintuna)") | ||
|
||
set(ARM_CORE "cm4") | ||
set(LINKER_SCRIPT "${LINKER_DIR}/stm32f412rgtx/stm32f412rgtx_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_FSM_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 | ||
stm32f4_boot_binary( | ||
"quintuna_FSM_boot" | ||
"${BOOT_SRCS}" | ||
"${BOOT_INCLUDE_DIRS}" | ||
"quintuna_FSM" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/boot/cubemx/Src/syscalls.c" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/boot/cubemx/FSM_boot.ioc" | ||
) | ||
|
||
set(IOC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/FSM.ioc") | ||
generate_stm32cube_code("FSM" "${IOC_PATH}") | ||
|
||
set(STM32_HAL_SRCS | ||
"stm32f4xx_hal.c" #add more hal library here if needed | ||
) | ||
|
||
set(STM32_HAL_SRCS | ||
"stm32f4xx_hal_adc_ex.c" | ||
"stm32f4xx_hal_adc.c" | ||
"stm32f4xx_hal_cortex.c" | ||
"stm32f4xx_hal_dma_ex.c" | ||
"stm32f4xx_hal_dma.c" | ||
"stm32f4xx_hal_exti.c" | ||
"stm32f4xx_hal_can.c" | ||
"stm32f4xx_hal_gpio.c" | ||
"stm32f4xx_hal_iwdg.c" | ||
"stm32f4xx_hal_pwr_ex.c" | ||
"stm32f4xx_hal_rcc_ex.c" | ||
"stm32f4xx_hal_rcc.c" | ||
"stm32f4xx_hal_tim_ex.c" | ||
"stm32f4xx_hal_tim.c" | ||
"stm32f4xx_hal_uart.c" | ||
"stm32f4xx_hal.c" | ||
) | ||
|
||
stm32f412rx_cube_library( | ||
"quintuna_FSM_stm32cube" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Inc" | ||
"${STM32_HAL_SRCS}" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/cubemx/Src/syscalls.c" | ||
"${MD5_LOCATION}" | ||
FALSE | ||
) | ||
|
||
# JSONCAN | ||
jsoncan_embedded_library(FSM quintuna "${CMAKE_CURRENT_BINARY_DIR}" ${ARM_CORE}) | ||
|
||
# CommitInfo | ||
commit_info_library( | ||
"quintuna_FSM_app.elf" | ||
"quintuna_FSM_commit_info" | ||
"${CMAKE_CURRENT_BINARY_DIR}/app" | ||
"${ARM_CORE}" | ||
) | ||
|
||
target_link_libraries("quintuna_FSM_jsoncan" INTERFACE "quintuna_FSM_stm32cube") | ||
target_link_libraries("quintuna_FSM_app.elf" PRIVATE "quintuna_FSM_stm32cube" "quintuna_FSM_jsoncan" "quintuna_FSM_commit_info" "debug_modules") | ||
target_link_libraries("quintuna_FSM_boot.elf" PRIVATE "quintuna_FSM_commit_info") | ||
|
||
embedded_image( | ||
"quintuna_FSM" | ||
"quintuna_FSM_app.hex" | ||
"${CMAKE_CURRENT_BINARY_DIR}/quintuna_FSM_app.hex" | ||
"quintuna_FSM_boot.hex" | ||
"${CMAKE_CURRENT_BINARY_DIR}/quintuna_FSM_boot.hex" | ||
) | ||
elseif ("${TARGET}" STREQUAL "test") | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#define START_UPDATE_ID 0000 | ||
#define UPDATE_ACK_ID 0000 | ||
#define STATUS_10HZ_ID 0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
#MicroXplorer Configuration settings - do not modify | ||
CAD.formats= | ||
CAD.pinconfig= | ||
CAD.provider= | ||
CAN1.ABOM=ENABLE | ||
CAN1.BS1=CAN_BS1_13TQ | ||
CAN1.BS2=CAN_BS2_2TQ | ||
CAN1.CalculateBaudRate=500000 | ||
CAN1.CalculateTimeBit=2000 | ||
CAN1.CalculateTimeQuantum=125.0 | ||
CAN1.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,BS1,Prescaler,SJW,ABOM,NART,RFLM,TXFP,BS2 | ||
CAN1.NART=ENABLE | ||
CAN1.Prescaler=6 | ||
CAN1.RFLM=ENABLE | ||
CAN1.SJW=CAN_SJW_4TQ | ||
CAN1.TXFP=ENABLE | ||
FREERTOS.FootprintOK=true | ||
FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT | ||
FREERTOS.Tasks01=interfaceTask,32,512,runInterfaceTask,Default,NULL,Static,interfaceTaskBuffer,interfaceTaskControlBlock;canTxTask,16,512,runCanTxTask,Default,NULL,Static,canTxTaskBuffer,canTxTaskControlBlock;tickTask,24,512,runTickTask,Default,NULL,Static,tickTaskBuffer,tickTaskControlBlock | ||
FREERTOS.configUSE_NEWLIB_REENTRANT=1 | ||
File.Version=6 | ||
GPIO.groupedBy= | ||
KeepUserPlacement=false | ||
Mcu.CPN=STM32F412RGT6 | ||
Mcu.Family=STM32F4 | ||
Mcu.IP0=CAN1 | ||
Mcu.IP1=CRC | ||
Mcu.IP2=FREERTOS | ||
Mcu.IP3=NVIC | ||
Mcu.IP4=RCC | ||
Mcu.IP5=SYS | ||
Mcu.IPNb=6 | ||
Mcu.Name=STM32F412R(E-G)Tx | ||
Mcu.Package=LQFP64 | ||
Mcu.Pin0=PC13 | ||
Mcu.Pin1=PH0 - OSC_IN | ||
Mcu.Pin10=VP_FREERTOS_VS_CMSIS_V2 | ||
Mcu.Pin11=VP_SYS_VS_tim6 | ||
Mcu.Pin2=PH1 - OSC_OUT | ||
Mcu.Pin3=PA11 | ||
Mcu.Pin4=PA12 | ||
Mcu.Pin5=PA13 | ||
Mcu.Pin6=PA14 | ||
Mcu.Pin7=PA15 | ||
Mcu.Pin8=PB3 | ||
Mcu.Pin9=VP_CRC_VS_CRC | ||
Mcu.PinsNb=12 | ||
Mcu.ThirdPartyNb=0 | ||
Mcu.UserConstants= | ||
Mcu.UserName=STM32F412RGTx | ||
MxCube.Version=6.9.2 | ||
MxDb.Version=DB.6.0.92 | ||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||
NVIC.CAN1_RX0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true | ||
NVIC.CAN1_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true | ||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||
NVIC.ForceEnableDMAVector=true | ||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||
NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false\:false | ||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 | ||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false | ||
NVIC.SavedPendsvIrqHandlerGenerated=true | ||
NVIC.SavedSvcallIrqHandlerGenerated=true | ||
NVIC.SavedSystickIrqHandlerGenerated=true | ||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false | ||
NVIC.TIM6_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true | ||
NVIC.TimeBase=TIM6_IRQn | ||
NVIC.TimeBaseIP=TIM6 | ||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false | ||
PA11.Mode=CAN_Activate | ||
PA11.Signal=CAN1_RX | ||
PA12.Mode=CAN_Activate | ||
PA12.Signal=CAN1_TX | ||
PA13.Mode=Trace_Asynchronous_SW | ||
PA13.Signal=SYS_JTMS-SWDIO | ||
PA14.Mode=Trace_Asynchronous_SW | ||
PA14.Signal=SYS_JTCK-SWCLK | ||
PA15.GPIOParameters=GPIO_PuPd,GPIO_Label | ||
PA15.GPIO_Label=nBOOT_EN | ||
PA15.GPIO_PuPd=GPIO_PULLUP | ||
PA15.Locked=true | ||
PA15.Signal=GPIO_Input | ||
PB3.Mode=Trace_Asynchronous_SW | ||
PB3.Signal=SYS_JTDO-SWO | ||
PC13.GPIOParameters=GPIO_Label | ||
PC13.GPIO_Label=LED | ||
PC13.Locked=true | ||
PC13.Signal=GPIO_Output | ||
PH0\ -\ OSC_IN.Mode=HSE-External-Oscillator | ||
PH0\ -\ OSC_IN.Signal=RCC_OSC_IN | ||
PH1\ -\ OSC_OUT.Mode=HSE-External-Oscillator | ||
PH1\ -\ OSC_OUT.Signal=RCC_OSC_OUT | ||
PinOutPanel.RotationAngle=0 | ||
ProjectManager.AskForMigrate=true | ||
ProjectManager.BackupPrevious=false | ||
ProjectManager.CompilerOptimize=6 | ||
ProjectManager.ComputerToolchain=false | ||
ProjectManager.CoupleFile=false | ||
ProjectManager.CustomerFirmwarePackage= | ||
ProjectManager.DefaultFWLocation=true | ||
ProjectManager.DeletePrevious=true | ||
ProjectManager.DeviceId=STM32F412RGTx | ||
ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.27.1 | ||
ProjectManager.FreePins=false | ||
ProjectManager.HalAssertFull=false | ||
ProjectManager.HeapSize=0x00 | ||
ProjectManager.KeepUserCode=true | ||
ProjectManager.LastFirmware=true | ||
ProjectManager.LibraryCopy=1 | ||
ProjectManager.MainLocation=Core/Src | ||
ProjectManager.NoMain=false | ||
ProjectManager.PreviousToolchain=STM32CubeIDE | ||
ProjectManager.ProjectBuild=false | ||
ProjectManager.ProjectFileName=FSM_boot.ioc | ||
ProjectManager.ProjectName=FSM_boot | ||
ProjectManager.ProjectStructure= | ||
ProjectManager.RegisterCallBack= | ||
ProjectManager.StackSize=0x400 | ||
ProjectManager.TargetToolchain=STM32CubeIDE | ||
ProjectManager.ToolChainLocation= | ||
ProjectManager.UAScriptAfterPath= | ||
ProjectManager.UAScriptBeforePath= | ||
ProjectManager.UnderRoot=true | ||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_CAN1_Init-CAN1-false-HAL-true,4-MX_CRC_Init-CRC-false-HAL-true | ||
RCC.AHBFreq_Value=96000000 | ||
RCC.APB1CLKDivider=RCC_HCLK_DIV2 | ||
RCC.APB1Freq_Value=48000000 | ||
RCC.APB1TimFreq_Value=96000000 | ||
RCC.APB2Freq_Value=96000000 | ||
RCC.APB2TimFreq_Value=96000000 | ||
RCC.CortexFreq_Value=96000000 | ||
RCC.DFSDMAudioFreq_Value=48000000 | ||
RCC.DFSDMFreq_Value=96000000 | ||
RCC.FCLKCortexFreq_Value=96000000 | ||
RCC.FMPI2C1Freq_Value=48000000 | ||
RCC.FamilyName=M | ||
RCC.HCLKFreq_Value=96000000 | ||
RCC.HSE_VALUE=8000000 | ||
RCC.I2S1Freq_Value=48000000 | ||
RCC.I2S2Freq_Value=48000000 | ||
RCC.IPParameters=AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,DFSDMAudioFreq_Value,DFSDMFreq_Value,FCLKCortexFreq_Value,FMPI2C1Freq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,I2S1Freq_Value,I2S2Freq_Value,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLI2SPCLKFreq_Value,PLLI2SQCLKFreq_Value,PLLI2SQoutputFreq_Value,PLLI2SRCLKFreq_Value,PLLI2SoutputFreq_Value,PLLM,PLLQCLKFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLRoutputFreq_Value,PLLSourceVirtual,RNGFreq_Value,SDIOFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,USBFreq_Value,VCOI2SInputFreq_Value,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value | ||
RCC.MCO2PinFreq_Value=96000000 | ||
RCC.PLLCLKFreq_Value=96000000 | ||
RCC.PLLI2SPCLKFreq_Value=48000000 | ||
RCC.PLLI2SQCLKFreq_Value=48000000 | ||
RCC.PLLI2SQoutputFreq_Value=48000000 | ||
RCC.PLLI2SRCLKFreq_Value=48000000 | ||
RCC.PLLI2SoutputFreq_Value=48000000 | ||
RCC.PLLM=8 | ||
RCC.PLLQCLKFreq_Value=96000000 | ||
RCC.PLLQoutputFreq_Value=96000000 | ||
RCC.PLLRCLKFreq_Value=96000000 | ||
RCC.PLLRoutputFreq_Value=96000000 | ||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE | ||
RCC.RNGFreq_Value=96000000 | ||
RCC.SDIOFreq_Value=96000000 | ||
RCC.SYSCLKFreq_VALUE=96000000 | ||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK | ||
RCC.USBFreq_Value=96000000 | ||
RCC.VCOI2SInputFreq_Value=500000 | ||
RCC.VCOI2SOutputFreq_Value=96000000 | ||
RCC.VCOInputFreq_Value=1000000 | ||
RCC.VCOOutputFreq_Value=192000000 | ||
VP_CRC_VS_CRC.Mode=CRC_Activate | ||
VP_CRC_VS_CRC.Signal=CRC_VS_CRC | ||
VP_FREERTOS_VS_CMSIS_V2.Mode=CMSIS_V2 | ||
VP_FREERTOS_VS_CMSIS_V2.Signal=FREERTOS_VS_CMSIS_V2 | ||
VP_SYS_VS_tim6.Mode=TIM6 | ||
VP_SYS_VS_tim6.Signal=SYS_VS_tim6 | ||
board=custom | ||
rtos.0.ip=FREERTOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
062b8c6254530dd03f43de74949f5ad9 |
Oops, something went wrong.