From 8247f1a66f86f0528860eddb8d13a70d5ae14f60 Mon Sep 17 00:00:00 2001 From: Blake Freer <59676067+BlakeFreer@users.noreply.github.com> Date: Sat, 7 Sep 2024 20:40:53 -0400 Subject: [PATCH] feat: Implements the stm32f767 platform for DemoBlink. Flashes the blue on-board LED (PB7) (#180) --- .../Blink/platforms/stm32f767/CMakeLists.txt | 7 +- .../Blink/platforms/stm32f767/bindings.cc | 39 +++++ .../platforms/stm32f767/cubemx/.gitignore | 4 + .../platforms/stm32f767/cubemx/CMakeLists.txt | 1 + .../stm32f767/cubemx/board_config.ioc | 162 ++++++++++++++++++ 5 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/.gitignore create mode 100644 firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/CMakeLists.txt create mode 100644 firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/board_config.ioc diff --git a/firmware/projects/Demo/Blink/platforms/stm32f767/CMakeLists.txt b/firmware/projects/Demo/Blink/platforms/stm32f767/CMakeLists.txt index ce5c434c9..c2040064c 100644 --- a/firmware/projects/Demo/Blink/platforms/stm32f767/CMakeLists.txt +++ b/firmware/projects/Demo/Blink/platforms/stm32f767/CMakeLists.txt @@ -1,6 +1,7 @@ -add_subdirectory(cubemx) - target_sources(bindings PRIVATE bindings.cc) target_include_directories(bindings PRIVATE ${DIR_PROJECT}) -target_link_libraries(bindings PUBLIC mcal-stm32f767) \ No newline at end of file +target_link_libraries(bindings PUBLIC mcal-stm32f767) + +add_subdirectory(cubemx) # provides "driver" +target_link_libraries(bindings PUBLIC driver) \ No newline at end of file diff --git a/firmware/projects/Demo/Blink/platforms/stm32f767/bindings.cc b/firmware/projects/Demo/Blink/platforms/stm32f767/bindings.cc index e69de29bb..8f1601da3 100644 --- a/firmware/projects/Demo/Blink/platforms/stm32f767/bindings.cc +++ b/firmware/projects/Demo/Blink/platforms/stm32f767/bindings.cc @@ -0,0 +1,39 @@ +// cubemx includes +#include "gpio.h" +#include "main.h" +#include "stm32f7xx_hal.h" + +// project includes +#include "bindings.h" +#include "mcal/stm32f767/periph/gpio.h" +#include "shared/periph/gpio.h" + +extern "C" { +/** + * This requires extern since it is not declared in a header, only defined + * in cubemx/../main.c + */ +void SystemClock_Config(); +} +namespace mcal { +using namespace stm32f767::periph; + +DigitalOutput indicator{LedPin_GPIO_Port, LedPin_Pin}; + +} // namespace mcal + +namespace bindings { + +shared::periph::DigitalOutput& indicator = mcal::indicator; + +void DelayMS(unsigned int ms) { + HAL_Delay(ms); +} + +void Initialize() { + SystemClock_Config(); + HAL_Init(); + MX_GPIO_Init(); +} + +} // namespace bindings \ No newline at end of file diff --git a/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/.gitignore b/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/.gitignore new file mode 100644 index 000000000..d5b8871de --- /dev/null +++ b/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/.gitignore @@ -0,0 +1,4 @@ +* +!*.ioc +!.gitignore +!CMakeLists.txt \ No newline at end of file diff --git a/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/CMakeLists.txt b/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/CMakeLists.txt new file mode 100644 index 000000000..4786834bb --- /dev/null +++ b/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/CMakeLists.txt @@ -0,0 +1 @@ +include(${CMAKE_SOURCE_DIR}/cmake/build_cubemx.cmake) \ No newline at end of file diff --git a/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/board_config.ioc b/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/board_config.ioc new file mode 100644 index 000000000..c5938a0b0 --- /dev/null +++ b/firmware/projects/Demo/Blink/platforms/stm32f767/cubemx/board_config.ioc @@ -0,0 +1,162 @@ +#MicroXplorer Configuration settings - do not modify +CAD.formats= +CAD.pinconfig= +CAD.provider= +File.Version=6 +GPIO.groupedBy=Group By Peripherals +KeepUserPlacement=false +Mcu.CPN=STM32F767ZIT6 +Mcu.Family=STM32F7 +Mcu.IP0=CORTEX_M7 +Mcu.IP1=NVIC +Mcu.IP2=RCC +Mcu.IP3=SYS +Mcu.IPNb=4 +Mcu.Name=STM32F767ZITx +Mcu.Package=LQFP144 +Mcu.Pin0=PB7 +Mcu.Pin1=VP_SYS_VS_Systick +Mcu.PinsNb=2 +Mcu.ThirdPartyNb=0 +Mcu.UserConstants= +Mcu.UserName=STM32F767ZITx +MxCube.Version=6.12.0 +MxDb.Version=DB.6.0.120 +NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.ForceEnableDMAVector=true +NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 +NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:false +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false +PB7.GPIOParameters=GPIO_Label +PB7.GPIO_Label=LedPin +PB7.Locked=true +PB7.Signal=GPIO_Output +PinOutPanel.RotationAngle=0 +ProjectManager.AskForMigrate=true +ProjectManager.BackupPrevious=false +ProjectManager.CompilerOptimize=6 +ProjectManager.ComputerToolchain=false +ProjectManager.CoupleFile=true +ProjectManager.CustomerFirmwarePackage= +ProjectManager.DefaultFWLocation=true +ProjectManager.DeletePrevious=true +ProjectManager.DeviceId=STM32F767ZITx +ProjectManager.FirmwarePackage=STM32Cube FW_F7 V1.17.2 +ProjectManager.FreePins=false +ProjectManager.HalAssertFull=false +ProjectManager.HeapSize=0x200 +ProjectManager.KeepUserCode=false +ProjectManager.LastFirmware=true +ProjectManager.LibraryCopy=1 +ProjectManager.MainLocation=Src +ProjectManager.NoMain=true +ProjectManager.PreviousToolchain= +ProjectManager.ProjectBuild=false +ProjectManager.ProjectFileName=board_config.ioc +ProjectManager.ProjectName=board_config +ProjectManager.ProjectStructure= +ProjectManager.RegisterCallBack= +ProjectManager.StackSize=0x400 +ProjectManager.TargetToolchain=Makefile +ProjectManager.ToolChainLocation= +ProjectManager.UAScriptAfterPath= +ProjectManager.UAScriptBeforePath= +ProjectManager.UnderRoot=false +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true +RCC.48MHZClocksFreq_Value=24000000 +RCC.ADC12outputFreq_Value=72000000 +RCC.ADC34outputFreq_Value=72000000 +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.CECFreq_Value=32786.88524590164 +RCC.CortexFreq_Value=96000000 +RCC.DFSDMAudioFreq_Value=192000000 +RCC.DFSDMFreq_Value=96000000 +RCC.EthernetFreq_Value=96000000 +RCC.FCLKCortexFreq_Value=96000000 +RCC.FamilyName=M +RCC.HCLKFreq_Value=96000000 +RCC.HSE_VALUE=8000000 +RCC.HSI_VALUE=16000000 +RCC.I2C1Freq_Value=48000000 +RCC.I2C2Freq_Value=48000000 +RCC.I2C3Freq_Value=48000000 +RCC.I2C4Freq_Value=48000000 +RCC.I2SClocksFreq_Value=48000000 +RCC.I2SFreq_Value=192000000 +RCC.IPParameters=48MHZClocksFreq_Value,ADC12outputFreq_Value,ADC34outputFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CECFreq_Value,CortexFreq_Value,DFSDMAudioFreq_Value,DFSDMFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,I2C4Freq_Value,I2SClocksFreq_Value,I2SFreq_Value,LCDTFTFreq_Value,LCDTFToutputFreq_Value,LPTIM1Freq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLI2SPCLKFreq_Value,PLLI2SQCLKFreq_Value,PLLI2SRCLKFreq_Value,PLLI2SRoutputFreq_Value,PLLM,PLLMCOFreq_Value,PLLMUL,PLLN,PLLQ,PLLQCLKFreq_Value,PLLQoutputFreq_Value,PLLRFreq_Value,PLLSAIPCLKFreq_Value,PLLSAIQCLKFreq_Value,PLLSAIRCLKFreq_Value,PLLSAIoutputFreq_Value,PRESCALERUSB,RNGFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMC2Freq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,SYSCLKSourceVirtual,TIM15Freq_Value,TIM16Freq_Value,TIM17Freq_Value,TIM1Freq_Value,TIM20Freq_Value,TIM2Freq_Value,TIM3Freq_Value,TIM8Freq_Value,UART4Freq_Value,UART5Freq_Value,UART7Freq_Value,UART8Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USART6Freq_Value,USBFreq_Value,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutput2Freq_Value,VCOOutputFreq_Value,VCOSAIOutputFreq_Value,VcooutputI2S,WatchDogFreq_Value +RCC.LCDTFTFreq_Value=96000000 +RCC.LCDTFToutputFreq_Value=96000000 +RCC.LPTIM1Freq_Value=48000000 +RCC.LSE_VALUE=32768 +RCC.LSI_VALUE=32000 +RCC.MCO1PinFreq_Value=16000000 +RCC.MCO2PinFreq_Value=96000000 +RCC.MCOFreq_Value=72000000 +RCC.PLLCLKFreq_Value=96000000 +RCC.PLLI2SPCLKFreq_Value=192000000 +RCC.PLLI2SQCLKFreq_Value=192000000 +RCC.PLLI2SRCLKFreq_Value=192000000 +RCC.PLLI2SRoutputFreq_Value=192000000 +RCC.PLLM=8 +RCC.PLLMCOFreq_Value=72000000 +RCC.PLLMUL=RCC_PLL_MUL9 +RCC.PLLN=96 +RCC.PLLQ=4 +RCC.PLLQCLKFreq_Value=48000000 +RCC.PLLQoutputFreq_Value=48000000 +RCC.PLLRFreq_Value=96000000 +RCC.PLLSAIPCLKFreq_Value=192000000 +RCC.PLLSAIQCLKFreq_Value=192000000 +RCC.PLLSAIRCLKFreq_Value=192000000 +RCC.PLLSAIoutputFreq_Value=192000000 +RCC.PRESCALERUSB=RCC_USBCLKSOURCE_PLL_DIV1_5 +RCC.RNGFreq_Value=48000000 +RCC.RTCFreq_Value=32000 +RCC.RTCHSEDivFreq_Value=4000000 +RCC.SAI1Freq_Value=192000000 +RCC.SAI2Freq_Value=192000000 +RCC.SDMMC2Freq_Value=96000000 +RCC.SDMMCFreq_Value=96000000 +RCC.SPDIFRXFreq_Value=192000000 +RCC.SYSCLKFreq_VALUE=96000000 +RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK +RCC.SYSCLKSourceVirtual=RCC_SYSCLKSOURCE_PLLCLK +RCC.TIM15Freq_Value=72000000 +RCC.TIM16Freq_Value=72000000 +RCC.TIM17Freq_Value=72000000 +RCC.TIM1Freq_Value=72000000 +RCC.TIM20Freq_Value=72000000 +RCC.TIM2Freq_Value=72000000 +RCC.TIM3Freq_Value=72000000 +RCC.TIM8Freq_Value=72000000 +RCC.UART4Freq_Value=48000000 +RCC.UART5Freq_Value=48000000 +RCC.UART7Freq_Value=48000000 +RCC.UART8Freq_Value=48000000 +RCC.USART1Freq_Value=96000000 +RCC.USART2Freq_Value=48000000 +RCC.USART3Freq_Value=48000000 +RCC.USART6Freq_Value=96000000 +RCC.USBFreq_Value=48000000 +RCC.VCOI2SOutputFreq_Value=384000000 +RCC.VCOInputFreq_Value=2000000 +RCC.VCOOutput2Freq_Value=8000000 +RCC.VCOOutputFreq_Value=192000000 +RCC.VCOSAIOutputFreq_Value=384000000 +RCC.VcooutputI2S=48000000 +RCC.WatchDogFreq_Value=32000 +VP_SYS_VS_Systick.Mode=SysTick +VP_SYS_VS_Systick.Signal=SYS_VS_Systick +board=NUCLEO-F767ZI +boardIOC=true