UM1739
4.2
How to develop an application
4.2.1
HAL application
This section describes the successive steps to create an application using STM32CubeF2.
1.
Create a project: to create a new project, start either from the Template project
provided for each board under \Projects\<STM32xx_xxx>\Templates or from any
available project under \Projects\<STM32xx_xxx>\Examples or
\Projects\<STM32xx_xxx>\Applications.
Note: <STM32xx_xxx> refers to the board name, for example STM322xG_EVAL.
The Template project provides an empty main loop function. It is a good starting point
to get familiar with the project settings for STM32CubeF2. It has the following
characteristics:
a)
b)
c)
d)
Note:
When copying an existing project to another location, make sure to update the include
paths.
2.
Add the necessary middleware to the project (optional): the available middleware
stacks are USB Host and Device Libraries, STemWin, FreeRTOS, FatFS, LwIP, and
PolarSSL. To find out which source files must be added to the project files list, refer to
the documentation provided for each middleware.
To get a better view of the sources files to be added and the include paths, look at the
Applications available under \Projects\STM32xx_xxx\Applications\<MW_Stack>,
where <MW_Stack> refers to the middleware stack, for example USB_Device.
3.
Configure the firmware components: the HAL and middleware components offer a
set of build time configuration options using macros "#define" declared in a header file.
A template configuration file is provided within each component, it has to be copied to
the project folder (usually the configuration file is named xxx_conf_template.h.
Make sure to remove the word "_template" when copying the file to the project folder.
The configuration file provides enough information to know the impact of each
configuration option. More detailed information is available in the documentation
provided for each component.
It contains the sources of HAL, CMSIS and BSP drivers which are the minimum
required components to develop a code for a given board.
It contains the include paths for all the firmware components.
It defines the STM32F2 device supported, allowing to configure the CMSIS and
HAL drivers accordingly.
It provides ready-to use user files preconfigured as, for example:
- HAL is initialized.
- SysTick ISR implemented for HAL_Delay() purpose.
- System clock is configured with the maximum frequency of the device
DocID026120 Rev 4
Getting started with STM32CubeF2
15/22
21
Need help?
Do you have a question about the STM32CubeF2 and is the answer not in the manual?
Questions and answers