Skip to content

Commit d1c1bca

Browse files
authored
Merge pull request #8914 from dgarske/stm32n6
Added support for STM32N6
2 parents 4421f8b + 3358455 commit d1c1bca

5 files changed

Lines changed: 81 additions & 13 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ STM32F217xx
487487
STM32F401xE
488488
STM32F407xx
489489
STM32F437xx
490+
STM32F439xx
490491
STM32F756xx
491492
STM32F777xx
492493
STM32G071xx
@@ -502,6 +503,7 @@ STM32L4A6xx
502503
STM32L552xx
503504
STM32L562xx
504505
STM32MP135Fxx
506+
STM32N657xx
505507
STM32U575xx
506508
STM32U585xx
507509
STM32U5A9xx
@@ -687,7 +689,6 @@ WOLFSSL_ESPWROOM32
687689
WOLFSSL_EVP_PRINT
688690
WOLFSSL_EXPORT_INT
689691
WOLFSSL_EXPORT_SPC_SZ
690-
WOLFSSL_EXTRA
691692
WOLFSSL_FORCE_OCSP_NONCE_CHECK
692693
WOLFSSL_FRDM_K64
693694
WOLFSSL_FRDM_K64_JENKINS

IDE/STM32Cube/default_conf.ftl

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,117 +75,174 @@ extern ${variable.value} ${variable.name};
7575
#define WOLFSSL_STM32WB
7676
#define WOLFSSL_STM32_PKA
7777
#undef NO_STM32_CRYPTO
78+
#ifndef HAL_CONSOLE_UART
7879
#define HAL_CONSOLE_UART huart1
80+
#endif
7981
#elif defined(STM32WBA52xx)
8082
#define WOLFSSL_STM32WBA
8183
#define WOLFSSL_STM32_PKA
8284
#undef NO_STM32_HASH
8385
#undef NO_STM32_CRYPTO
8486
/* NUCLEO-WBA52CG USART1 (TX=PB12 / RX=PA8) */
87+
#ifndef HAL_CONSOLE_UART
8588
#define HAL_CONSOLE_UART huart1
89+
#endif
8690
#elif defined(STM32WL55xx)
8791
#define WOLFSSL_STM32WL
8892
#define WOLFSSL_STM32_PKA
8993
#undef NO_STM32_CRYPTO
94+
#ifndef HAL_CONSOLE_UART
9095
#define HAL_CONSOLE_UART huart2
96+
#endif
9197
#elif defined(STM32F407xx)
9298
#define WOLFSSL_STM32F4
99+
#ifndef HAL_CONSOLE_UART
93100
#define HAL_CONSOLE_UART huart2
94-
#elif defined(STM32F437xx)
101+
#endif
102+
#elif defined(STM32F437xx) || defined(STM32F439xx)
95103
#define WOLFSSL_STM32F4
96104
#undef NO_STM32_HASH
97105
#undef NO_STM32_CRYPTO
98106
#define STM32_HAL_V2
99-
#define HAL_CONSOLE_UART huart4
107+
#ifndef HAL_CONSOLE_UART
108+
#ifdef STM32F439xx
109+
#define HAL_CONSOLE_UART huart3
110+
#else
111+
#define HAL_CONSOLE_UART huart4
112+
#endif
113+
#endif
100114
#elif defined(STM32F777xx)
101115
#define WOLFSSL_STM32F7
102116
#undef NO_STM32_HASH
103117
#undef NO_STM32_CRYPTO
104118
#define STM32_HAL_V2
119+
#ifndef HAL_CONSOLE_UART
105120
#define HAL_CONSOLE_UART huart2
121+
#endif
106122
#elif defined(STM32F756xx)
107123
#define WOLFSSL_STM32F7
108124
#undef NO_STM32_HASH
109125
#undef NO_STM32_CRYPTO
110126
#define STM32_HAL_V2
127+
#ifndef HAL_CONSOLE_UART
111128
#define HAL_CONSOLE_UART huart3
129+
#endif
112130
#elif defined(STM32H7S3xx)
113131
#define WOLFSSL_STM32H7S
114132
#undef NO_STM32_HASH
115133
#undef NO_STM32_CRYPTO
116134
#define WOLFSSL_STM32_PKA
135+
#ifndef HAL_CONSOLE_UART
117136
#define HAL_CONSOLE_UART huart3
137+
#endif
118138
#elif defined(STM32H753xx)
119139
#define WOLFSSL_STM32H7
120140
#undef NO_STM32_HASH
121141
#undef NO_STM32_CRYPTO
142+
#ifndef HAL_CONSOLE_UART
122143
#define HAL_CONSOLE_UART huart3
144+
#endif
123145
#elif defined(STM32H723xx) || defined(STM32H725xx) || defined(STM32H743xx)
124146
#define WOLFSSL_STM32H7
147+
#ifndef HAL_CONSOLE_UART
125148
#define HAL_CONSOLE_UART huart3
149+
#endif
126150
#elif defined(STM32L4A6xx)
127151
#define WOLFSSL_STM32L4
128152
#undef NO_STM32_HASH
129153
#undef NO_STM32_CRYPTO
154+
#ifndef HAL_CONSOLE_UART
130155
#define HAL_CONSOLE_UART hlpuart1
156+
#endif
131157
#elif defined(STM32L475xx)
132158
#define WOLFSSL_STM32L4
159+
#ifndef HAL_CONSOLE_UART
133160
#define HAL_CONSOLE_UART huart1
161+
#endif
134162
#elif defined(STM32L562xx)
135163
#define WOLFSSL_STM32L5
136164
#define WOLFSSL_STM32_PKA
137165
#undef NO_STM32_HASH
138166
#undef NO_STM32_CRYPTO
167+
#ifndef HAL_CONSOLE_UART
139168
#define HAL_CONSOLE_UART huart1
169+
#endif
140170
#elif defined(STM32L552xx)
141171
#define WOLFSSL_STM32L5
142172
#undef NO_STM32_HASH
173+
#ifndef HAL_CONSOLE_UART
143174
#define HAL_CONSOLE_UART hlpuart1
175+
#endif
144176
#elif defined(STM32F207xx)
145177
#define WOLFSSL_STM32F2
178+
#ifndef HAL_CONSOLE_UART
146179
#define HAL_CONSOLE_UART huart3
180+
#endif
147181
#elif defined(STM32F217xx)
148182
#define WOLFSSL_STM32F2
183+
#ifndef HAL_CONSOLE_UART
149184
#define HAL_CONSOLE_UART huart2
185+
#endif
150186
#elif defined(STM32F107xC)
151187
#define WOLFSSL_STM32F1
152-
#define HAL_CONSOLE_UART huart4
153188
#define NO_STM32_RNG
189+
#ifndef HAL_CONSOLE_UART
190+
#define HAL_CONSOLE_UART huart4
191+
#endif
154192
#elif defined(STM32F401xE)
155193
#define WOLFSSL_STM32F4
156-
#define HAL_CONSOLE_UART huart2
157194
#define NO_STM32_RNG
158195
#define WOLFSSL_GENSEED_FORTEST /* no HW RNG is available use test seed */
196+
#ifndef HAL_CONSOLE_UART
197+
#define HAL_CONSOLE_UART huart2
198+
#endif
159199
#elif defined(STM32G071xx)
160200
#define WOLFSSL_STM32G0
161-
#define HAL_CONSOLE_UART huart2
162201
#define NO_STM32_RNG
163202
#define WOLFSSL_GENSEED_FORTEST /* no HW RNG is available use test seed */
203+
#ifndef HAL_CONSOLE_UART
204+
#define HAL_CONSOLE_UART huart2
205+
#endif
164206
#elif defined(STM32G491xx)
165207
#define WOLFSSL_STM32G4
166208
#define HAL_CONSOLE_UART hlpuart1
167209
#elif defined(STM32U575xx) || defined(STM32U585xx) || defined(STM32U5A9xx)
168-
#define HAL_CONSOLE_UART huart1
169210
#define WOLFSSL_STM32U5
170211
#define STM32_HAL_V2
171212
#if defined(STM32U585xx) || defined(STM32U5A9xx)
172213
#undef NO_STM32_HASH
173214
#undef NO_STM32_CRYPTO
174215
#define WOLFSSL_STM32_PKA
175216
#endif
217+
#ifndef HAL_CONSOLE_UART
218+
#define HAL_CONSOLE_UART huart1
219+
#endif
176220
#elif defined(STM32H563xx)
177221
#define WOLFSSL_STM32H5
178-
#define HAL_CONSOLE_UART huart3
179222
#define STM32_HAL_V2
180223
#undef NO_STM32_HASH
224+
#ifndef HAL_CONSOLE_UART
225+
#define HAL_CONSOLE_UART huart3
226+
#endif
181227
#elif defined(STM32MP135Fxx)
182228
#define WOLFSSL_STM32MP13
183-
#define HAL_CONSOLE_UART huart4
184229
#define STM32_HAL_V2
185230
#undef NO_STM32_HASH
186231
#undef NO_STM32_CRYPTO
187232
#define WOLFSSL_STM32_PKA
188233
#define WOLFSSL_STM32_PKA_V2
234+
#ifndef HAL_CONSOLE_UART
235+
#define HAL_CONSOLE_UART huart4
236+
#endif
237+
#elif defined(STM32N657xx)
238+
#define WOLFSSL_STM32N6
239+
#define STM32_HAL_V2
240+
#undef NO_STM32_HASH
241+
#undef NO_STM32_CRYPTO
242+
#define WOLFSSL_STM32_PKA
243+
#ifndef HAL_CONSOLE_UART
244+
#define HAL_CONSOLE_UART huart1
245+
#endif
189246
#else
190247
#warning Please define a hardware platform!
191248
/* This means there is not a pre-defined platform for your board/CPU */
@@ -199,16 +256,19 @@ extern ${variable.value} ${variable.name};
199256
/* Debug UART used for printf */
200257
/* The UART interface number varies for each board/CPU */
201258
/* Typically this is the UART attached to the ST-Link USB CDC UART port */
259+
#ifndef HAL_CONSOLE_UART
202260
#define HAL_CONSOLE_UART huart4
261+
#endif
203262

204263
/* Hardware Crypto - uncomment as available on hardware */
264+
//#define STM32_HAL_V2
205265
//#define WOLFSSL_STM32_PKA
266+
//#define WOLFSSL_STM32_PKA_V2
206267
//#define NO_STM32_RNG
207268
//#undef NO_STM32_HASH
208269
//#undef NO_STM32_CRYPTO
209270
/* if no HW RNG is available use test seed */
210271
//#define WOLFSSL_GENSEED_FORTEST
211-
//#define STM32_HAL_V2
212272
#endif
213273

214274

wolfcrypt/src/port/st/stm32.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
#elif defined(WOLFSSL_STM32WBA)
6868
#include <stm32wbaxx_hal_conf.h>
6969
#include <stm32wbaxx_hal_pka.h>
70+
#elif defined(WOLFSSL_STM32N6)
71+
#include <stm32n6xx_hal_conf.h>
72+
#include <stm32n6xx_hal_pka.h>
7073
#else
7174
#error Please add the hal_pk.h include
7275
#endif

wolfssl/wolfcrypt/port/st/stm32.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo,
142142
defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32L4) || \
143143
defined(WOLFSSL_STM32L5) || defined(WOLFSSL_STM32H7) || \
144144
defined(WOLFSSL_STM32U5) || defined(WOLFSSL_STM32H5) || \
145-
defined(WOLFSSL_STM32MP13) || defined(WOLFSSL_STM32H7S))
145+
defined(WOLFSSL_STM32MP13) || defined(WOLFSSL_STM32H7S) || \
146+
defined(WOLFSSL_STM32N6))
146147
/* Hardware supports AES GCM acceleration */
147148
#define STM32_CRYPTO_AES_GCM
148149
#endif
@@ -177,7 +178,7 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo,
177178
(defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32L5) || \
178179
defined(WOLFSSL_STM32H7) || defined(WOLFSSL_STM32U5) || \
179180
defined(WOLFSSL_STM32H5) || defined(WOLFSSL_STM32MP13) || \
180-
defined(WOLFSSL_STM32H7S))
181+
defined(WOLFSSL_STM32H7S) || defined(WOLFSSL_STM32N6))
181182
#define STM32_HAL_V2
182183
#endif
183184

wolfssl/wolfcrypt/settings.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,8 @@ extern void uITRON4_free(void *p) ;
21102110
defined(WOLFSSL_STM32G0) || defined(WOLFSSL_STM32U5) || \
21112111
defined(WOLFSSL_STM32H5) || defined(WOLFSSL_STM32WL) || \
21122112
defined(WOLFSSL_STM32G4) || defined(WOLFSSL_STM32MP13) || \
2113-
defined(WOLFSSL_STM32H7S) || defined(WOLFSSL_STM32WBA)
2113+
defined(WOLFSSL_STM32H7S) || defined(WOLFSSL_STM32WBA) || \
2114+
defined(WOLFSSL_STM32N6)
21142115

21152116
#define SIZEOF_LONG_LONG 8
21162117
#ifndef CHAR_BIT
@@ -2174,6 +2175,8 @@ extern void uITRON4_free(void *p) ;
21742175
#include "stm32u5xx_hal.h"
21752176
#elif defined(WOLFSSL_STM32H5)
21762177
#include "stm32h5xx_hal.h"
2178+
#elif defined(WOLFSSL_STM32N6)
2179+
#include "stm32n6xx_hal.h"
21772180
#elif defined(WOLFSSL_STM32MP13)
21782181
/* HAL headers error on our ASM files */
21792182
#ifndef __ASSEMBLER__

0 commit comments

Comments
 (0)