@@ -15,6 +15,156 @@ Tutorials
1515* :ref: `tutorial_stm32cube_debugging_unit_testing `
1616
1717
18+ Configuration Options
19+ ---------------------
20+
21+ Custom Configuration Header
22+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
24+ Type: ``Bool (yes or no) `` | Multiple: ``No `` | Default: ``no ``
25+
26+ STM32Cube-based projects require a special configuration header file that contains
27+ several essential macros (oscillator adaptations, caching settings, etc.) and controls
28+ what framework modules (ADC, DMA, etc.) are enabled.
29+
30+ By default, PlatformIO uses a template header file shipped with the framework package
31+ ``stm32YYxx_hal_conf_template.h `` and renames it to ``stm32YYxx_hal_conf.h `` expected by
32+ the internal framework implementation. This behavior can be disabled via a special
33+ option ``custom_config_header `` set in :ref: `projectconf `, for example:
34+
35+ .. code-block :: ini
36+
37+ [env:nucleo_f401re]
38+ platform = ststm32
39+ framework = stm32cube
40+ board = nucleo_f401re
41+ build.stm32cube.custom_config_header = yes
42+
43+ Note that the location for the custom configuration header is not strictly limited as
44+ long as the path to this file is visible to the build system.
45+
46+ Custom System Setup Implementation
47+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48+
49+ Type: ``Bool (yes or no) `` | Multiple: ``No `` | Default: ``no ``
50+
51+ Besides project source files, STM32Cube requires additional code to properly startup
52+ the MCU and prepare a runtime environment. By default, PlatformIO is capable of compiling
53+ default implementations shipped with the framework according to the MCU field specified
54+ in a board manifest. If this functionality is already implemented as part of your project,
55+ you can force PlatformIO to skip adding default implementations via the ``custom_system_setup ``
56+ option, for example:
57+
58+ .. code-block :: ini
59+
60+ [env:nucleo_f401re]
61+ platform = ststm32
62+ framework = stm32cube
63+ board = nucleo_f401re
64+ build.stm32cube.custom_system_setup = yes
65+
66+
67+ Selecting System File
68+ ~~~~~~~~~~~~~~~~~~~~~
69+
70+ Type: ``String `` | Multiple: ``No `` | Default: ``Dynamically selected ``
71+
72+ This file (e.g. ``system_stm32f0xx.c ``) is responsible for basic system initialization
73+ that is called after the reset routine and before jumping to the ``main `` function.
74+ In most cases, this option won't be needed as the STM32Cube framework provides
75+ only one default implementation. It's mostly used with dual-core targets (e.g. ``STM32H7 ``)
76+ which can have several implementations for different boot settings of available CPU cores.
77+ The desired implementation can be selected via a special option ``system_file ``
78+ in :ref: `projectconf `, for example:
79+
80+ .. code-block :: ini
81+
82+ [env:disco_h747xi]
83+ platform = ststm32
84+ framework = stm32cube
85+ board = disco_h747xi
86+ build.stm32cube.system_file = system_stm32h7xx_dualcore_bootcm7_cm4gated.c
87+
88+
89+ Custom Startup File
90+ ~~~~~~~~~~~~~~~~~~~
91+
92+ Type: ``String `` | Multiple: ``No `` | Default: ``Dynamically selected ``
93+
94+ The Startup File (e.g. ``startup_stm32f205xx.s ``) is responsible for preparing a proper
95+ runtime environment before calling the ``main `` function. It contains a minimal
96+ interrupt vector table (including ``ResetHanlder `` implementation), sets stack pointer
97+ and program counter, initializes memory, etc. In most cases, PlatformIO is capable of
98+ automatically selecting a proper startup file according to the MCU field specified in a
99+ board manifest. In case this feature fails, it's possible to manually specify the desired
100+ startup file, for example:
101+
102+ .. code-block :: ini
103+
104+ [env:custom_board_name]
105+ platform = ststm32
106+ framework = stm32cube
107+ board = custom_board_name
108+ build.stm32cube.startup_file = startup_stm32l152xca.s
109+
110+
111+ Disabling Bundled Components
112+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113+
114+ Type: ``Bool (yes or no) `` | Multiple: ``No `` | Default: ``no ``
115+
116+ By default, PlatformIO adds dynamic library manifests to STM32Cube components (BSPs,
117+ middleware, etc.), so :ref: `ldf ` can be used to resolve project dependencies and
118+ suitable components will be added to the build process as standalone libraries.
119+ If your project doesn't require this feature, it can be disabled via the
120+ ``disable_embedded_libs `` option, for example:
121+
122+ .. code-block :: ini
123+
124+ [env:disco_f303vc]
125+ platform = ststm32
126+ framework = stm32cube
127+ board = disco_f303vc
128+ build.stm32cube.disable_embedded_libs = yes
129+
130+
131+ Custom Build Variant
132+ ~~~~~~~~~~~~~~~~~~~~
133+
134+ Type: ``String `` | Multiple: ``No `` | Default: ``None ``
135+
136+ The STM32Cube framework for each MCU family may contain Board Support Packages (BSPs)
137+ for various development kits. These BSPs mostly contain drivers for on-board hardware
138+ modules (displays, sensors, etc.). The ``variant `` option is used to select what
139+ target-specific macros should be used when compiling BSP components, for example:
140+
141+ .. code-block :: ini
142+
143+ [env:nucleo_g474re]
144+ platform = ststm32
145+ framework = stm32cube
146+ board = nucleo_g474re
147+ build.stm32cube.variant = STM32G4xx_Nucleo
148+
149+ Custom DSP Library
150+ ~~~~~~~~~~~~~~~~~~
151+
152+ Type: ``Bool (yes or no) `` | Multiple: ``No `` | Default: ``no ``
153+
154+ The STM32Cube contains header files and precompiled static archives for commonly used
155+ DSP functions. By default, PlatformIO adds paths to these headers and archives to each
156+ STM32Cube-based project. If a project already has its own implementation of the DSP
157+ library and to avoid possible conflicts with the default DSP library shipped with the
158+ framework, the ``custom_dsp_library `` can be used:
159+
160+ .. code-block :: ini
161+
162+ [env:nucleo_f401re]
163+ platform = ststm32
164+ framework = stm32cube
165+ board = nucleo_f401re
166+ build.stm32cube.custom_dsp_library = yes
167+
18168 Using with STM32CubeMX
19169----------------------
20170
0 commit comments