Skip to content

Commit d3dfb15

Browse files
authored
Merge pull request #503 from lealem47/stm32cube
Initial support for STM32Cube
2 parents 564d43e + 360abcf commit d3dfb15

File tree

11 files changed

+694
-4
lines changed

11 files changed

+694
-4
lines changed

ide/STM32CUBE/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# wolfSSH for STM32 Cube IDE
2+
3+
The wolfSSH Cube Pack can be found [here](https://www.wolfssl.com/files/ide/I-CUBE-wolfSSH.pack) and is dependent on the `wolfCrypt` library.
4+
5+
1. The first step is to set up the wolfCrypt library in your ST project following the guide here [https://github.com/wolfSSL/wolfssl/blob/master/IDE/STM32Cube/README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/STM32Cube/README.md). To run the wolfSSH unit tests, name the entry function `wolfSSHTest` instead of `wolfCryptDemo`.
6+
7+
2. Then install the wolfSSH Cube Pack in the same manner as the wolfSSL pack with CUBEMX.
8+
9+
3. Open the project `.ioc` file and click the `Software Packs` drop down menu and then `Select Components`. Expand the `wolfSSH` pack and check all the components.
10+
11+
4. In the `Software Packs` configuration category of the `.ioc` file, click on the wolfSSH pack and enable the library by checking the box.
12+
13+
5. Since LwIP is a dependency for the Cube Pack, enable LwIP in the `Middleware` configuration category of the project. Also enable the `LWIP_DNS` option in the LwIP configuration settings.
14+
15+
6. Save your changes and select yes to the prompt asking about generating code.
16+
17+
7. Build the project and run the unit tests.
18+
19+
## Notes
20+
- Make sure to make [these changes](https://github.com/wolfSSL/wolfssl/tree/master/IDE/STM32Cube#stm32-printf) to redirect the printf's to the UART.
21+
22+
- If looking to enable filesystem support, the pack assumes the user has defined their own filesystem in `wolfssh/myFilesystem.h`. That file will originally contain a dummy filesystem. If going the FATFS route, make sure to replace `#define WOLFSSH_USER_FILESYSTEM` with `#define WOLFSSH_FATFS` in the `wolfSSL.I-CUBE-wolfSSH_conf.h` header file. The wolfSSL Cube Pack also defaults to disabling filesystem support so make sure to remove `#define NO_FILESYSTEM` from `wolfSSL.I-CUBE-wolfSSL_conf.h`.

ide/STM32CUBE/default_conf.ftl

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
[#ftl]
2+
/**
3+
******************************************************************************
4+
* File Name : ${name}
5+
* Description : This file provides code for the configuration
6+
* of the ${name} instances.
7+
******************************************************************************
8+
[@common.optinclude name=mxTmpFolder+"/license.tmp"/][#--include License text --]
9+
******************************************************************************
10+
*/
11+
[#assign s = name]
12+
[#assign toto = s?replace(".","_")]
13+
[#assign toto = toto?replace("/","")]
14+
[#assign toto = toto?replace("-","_")]
15+
[#assign inclusion_protection = toto?upper_case]
16+
/* Define to prevent recursive inclusion -------------------------------------*/
17+
#ifndef __${inclusion_protection}__
18+
#define __${inclusion_protection}__
19+
20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
24+
25+
/* Includes ------------------------------------------------------------------*/
26+
[#if includes??]
27+
[#list includes as include]
28+
#include "${include}"
29+
[/#list]
30+
[/#if]
31+
32+
[#-- SWIPdatas is a list of SWIPconfigModel --]
33+
[#list SWIPdatas as SWIP]
34+
[#-- Global variables --]
35+
[#if SWIP.variables??]
36+
[#list SWIP.variables as variable]
37+
extern ${variable.value} ${variable.name};
38+
[/#list]
39+
[/#if]
40+
41+
[#-- Global variables --]
42+
43+
[#assign instName = SWIP.ipName]
44+
[#assign fileName = SWIP.fileName]
45+
[#assign version = SWIP.version]
46+
47+
/**
48+
MiddleWare name : ${instName}
49+
MiddleWare fileName : ${fileName}
50+
MiddleWare version : ${version}
51+
*/
52+
[#if SWIP.defines??]
53+
[#list SWIP.defines as definition]
54+
/*---------- [#if definition.comments??]${definition.comments}[/#if] -----------*/
55+
#define ${definition.name} #t#t ${definition.value}
56+
[#if definition.description??]${definition.description} [/#if]
57+
[/#list]
58+
[/#if]
59+
60+
61+
62+
[/#list]
63+
64+
/* ------------------------------------------------------------------------- */
65+
/* Platform */
66+
/* ------------------------------------------------------------------------- */
67+
#define WOLFSSH_STM32_CUBEMX
68+
/* #define WOLFSSL_CMSIS_RTOS */
69+
/* #define NO_FILESYSTEM */
70+
71+
/* ------------------------------------------------------------------------- */
72+
/* Enable Features */
73+
/* ------------------------------------------------------------------------- */
74+
/* SCP */
75+
#undef WOLFSSH_SCP
76+
#if defined(WOLFSSH_CONF_SCP) && WOLFSSH_CONF_SCP == 1
77+
#define WOLFSSH_SCP
78+
#endif
79+
80+
/* SFTP */
81+
#undef WOLFSSH_SFTP
82+
#if !defined(NO_FILESYSTEM) && defined(WOLFSSH_CONF_SFTP) && WOLFSSH_CONF_SFTP == 1
83+
#define WOLFSSH_SFTP
84+
#endif
85+
86+
/* ------------------------------------------------------------------------- */
87+
/* Debugging */
88+
/* ------------------------------------------------------------------------- */
89+
#if defined(WOLFSSH_CONF_DEBUG) && WOLFSSH_CONF_DEBUG == 1
90+
#define DEBUG_WOLFSSH
91+
#endif
92+
93+
94+
/* ------------------------------------------------------------------------- */
95+
/* wolfSSH IO */
96+
/* ------------------------------------------------------------------------- */
97+
#define WOLFSSH_LWIP
98+
/* Remove the LWIP define and uncomment the line below to use user defined IO */
99+
/* #define WOLFSSL_USER_IO */
100+
101+
/* To be defined for the target Socket API */
102+
#define WSTARTTCP()
103+
104+
#define WOLFSSH_LOG_PRINTF
105+
#define WOLFSSL_LOG_PRINTF
106+
#define fprintf(err, ... ) printf(__VA_ARGS__)
107+
108+
#define BENCH_EMBEDDED
109+
#define NO_WRITEV
110+
#define NO_DEV_RANDOM
111+
#define USE_CERT_BUFFERS_2048
112+
#define WOLFSSL_USER_CURRTIME
113+
#define SIZEOF_LONG_LONG 8
114+
#define NO_WOLFSSL_DIR
115+
#define WOLFSSL_NO_CURRDIR
116+
#define NO_WOLF_C99
117+
#define NO_MULTIBYTE_PRINT
118+
119+
120+
#if !defined(NO_FILESYSTEM)
121+
#define WOLFSSH_USER_FILESYSTEM
122+
#endif
123+
#define NO_WOLFSSH_DIR
124+
125+
126+
#define XVALIDATEDATE(d, f,t) (0)
127+
#define WOLFSSL_USER_CURRTIME /* for benchmark */
128+
129+
#define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */
130+
131+
#define TFM_TIMING_RESISTANT
132+
#define ECC_TIMING_RESISTANT
133+
#define WC_RSA_BLINDING
134+
135+
/* #define NO_DH */
136+
#define HAVE_AESGCM
137+
#define WOLFSSL_SHA512
138+
#define HAVE_ECC
139+
#define HAVE_CURVE25519
140+
#define CURVE25519_SMALL
141+
#define HAVE_ED25519
142+
143+
typedef unsigned int size_t;
144+
145+
/* defines for unit tests */
146+
#define NO_UNITTEST_MAIN_DRIVER
147+
#define NO_TESTSUITE_MAIN_DRIVER
148+
#define NO_APITEST_MAIN_DRIVER
149+
150+
#ifdef __cplusplus
151+
}
152+
#endif
153+
#endif /* ${inclusion_protection}_H */
154+
155+
/**
156+
* @}
157+
*/
158+
159+
/*****END OF FILE****/

ide/STM32CUBE/include.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# vim:ft=automake
2+
# included from Top Level Makefile.am
3+
# All paths should be given relative to the root
4+
5+
EXTRA_DIST+= ide/STM32CUBE/main.c
6+
EXTRA_DIST+= ide/STM32CUBE/wolfssh_test.c
7+
EXTRA_DIST+= ide/STM32CUBE/wolfssh_test.h
8+
EXTRA_DIST+= ide/STM32CUBE/myFilesystem.h
9+
EXTRA_DIST+= ide/STM32CUBE/README.md
10+
EXTRA_DIST+= ide/STM32CUBE/default_conf.ftl

0 commit comments

Comments
 (0)