Skip to content

Commit d3bd96f

Browse files
authored
Merge pull request #790 from JacobBarthelmeh/pic32
microchip example and filesystem port
2 parents f567065 + ae5fa76 commit d3bd96f

19 files changed

+22844
-31
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,6 @@ DLL Release
135135
/ide/Espressif/**/dependencies.lock
136136

137137

138+
/ide/mplabx/wolfssh.X/dist/
139+
/ide/mplabx/wolfssh.X/.generated_files
140+
/ide/mplabx/wolfssh.X/build

ide/include.am

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# All paths should be given relative to the root
44

55
include ide/winvs/include.am
6+
include ide/mplabx/include.am
67
include ide/CSBENCH/include.am
78
include ide/MQX/include.am
89
include ide/IAR-EWARM/include.am

ide/mplabx/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# wolfSSH MPLABX
2+
3+
This is example project to create a wolfSSH library and example code for adding
4+
a wolfSSH echoserver to a MPLABX project.
5+
6+
Tested on a ATSAMV71Q21B with MPLABX version 6.20.
7+
8+
### Building wolfSSH library
9+
10+
The library project is located at ide/mplabx/wolfssh.X
11+
12+
- First open wolfssh.X with MPLABX IDE then click on "CM" content manager and
13+
import the ide/mplabx/wolfssh.X/mcc-manifest-generated-success.yml file.
14+
- Click apply.
15+
- Next click "MCC" and "generate".
16+
- To build from the command line, do the following after the XC32 toolchain has
17+
been installed.
18+
19+
```
20+
cd ide/mplabx/wolfssh.X
21+
make
22+
```
23+
24+
- To build using the IDE open the project ide/mplabx/wolfssh.X and click build.
25+
26+
27+
This will produce a wolfssh.X.a library in the directory
28+
ide/mplabx/wolfssh.X/dist/default/production/wolfssh.X.a
29+
30+
The application and wolfSSL must be built with the same user_settings.h as the
31+
wolfSSH library was built with! Differences in macro's defined for
32+
configuration will cause undefined behavior and potential crashes.
33+
34+
### Building an example app
35+
36+
1) Adjust the "Preprocessor macros" to include WOLFSSL_USER_SETTINGS and add an
37+
include path to ide/mplabx/user_settings.h.
38+
2) Remove the generated app.c from Source File
39+
3) Link to the wolfssh.X.a library. Properties->Libraries->Add Library/Object
40+
File...
41+
4) Right click on the project and add existing item. Select ide/mplabx/wolfssh.c
42+
5) Increase the heap size to 200,000 by right clicking on the project, selecting
43+
"Properties"->"x32-ld"
44+
45+
Notes:
46+
47+
For the current project this was tested with the heap and stack set to 200,000
48+
each. This was not trimed to see the minumum possible heap and stack usage yet.
49+
The TX buffer size used was set to 1024. The example was developed with wolfssh
50+
version 1.4.20.
51+
52+
After building and flashing the board a wolfSSH echoserver will be open on port
53+
22 which can be connected to by using the example client bundled with wolfSSH.
54+
```./examples/client/client -u jill -P upthehill -h 192.168.1.120 -p 22```

ide/mplabx/include.am

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# vim:ft=automake
2+
# All paths should be given relative to the root
3+
4+
EXTRA_DIST+= ide/mplabx/README.md
5+
EXTRA_DIST+= ide/mplabx/user_settings.h
6+
EXTRA_DIST+= ide/mplabx/wolfssh.c
7+
8+
EXTRA_DIST+= wolfssh.X/Makefile
9+
EXTRA_DIST+= wolfssh.X/mcc-manifest-generated-success.yml
10+
EXTRA_DIST+= wolfssh.X/wolfssh.mc3
11+
EXTRA_DIST+= wolfssh.X/nbproject/configurations.xml
12+
EXTRA_DIST+= wolfssh.X/nbproject/project.xml

ide/mplabx/user_settings.h

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifndef USER_SETTINGS_H
2+
#define USER_SETTINGS_H
3+
4+
/* include Microchip configuration first and then make additional changes */
5+
#include "configuration.h"
6+
7+
#include <stddef.h>
8+
9+
/* Turn on filesystem support for SFTP use */
10+
#undef NO_FILESYSTEM
11+
12+
/* wolfSSH configuration macros */
13+
#define WOLFSSL_WOLFSSH
14+
#ifndef NO_FILESYSTEM
15+
#define WOLFSSH_SFTP
16+
#endif
17+
#define DEFAULT_WINDOW_SZ 16384
18+
#define WOLFSSH_NO_HMAC_SHA2_512
19+
20+
/* do not use dirent with wolfSSL */
21+
#define NO_WOLFSSL_DIR
22+
23+
/* avoid the defualt settings in older wolfssl versions from
24+
* wolfssl/wolfcryt/settings.h */
25+
#undef MICROCHIP_PIC32
26+
27+
#undef TFM_TIMING_RESISTANT
28+
#define TFM_TIMING_RESISTANT
29+
30+
#undef ECC_TIMING_RESISTANT
31+
#define ECC_TIMING_RESISTANT
32+
33+
/* In older versions of wolfSSL (5.7.6 and older) the strcasecmp and strncasecmp
34+
* were dependent on the macro MICROCHIP_PIC32. Defining them here overrides
35+
* that. */
36+
#if (__XC32_VERSION >= 1000) && (__XC32_VERSION < 4000)
37+
#define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2))
38+
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
39+
#else
40+
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
41+
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
42+
#endif
43+
44+
/* allow signature wrapper api for wolfSSH use */
45+
#undef NO_SIG_WRAPPER
46+
47+
#endif

ide/mplabx/wolfssh.X/Makefile

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#
2+
# There exist several targets which are by default empty and which can be
3+
# used for execution of your targets. These targets are usually executed
4+
# before and after some main targets. They are:
5+
#
6+
# .build-pre: called before 'build' target
7+
# .build-post: called after 'build' target
8+
# .clean-pre: called before 'clean' target
9+
# .clean-post: called after 'clean' target
10+
# .clobber-pre: called before 'clobber' target
11+
# .clobber-post: called after 'clobber' target
12+
# .all-pre: called before 'all' target
13+
# .all-post: called after 'all' target
14+
# .help-pre: called before 'help' target
15+
# .help-post: called after 'help' target
16+
#
17+
# Targets beginning with '.' are not intended to be called on their own.
18+
#
19+
# Main targets can be executed directly, and they are:
20+
#
21+
# build build a specific configuration
22+
# clean remove built files from a configuration
23+
# clobber remove all built files
24+
# all build all configurations
25+
# help print help mesage
26+
#
27+
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
28+
# .help-impl are implemented in nbproject/makefile-impl.mk.
29+
#
30+
# Available make variables:
31+
#
32+
# CND_BASEDIR base directory for relative paths
33+
# CND_DISTDIR default top distribution directory (build artifacts)
34+
# CND_BUILDDIR default top build directory (object files, ...)
35+
# CONF name of current configuration
36+
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
37+
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
38+
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
39+
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
40+
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
41+
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
42+
#
43+
# NOCDDL
44+
45+
46+
# Environment
47+
MKDIR=mkdir
48+
CP=cp
49+
CCADMIN=CCadmin
50+
RANLIB=ranlib
51+
52+
53+
# build
54+
build: .build-post
55+
56+
.build-pre:
57+
# Add your pre 'build' code here...
58+
59+
.build-post: .build-impl
60+
# Add your post 'build' code here...
61+
62+
63+
# clean
64+
clean: .clean-post
65+
66+
.clean-pre:
67+
# Add your pre 'clean' code here...
68+
# WARNING: the IDE does not call this target since it takes a long time to
69+
# simply run make. Instead, the IDE removes the configuration directories
70+
# under build and dist directly without calling make.
71+
# This target is left here so people can do a clean when running a clean
72+
# outside the IDE.
73+
74+
.clean-post: .clean-impl
75+
# Add your post 'clean' code here...
76+
77+
78+
# clobber
79+
clobber: .clobber-post
80+
81+
.clobber-pre:
82+
# Add your pre 'clobber' code here...
83+
84+
.clobber-post: .clobber-impl
85+
# Add your post 'clobber' code here...
86+
87+
88+
# all
89+
all: .all-post
90+
91+
.all-pre:
92+
# Add your pre 'all' code here...
93+
94+
.all-post: .all-impl
95+
# Add your post 'all' code here...
96+
97+
98+
# help
99+
help: .help-post
100+
101+
.help-pre:
102+
# Add your pre 'help' code here...
103+
104+
.help-post: .help-impl
105+
# Add your post 'help' code here...
106+
107+
108+
109+
# include project implementation makefile
110+
include nbproject/Makefile-impl.mk
111+
112+
# include project make variables
113+
include nbproject/Makefile-variables.mk
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file has been autogenerated by MPLAB Code Configurator. Please do not edit this file.
2+
3+
manifest_file_version: 1.0.0
4+
project: wolfssh
5+
creation_date: 2025-04-02T16:56:35.669-06:00[America/Denver]
6+
operating_system: Mac OS X
7+
mcc_mode: IDE
8+
mcc_mode_version: v6.20
9+
device_name: ATSAMV71Q21B
10+
compiler: XC32 4.35
11+
mcc_version: 5.5.0
12+
mcc_core_version: 5.7.0
13+
content_manager_version: 5.0.1
14+
is_mcc_offline: false
15+
is_using_prerelease_versions: false
16+
mcc_content_registries: https://registry.npmjs.org/
17+
device_library: {library_class: com.microchip.mcc.harmony.Harmony3Library, name: Harmony
18+
V3, version: 1.5.5}
19+
packs: {name: SAMV71_DFP, version: 4.12.237}
20+
modules:
21+
- {name: core, type: HARMONY, version: v3.13.1}
22+
- {name: csp, type: HARMONY, version: v3.18.0}
23+
- {name: filex, type: HARMONY, version: v6.2.1_rel}
24+
- {name: CMSIS_5, type: HARMONY, version: 5.9.0}
25+
- {name: littlefs, type: HARMONY, version: v2.10.1}
26+
- {name: wolfssl, type: HARMONY, version: v5.4.0}
27+
- {name: net, type: HARMONY, version: v3.11.0}
28+
- {name: crypto, type: HARMONY, version: v3.8.1}
29+
- {name: CMSIS-FreeRTOS, type: HARMONY, version: v10.5.1}

0 commit comments

Comments
 (0)