|
28 | 28 | #include "wolfboot/wolfboot.h" |
29 | 29 | #include "printf.h" |
30 | 30 |
|
| 31 | +/* wolfCrypt test/benchmark support */ |
| 32 | +#ifdef WOLFCRYPT_TEST |
| 33 | +#include <wolfssl/wolfcrypt/settings.h> |
| 34 | +#include <wolfcrypt/test/test.h> |
| 35 | +int wolfcrypt_test(void *args); |
| 36 | +#endif |
| 37 | + |
| 38 | +#ifdef WOLFCRYPT_BENCHMARK |
| 39 | +#include <wolfssl/wolfcrypt/settings.h> |
| 40 | +#include <wolfcrypt/benchmark/benchmark.h> |
| 41 | +int benchmark_test(void *args); |
| 42 | +#endif |
| 43 | + |
31 | 44 | #define RED_LED 6 |
32 | 45 | #define GREEN_LED 7 |
33 | 46 | #define BLUE_LED 4 |
34 | 47 |
|
35 | 48 | extern void hal_init(void); |
36 | 49 |
|
| 50 | + |
| 51 | +volatile uint64_t SysTick_time_ms; |
| 52 | + |
| 53 | +void SysTick_Handler(void) |
| 54 | +{ |
| 55 | + SysTick_time_ms++; |
| 56 | +} |
| 57 | + |
| 58 | +static void systick_init(void) |
| 59 | +{ |
| 60 | + SysTick_Config(CLOCK_GetCoreSysClkFreq() / 1000U); /* 1 ms period */ |
| 61 | +} |
| 62 | + |
| 63 | + |
37 | 64 | #define IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */ |
38 | 65 | #define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */ |
39 | 66 | #define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */ |
@@ -106,7 +133,14 @@ void main(void) |
106 | 133 | uint8_t boot_state, update_state; |
107 | 134 |
|
108 | 135 | hal_init(); |
| 136 | + systick_init(); |
109 | 137 | leds_init(); |
| 138 | + __enable_irq(); |
| 139 | + |
| 140 | + wolfBoot_printf("\n==================================\n"); |
| 141 | + wolfBoot_printf("LPC55S69 wolfBoot demo Application\n"); |
| 142 | + wolfBoot_printf("Copyright 2026 wolfSSL Inc\n"); |
| 143 | + wolfBoot_printf("==================================\n"); |
110 | 144 |
|
111 | 145 | check_parts(&boot_ver, &update_ver, &boot_state, &update_state); |
112 | 146 |
|
@@ -147,69 +181,87 @@ void main(void) |
147 | 181 | GPIO_PinWrite(GPIO, 1, GREEN_LED, 0); |
148 | 182 | } |
149 | 183 |
|
| 184 | +#if defined(WOLFCRYPT_TEST) || defined(WOLFCRYPT_BENCHMARK) |
| 185 | + wolfCrypt_Init(); |
| 186 | + |
| 187 | +# ifdef WOLFCRYPT_TEST |
| 188 | + wolfBoot_printf("\nRunning wolfCrypt tests...\n"); |
| 189 | + wolfcrypt_test(NULL); |
| 190 | + wolfBoot_printf("Tests complete.\n\n"); |
| 191 | +# endif |
| 192 | + |
| 193 | +# ifdef WOLFCRYPT_BENCHMARK |
| 194 | + wolfBoot_printf("\nRunning wolfCrypt benchmarks...\n"); |
| 195 | + benchmark_test(NULL); |
| 196 | + wolfBoot_printf("Benchmarks complete.\n\n"); |
| 197 | +# endif |
| 198 | + |
| 199 | + wolfCrypt_Cleanup(); |
| 200 | +#endif |
| 201 | + |
150 | 202 | while (1) { |
151 | 203 | __asm__ volatile ("wfi"); |
152 | 204 | } |
153 | 205 | } |
154 | 206 |
|
155 | 207 |
|
156 | | -#include "sys/stat.h" |
157 | | -int _getpid(void) |
158 | | -{ |
159 | | - return 1; |
160 | | -} |
| 208 | +// #include "sys/stat.h" |
| 209 | +// int _getpid(void) |
| 210 | +// { |
| 211 | +// return 1; |
| 212 | +// } |
161 | 213 |
|
162 | | -int _kill(int pid, int sig) |
163 | | -{ |
164 | | - (void)pid; |
165 | | - (void)sig; |
166 | | - return -1; |
167 | | -} |
| 214 | +// int _kill(int pid, int sig) |
| 215 | +// { |
| 216 | +// (void)pid; |
| 217 | +// (void)sig; |
| 218 | +// return -1; |
| 219 | +// } |
168 | 220 |
|
169 | | -void _exit(int status) |
170 | | -{ |
171 | | - _kill(status, -1); |
172 | | - while (1) {} |
173 | | -} |
| 221 | +// void _exit(int status) |
| 222 | +// { |
| 223 | +// _kill(status, -1); |
| 224 | +// while (1) {} |
| 225 | +// } |
174 | 226 |
|
175 | | -int _read(int file, char *ptr, int len) |
176 | | -{ |
177 | | - (void)file; |
178 | | - (void)ptr; |
179 | | - (void)len; |
180 | | - return -1; |
181 | | -} |
| 227 | +// int _read(int file, char *ptr, int len) |
| 228 | +// { |
| 229 | +// (void)file; |
| 230 | +// (void)ptr; |
| 231 | +// (void)len; |
| 232 | +// return -1; |
| 233 | +// } |
182 | 234 |
|
183 | | -int _write(int file, char *ptr, int len) |
184 | | -{ |
185 | | - (void)file; |
186 | | - (void)ptr; |
187 | | - return len; |
188 | | -} |
| 235 | +// int _write(int file, char *ptr, int len) |
| 236 | +// { |
| 237 | +// (void)file; |
| 238 | +// (void)ptr; |
| 239 | +// return len; |
| 240 | +// } |
189 | 241 |
|
190 | | -int _close(int file) |
191 | | -{ |
192 | | - (void)file; |
193 | | - return -1; |
194 | | -} |
| 242 | +// int _close(int file) |
| 243 | +// { |
| 244 | +// (void)file; |
| 245 | +// return -1; |
| 246 | +// } |
195 | 247 |
|
196 | | -int _isatty(int file) |
197 | | -{ |
198 | | - (void)file; |
199 | | - return 1; |
200 | | -} |
| 248 | +// int _isatty(int file) |
| 249 | +// { |
| 250 | +// (void)file; |
| 251 | +// return 1; |
| 252 | +// } |
201 | 253 |
|
202 | | -int _lseek(int file, int ptr, int dir) |
203 | | -{ |
204 | | - (void)file; |
205 | | - (void)ptr; |
206 | | - (void)dir; |
207 | | - return 0; |
208 | | -} |
| 254 | +// int _lseek(int file, int ptr, int dir) |
| 255 | +// { |
| 256 | +// (void)file; |
| 257 | +// (void)ptr; |
| 258 | +// (void)dir; |
| 259 | +// return 0; |
| 260 | +// } |
209 | 261 |
|
210 | | -int _fstat(int file, struct stat *st) |
211 | | -{ |
212 | | - (void)file; |
213 | | - st->st_mode = S_IFCHR; |
214 | | - return 0; |
215 | | -} |
| 262 | +// int _fstat(int file, struct stat *st) |
| 263 | +// { |
| 264 | +// (void)file; |
| 265 | +// st->st_mode = S_IFCHR; |
| 266 | +// return 0; |
| 267 | +// } |
0 commit comments