I just got an STM32F4 discovery board and I’m trying to compile some audio example code I found.
I’m able to compile and run basic LED blinking code using the mbed framework but I’m having trouble with the non-mbed stuff (I’m guessing cmsis?).
Here’s the project I’m trying to compile: STM32F4 audio example code on github
What I’ve tried:
- Create new project:
platformio init --board disco_f407vg
platformio.iniand set the
- Copy the source from the github project into the
srcdirectory of my platformio project
- Compile with
platformio run --target upload
At first I got an error that
stm32f4_discovery.h was missing. I’m new to the STM/ARM world (I’ve only done basic arduino stuff), so I’m not sure how much of these libraries are included with platformio. Is there a way to get these standard STM32F4 discovery library files to be automatically included?
Anyway, through some digging I found that (and other) source files in that same github repo.
So I copied those source files over into my project, then tried compiling again. It gave me more errors of missing files, so I copied the other libraries. Eventually all the files were there, but now I’m getting lots of other errors.
Here’s a small snippet of the errors:
src/main.c:36:1: error: unknown type name 'RCC_ClocksTypeDef' RCC_ClocksTypeDef RCC_Clocks; ^ src/main.c: In function 'main': src/main.c:62:3: warning: implicit declaration of function 'RCC_GetClocksFreq' [-Wimplicit-function-declaration] RCC_GetClocksFreq(&RCC_Clocks); ^ src/main.c:63:28: error: request for member 'HCLK_Frequency' in something not a structure or union SysTick_Config(RCC_Clocks.HCLK_Frequency / 100); ^ src/main.c: In function 'TIM_LED_Config': src/main.c:102:3: error: unknown type name 'TIM_OCInitTypeDef' TIM_OCInitTypeDef TIM_OCInitStructure; ^ src/main.c:103:3: error: unknown type name 'TIM_TimeBaseInitTypeDef' TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; ^ src/main.c:104:3: error: unknown type name 'NVIC_InitTypeDef'
Anyway, long story short, my question is: am I missing something obvious and simple here? Is there some basic STM32F4 discovery set of libraries that come with platformio that I’m not seeing somehow?
Sorry for the newbish question but I’m scratching my head here trying to build simple standard example code and I feel like I’m having to manually import a lot of what seems like basic core library files (e.g.
stm32f4xx_gpio.h) which I assumed would be part of platformio when initializing using the stm32f4 discovery board. So before I go insane trying to manually get things to compile I wanted to check first whether I’m doing something stupid
Thanks for your help!