Skip to content

Commit dfb5adc

Browse files
authored
Merge pull request #2870 from fpistm/cmsis6
feat: moved to CMSIS 6.2.0
2 parents dfdf369 + 7c4054d commit dfb5adc

File tree

7 files changed

+79
-17
lines changed

7 files changed

+79
-17
lines changed

CI/update/stm32wrapper.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
system_path = ""
2020

2121
# CMSIS outside of the core. Can be updated by arg
22-
CMSIS_path = core_path.parent / "ArduinoModule-CMSIS" / "CMSIS_5"
22+
# CMSIS_VERSION = "CMSIS_5"
23+
CMSIS_VERSION = "CMSIS_6"
24+
CMSIS_path = core_path.parent / "ArduinoModule-CMSIS" / CMSIS_VERSION
2325
CMSIS_DSPSrc_path = ""
2426

2527
# Out sources files
@@ -82,7 +84,7 @@ def checkConfig(arg_core, arg_cmsis):
8284

8385
if arg_core is not None:
8486
core_path = Path(arg_core).resolve()
85-
CMSIS_path = core_path.parent / "ArduinoModule-CMSIS" / "CMSIS_5"
87+
CMSIS_path = core_path.parent / "ArduinoModule-CMSIS" / CMSIS_VERSION
8688

8789
if not core_path.is_dir():
8890
print(f"Could not find {core_path}")
@@ -103,7 +105,11 @@ def checkConfig(arg_core, arg_cmsis):
103105

104106
if arg_cmsis is not None:
105107
CMSIS_path = Path(arg_cmsis).resolve()
106-
CMSIS_DSPSrc_path = CMSIS_path / "CMSIS" / "DSP" / "Source"
108+
109+
if CMSIS_VERSION == "CMSIS_6":
110+
CMSIS_DSPSrc_path = CMSIS_path / ".." / "CMSIS-DSP" / "Source"
111+
else:
112+
CMSIS_DSPSrc_path = CMSIS_path / "CMSIS" / "DSP" / "Source"
107113

108114

109115
def printCMSISStartup(log):
@@ -289,13 +295,16 @@ def wrap(arg_core, arg_cmsis, log):
289295
print("CMSIS DSP generation skipped.")
290296
else:
291297
# Delete all subfolders
292-
deleteFolder(CMSIS_DSP_outSrc_path / "*")
298+
for path_object in CMSIS_DSP_outSrc_path.glob("*"):
299+
if path_object.is_dir():
300+
deleteFolder(path_object)
293301
for path_object in CMSIS_DSPSrc_path.glob("**/*"):
294302
if path_object.is_file() and path_object.name.endswith(".c"):
295303
dn = path_object.parent.name
296304
fn = path_object.name
297305
if dn in fn:
298306
fdn = CMSIS_DSP_outSrc_path / dn
307+
createFolder(fdn)
299308
with open(fdn / (f"{fn}"), "w", newline="\n") as out_file:
300309
out_file.write(
301310
dsp_file_template.render(dsp_dir=dn, dsp_name=fn)

cmake/ensure_core_deps.cmake

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ function(declare_deps CORE_VERSION)
9797
# 2. find the versions of the dependencies for that core
9898
set(XPACK_VERSION "0.0.0")
9999
set(CMSIS_VERSION "0.0.0")
100+
set(CMSIS_DSP_VERSION "0.0.0")
101+
set(CMSIS_NN_VERSION "0.0.0")
100102
# Note: we're ignoring the STM32Tools dep, because unlike Arduino IDE we don't need it (upload + misc scripts)
101103
string(JSON LEN_DEPS LENGTH "${DEPS}")
102104
math(EXPR LEN_DEPS "${LEN_DEPS}-1")
@@ -106,6 +108,10 @@ function(declare_deps CORE_VERSION)
106108
string(JSON XPACK_VERSION GET "${DEPS}" ${I_DEP} "version")
107109
elseif(${DEP_NAME} STREQUAL "CMSIS")
108110
string(JSON CMSIS_VERSION GET "${DEPS}" ${I_DEP} "version")
111+
elseif(${DEP_NAME} STREQUAL "CMSIS_DSP")
112+
string(JSON CMSIS_DSP_VERSION GET "${DEPS}" ${I_DEP} "version")
113+
elseif(${DEP_NAME} STREQUAL "CMSIS_NN")
114+
string(JSON CMSIS_NN_VERSION GET "${DEPS}" ${I_DEP} "version")
109115
endif()
110116
endforeach()
111117

@@ -114,6 +120,10 @@ function(declare_deps CORE_VERSION)
114120
set(XPACK_SHA "")
115121
set(CMSIS_URL "")
116122
set(CMSIS_SHA "")
123+
set(CMSIS_DSP_URL "")
124+
set(CMSIS_DSP_SHA "")
125+
set(CMSIS_NN_URL "")
126+
set(CMSIS_NN_SHA "")
117127
foreach(I_TOOL RANGE ${LEN_TOOLS})
118128
string(JSON TOOL_NAME GET "${TOOLS}" ${I_TOOL} "name")
119129
string(JSON TOOL_VERSION GET "${TOOLS}" ${I_TOOL} "version")
@@ -122,6 +132,10 @@ function(declare_deps CORE_VERSION)
122132
get_target_url("${TOOL_SUPPORT}" XPACK_URL XPACK_SHA)
123133
elseif(${TOOL_NAME} STREQUAL "CMSIS" AND ${TOOL_VERSION} VERSION_EQUAL ${CMSIS_VERSION})
124134
get_target_url("${TOOL_SUPPORT}" CMSIS_URL CMSIS_SHA)
135+
elseif(${TOOL_NAME} STREQUAL "CMSIS_DSP" AND ${TOOL_VERSION} VERSION_EQUAL ${CMSIS_DSP_VERSION})
136+
get_target_url("${TOOL_SUPPORT}" CMSIS_DSP_URL CMSIS_DSP_SHA)
137+
elseif(${TOOL_NAME} STREQUAL "CMSIS_NN" AND ${TOOL_VERSION} VERSION_EQUAL ${CMSIS_NN_VERSION})
138+
get_target_url("${TOOL_SUPPORT}" CMSIS_NN_URL CMSIS_NN_SHA)
125139
endif()
126140
endforeach()
127141

@@ -136,29 +150,55 @@ function(declare_deps CORE_VERSION)
136150
)
137151

138152
FetchContent_Declare(
139-
CMSIS5
140-
SOURCE_DIR ${DL_DIR}/dist/CMSIS5
153+
CMSIS6
154+
SOURCE_DIR ${DL_DIR}/dist/CMSIS6
141155
PREFIX ${DL_DIR}
142156
URL "${CMSIS_URL}"
143157
URL_HASH SHA256=${CMSIS_SHA}
144158
UPDATE_DISCONNECTED
145159
)
160+
161+
FetchContent_Declare(
162+
CMSIS_DSP
163+
SOURCE_DIR ${DL_DIR}/dist/CMSIS_DSP
164+
PREFIX ${DL_DIR}
165+
URL "${CMSIS_DSP_URL}"
166+
URL_HASH SHA256=${CMSIS_DSP_SHA}
167+
UPDATE_DISCONNECTED
168+
)
169+
170+
FetchContent_Declare(
171+
CMSIS_NN
172+
SOURCE_DIR ${DL_DIR}/dist/CMSIS_NN
173+
PREFIX ${DL_DIR}
174+
URL "${CMSIS_NN_URL}"
175+
URL_HASH SHA256=${CMSIS_NN_SHA}
176+
UPDATE_DISCONNECTED
177+
)
146178
endfunction()
147179

148-
# defines a CMSIS5_PATH in the caller's scope
180+
# defines a CMSIS6_PATH in the caller's scope
149181
function(ensure_core_deps)
150-
if(NOT EXISTS ${DL_DIR}/dist/CMSIS5 OR NOT EXISTS ${DL_DIR}/dist/xpack)
182+
if(NOT EXISTS ${DL_DIR}/dist/CMSIS6 OR NOT EXISTS ${DL_DIR}/dist/xpack)
151183
get_core_version(COREVER)
152184
declare_deps(${COREVER})
153185
message(STATUS "Downloading the CMSIS...")
154-
FetchContent_MakeAvailable(CMSIS5)
186+
FetchContent_MakeAvailable(CMSIS6)
155187
message(STATUS "Downloading the CMSIS... Done.")
188+
message(STATUS "Downloading the CMSIS_DSP...")
189+
FetchContent_MakeAvailable(CMSIS_DSP)
190+
message(STATUS "Downloading the CMSIS_DSP... Done.")
191+
message(STATUS "Downloading the CMSIS_NN...")
192+
FetchContent_MakeAvailable(CMSIS_NN)
193+
message(STATUS "Downloading the CMSIS_NN... Done.")
156194
message(STATUS "Downloading the compiler toolchain...")
157195
FetchContent_MakeAvailable(xpack)
158196
message(STATUS "Downloading the compiler toolchain... Done.")
159197
endif()
160198

161-
set(CMSIS5_PATH ${DL_DIR}/dist/CMSIS5 PARENT_SCOPE)
199+
set(CMSIS6_PATH ${DL_DIR}/dist/CMSIS6 PARENT_SCOPE)
200+
set(CMSIS_DSP_PATH ${DL_DIR}/dist/CMSIS_DSP PARENT_SCOPE)
201+
set(CMSIS_NN_PATH ${DL_DIR}/dist/CMSIS_NN PARENT_SCOPE)
162202

163203
find_program(CMAKE_ASM_COMPILER arm-none-eabi-gcc PATHS ${DL_DIR}/dist/xpack/bin REQUIRED)
164204
find_program(CMAKE_C_COMPILER arm-none-eabi-gcc PATHS ${DL_DIR}/dist/xpack/bin REQUIRED)

cmake/set_base_arduino_config.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ target_link_options(base_config INTERFACE
4848
LINKER:--script=${BUILD_SYSTEM_PATH}/ldscript.ld
4949
)
5050
target_link_directories(base_config INTERFACE
51-
"${CMSIS5_PATH}/CMSIS/DSP/Lib/GCC"
51+
"${CMSIS6_PATH}/CMSIS/DSP/Lib/GCC"
5252
)
5353

5454
target_include_directories(base_config INTERFACE
@@ -61,10 +61,10 @@ target_include_directories(base_config INTERFACE
6161
"${BUILD_LIB_PATH}/VirtIO/inc"
6262
"${BUILD_SYSTEM_PATH}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc"
6363
"${BUILD_SYSTEM_PATH}/Middlewares/ST/STM32_USB_Device_Library/Core/Src"
64-
"${CMSIS5_PATH}/CMSIS/DSP/Include"
65-
"${CMSIS5_PATH}/CMSIS/DSP/PrivateInclude"
66-
"${CMSIS5_PATH}/CMSIS/Core/Include/"
67-
"${CMSIS5_PATH}/CMSIS"
64+
"${CMSIS_DSP_PATH}/Include"
65+
"${CMSIS_DSP_PATH}/PrivateInclude"
66+
"${CMSIS6_PATH}/CMSIS/Core/Include/"
67+
"${CMSIS6_PATH}/CMSIS"
6868
"${BUILD_SYSTEM_PATH}/Middlewares/OpenAMP"
6969
"${BUILD_SYSTEM_PATH}/Middlewares/OpenAMP/open-amp/lib/include"
7070
"${BUILD_SYSTEM_PATH}/Middlewares/OpenAMP/libmetal/lib/include"

libraries/CMSIS_DSP/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ add_library(CMSIS_DSP_bin OBJECT EXCLUDE_FROM_ALL
4747
src/SVMFunctions/SVMFunctionsF16.c
4848
src/TransformFunctions/TransformFunctions.c
4949
src/TransformFunctions/TransformFunctionsF16.c
50+
src/WindowFunctions/WindowFunctions.c
5051
)
5152
target_link_libraries(CMSIS_DSP_bin PUBLIC CMSIS_DSP_usage)
5253

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../Source/WindowFunctions/WindowFunctions.c"

libraries/SrcWrapper/src/stm32/dwt.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ void dwt_access(bool ena)
5858
* Define DWT LSR mask which is (currentuly) not defined by the CMSIS.
5959
* Same as ITM LSR one.
6060
*/
61+
6162
#if !defined DWT_LSR_Present_Msk
63+
#if defined(ITM_LSR_PRESENT_Msk)
64+
#define DWT_LSR_Present_Msk ITM_LSR_PRESENT_Msk
65+
#else
6266
#define DWT_LSR_Present_Msk ITM_LSR_Present_Msk
6367
#endif
68+
#endif
6469
#if !defined DWT_LSR_Access_Msk
70+
#if defined(ITM_LSR_ACCESS_Msk)
71+
#define DWT_LSR_Access_Msk ITM_LSR_ACCESS_Msk
72+
#else
6573
#define DWT_LSR_Access_Msk ITM_LSR_Access_Msk
74+
#endif
6675
#endif
6776
uint32_t lsr = DWT->LSR;
6877

platform.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ tools_bin_path.linux={runtime.tools.STM32Tools.path}/linux
2525

2626
core_stm32_dir={build.core.path}/stm32
2727
hal_dir={build.system.path}/Drivers/{build.series}_HAL_Driver
28-
cmsis_dir={runtime.tools.CMSIS-5.9.0.path}/CMSIS
28+
cmsis_dir={runtime.tools.CMSIS-6.2.0.path}/CMSIS
29+
cmsis_dsp={runtime.tools.CMSIS_DSP-1.16.2.path}
30+
cmsis_nn={runtime.tools.CMSIS_NN-7.0.0.path}
2931
cmsis_dev_dir={build.system.path}/Drivers/CMSIS/Device/ST/{build.series}
3032
usbd_core_dir={build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core
3133
builtin_library_dir={build.core.path}/../../libraries
@@ -37,7 +39,7 @@ USBDevice_include_dir={builtin_library_dir}/USBDevice/inc
3739
# STM compile variables
3840
# ----------------------
3941
compiler.stm.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{core_stm32_dir}" "-I{SrcWrapper_include_dir}" "-I{SrcWrapper_include_dir}/LL" "-I{hal_dir}/Inc" "-I{hal_dir}/Src" "-I{build.system.path}/{build.series}" "-I{USBDevice_include_dir}" "-I{usbd_core_dir}/Inc" "-I{usbd_core_dir}/Src" "-I{VirtIO_include_dir}" {build.virtio_extra_include}
40-
compiler.arm.cmsis.c.flags="-I{cmsis_dir}/Core/Include/" "-I{cmsis_dev_dir}/Include/" "-I{cmsis_dev_dir}/Source/Templates/gcc/" "-I{cmsis_dir}/DSP/Include" "-I{cmsis_dir}/DSP/PrivateInclude"
42+
compiler.arm.cmsis.c.flags="-I{cmsis_dir}/Core/Include/" "-I{cmsis_dev_dir}/Include/" "-I{cmsis_dev_dir}/Source/Templates/gcc/" "-I{cmsis_dsp}/Include" "-I{cmsis_dsp}/PrivateInclude"
4143

4244
compiler.warning_flags=-w
4345
compiler.warning_flags.none=-w

0 commit comments

Comments
 (0)