Skip to content

Commit a21a0d7

Browse files
stm32cube: get rid of the HAL Legacy definitions header
Remove the HAL Legacy definitions header from all series using a little trick to ensure proper compilation despite the missing file, and update the README of all series to remove mention of patches to the header we are getting rid of. Also remove the other legacy headers (can_legacy / eth_legacy) which are never used from the Zephyr side. This is however more of a cosmectic patch as these headers are not part of the build (they are only included if the corresponding HAL module is enabled, which is not the case in Zephyr). Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 1e1d093 commit a21a0d7

File tree

67 files changed

+39
-129407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+39
-129407
lines changed

stm32cube/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,24 @@ endif()
139139

140140
# Add the series-agnostic LL headers to include directories
141141
zephyr_include_directories(common_ll/include)
142+
143+
# Add placeholder for STM32Cube HAL Legacy definitions header
144+
#
145+
# Each serie's STM32Cube package originally contains a header
146+
# provided for compatibility and filled with "old names" of
147+
# various Cube definitions. These are not used from Zephyr
148+
# as drivers should always be using the up-to-date Cube API
149+
# and, more importantly, some of these "legacy" definitions
150+
# clash with macros provided by Zephyr which breaks build!
151+
#
152+
# Sadly, the header can't be simply discarded when STM32Cube
153+
# packages are added to this repository as it is included
154+
# unconditionally by "stm32XXXxx_hal_def.h", a header which
155+
# provides definitions we do need. To avoid the maintenance
156+
# burden of patching every STM32Cube package to remove the
157+
# the offending `#include "Legacy/stm32_hal_legacy.h"`, we
158+
# instead do discard the Legacy header but add a carefully
159+
# crafted directory to the include path such that, when the
160+
# offending `#include` line is reached, it ends up including
161+
# an empty header file and everything works out :)
162+
zephyr_include_directories(cube_legacy_placeholder)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Dummy replacement for HAL Legacy definitions header (c.f., CMakeLists.txt) */

stm32cube/stm32c0xx/README

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,4 @@ Patch List:
4040
-Added stm32cube/stm32c0xx/drivers/include/stm32_assert.h
4141
-Removed unused stm32cube/stm32c0xx/drivers/include/stm32_assert_template.h
4242

43-
*Fix to remove PAGESIZE definition which conflicts with POSIX
44-
Impacted files:
45-
drivers/include/Legacy/stm32_hal_legacy.h
46-
4743
See release_note.html from STM32Cube

stm32cube/stm32c0xx/drivers/include/Legacy/stm32_hal_legacy.h

Lines changed: 0 additions & 4419 deletions
This file was deleted.

stm32cube/stm32f0xx/README

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,4 @@ Patch List:
4747
-Added stm32cube/stm32f0xx/drivers/include/stm32_assert.h
4848
-Removed unused stm32cube/stm32f0xx/drivers/include/stm32_assert_template.h
4949

50-
*Fix to remove PAGESIZE definition which conflicts with POSIX
51-
Impacted files:
52-
drivers/include/Legacy/stm32_hal_legacy.h
53-
5450
See release_note.html from STM32Cube

stm32cube/stm32f0xx/drivers/include/Legacy/stm32_hal_legacy.h

Lines changed: 0 additions & 4358 deletions
This file was deleted.

stm32cube/stm32f0xx/drivers/include/Legacy/stm32f0xx_hal_can_legacy.h

Lines changed: 0 additions & 790 deletions
This file was deleted.

stm32cube/stm32f1xx/README

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,4 @@ Patch List:
5252
-Added stm32cube/stm32f1xx/drivers/include/stm32_assert.h
5353
-Removed unused stm32cube/stm32f1xx/drivers/include/stm32_assert_template.h
5454

55-
*Fix to remove PAGESIZE definition which conflicts with POSIX
56-
Impacted files:
57-
drivers/include/Legacy/stm32_hal_legacy.h
58-
5955
See release_note.html from STM32Cube

stm32cube/stm32f1xx/drivers/include/Legacy/stm32_hal_legacy.h

Lines changed: 0 additions & 4375 deletions
This file was deleted.

stm32cube/stm32f1xx/drivers/include/Legacy/stm32f1xx_hal_can_ex_legacy.h

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)