source
embedded_stm32f0xx
15.3.0embedded runtime for the STM32F0XX SoC
15.3.0
Usage
First edit your alire.toml file and add the following elements:
- Add
embedded_stm32f0xxin the dependency list:[[depends-on]] embedded_stm32f0xx = "*" - if applicable, apply any runtime configuration variables (see below).
Then edit your project file to add the following elements:
- "with" the run-time project files. With this, gprbuild will compile the run-time before your application
with "runtime_build.gpr"; with "ravenscar_build.gpr"; - Specify the
TargetandRuntimeattributes:for Target use runtime_build'Target; for Runtime ("Ada") use runtime_build'Runtime ("Ada"); - specify the
Linkerswitches:package Linker is for Switches ("Ada") use Runtime_Build.Linker_Switches; end Linker;
The runtime is configurable via Alire crate configuration variables. See the project website for full details of the available options.
By default, the runtime is configured for the STM32F072RB. If your board has
a different MCU, then you will need to specify which MCU you are using via
the crate configuration. For example, to configure the runtime for the
STM32F030F4, add the following to your alire.toml:
[configuration.values]
embedded_stm32f0xx.MCU_Sub_Family = "F030"
embedded_stm32f0xx.MCU_Pin_Count = "F"
embedded_stm32f0xx.MCU_User_Code_Memory_Size = "4"
By default, the runtime configures the clock tree for a 48 MHz system clock from the high-speed internal (HSI) oscillator. If you want a different clock configuration, then use the crate configuration variables to specify the configuration you wish to use. For example, to configure the runtime to generate a 32 MHz system clock from a 16 MHz HSE crystal oscillator:
[configuration.values]
# Configure a 16 MHz HSE crystal oscillator
embedded_stm32f0xx.HSE_Clock_Frequency = 16000000
embedded_stm32f0xx.HSE_Bypass = false
# Use the PLL as the SYSCLK source
embedded_stm32f0xx.SYSCLK_Src = "PLL"
# Configure the PLL input for a 16 MHz input from the HSE
embedded_stm32f0xx.PLL_Src = "HSE_PREDIV"
embedded_stm32f0xx.PREDIV = 1
# Configure the PLL to output 32 MHz (16 MHz * 2)
embedded_stm32f0xx.PLLMUL = 2
# Configure the AHB an APB to also run at 32 MHz
embedded_stm32f0xx.AHB_Pre = "DIV1"
embedded_stm32f0xx.APB_Pre = "DIV1"