Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,6 @@ DLL Release
/ide/Espressif/**/dependencies.lock


/ide/mplabx/wolfssh.X/dist/
/ide/mplabx/wolfssh.X/.generated_files
/ide/mplabx/wolfssh.X/build
1 change: 1 addition & 0 deletions ide/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# All paths should be given relative to the root

include ide/winvs/include.am
include ide/mplabx/include.am
include ide/CSBENCH/include.am
include ide/MQX/include.am
include ide/IAR-EWARM/include.am
Expand Down
54 changes: 54 additions & 0 deletions ide/mplabx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# wolfSSH MPLABX

This is example project to create a wolfSSH library and example code for adding
a wolfSSH echoserver to a MPLABX project.

Tested on a ATSAMV71Q21B with MPLABX version 6.20.

### Building wolfSSH library

The library project is located at ide/mplabx/wolfssh.X

- First open wolfssh.X with MPLABX IDE then click on "CM" content manager and
import the ide/mplabx/wolfssh.X/mcc-manifest-generated-success.yml file.
- Click apply.
- Next click "MCC" and "generate".
- To build from the command line, do the following after the XC32 toolchain has
been installed.

```
cd ide/mplabx/wolfssh.X
make
```

- To build using the IDE open the project ide/mplabx/wolfssh.X and click build.


This will produce a wolfssh.X.a library in the directory
ide/mplabx/wolfssh.X/dist/default/production/wolfssh.X.a

The application and wolfSSL must be built with the same user_settings.h as the
wolfSSH library was built with! Differences in macro's defined for
configuration will cause undefined behavior and potential crashes.

### Building an example app

1) Adjust the "Preprocessor macros" to include WOLFSSL_USER_SETTINGS and add an
include path to ide/mplabx/user_settings.h.
2) Remove the generated app.c from Source File
3) Link to the wolfssh.X.a library. Properties->Libraries->Add Library/Object
File...
4) Right click on the project and add existing item. Select ide/mplabx/wolfssh.c
5) Increase the heap size to 200,000 by right clicking on the project, selecting
"Properties"->"x32-ld"

Notes:

For the current project this was tested with the heap and stack set to 200,000
each. This was not trimed to see the minumum possible heap and stack usage yet.
The TX buffer size used was set to 1024. The example was developed with wolfssh
version 1.4.20.

After building and flashing the board a wolfSSH echoserver will be open on port
22 which can be connected to by using the example client bundled with wolfSSH.
```./examples/client/client -u jill -P upthehill -h 192.168.1.120 -p 22```
12 changes: 12 additions & 0 deletions ide/mplabx/include.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# vim:ft=automake
# All paths should be given relative to the root

EXTRA_DIST+= ide/mplabx/README.md
EXTRA_DIST+= ide/mplabx/user_settings.h
EXTRA_DIST+= ide/mplabx/wolfssh.c

EXTRA_DIST+= wolfssh.X/Makefile
EXTRA_DIST+= wolfssh.X/mcc-manifest-generated-success.yml
EXTRA_DIST+= wolfssh.X/wolfssh.mc3
EXTRA_DIST+= wolfssh.X/nbproject/configurations.xml
EXTRA_DIST+= wolfssh.X/nbproject/project.xml
47 changes: 47 additions & 0 deletions ide/mplabx/user_settings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef USER_SETTINGS_H
#define USER_SETTINGS_H

/* include Microchip configuration first and then make additional changes */
#include "configuration.h"

#include <stddef.h>

/* Turn on filesystem support for SFTP use */
#undef NO_FILESYSTEM

/* wolfSSH configuration macros */
#define WOLFSSL_WOLFSSH
#ifndef NO_FILESYSTEM
#define WOLFSSH_SFTP
#endif
#define DEFAULT_WINDOW_SZ 16384
#define WOLFSSH_NO_HMAC_SHA2_512

/* do not use dirent with wolfSSL */
#define NO_WOLFSSL_DIR

/* avoid the defualt settings in older wolfssl versions from
* wolfssl/wolfcryt/settings.h */
#undef MICROCHIP_PIC32

#undef TFM_TIMING_RESISTANT
#define TFM_TIMING_RESISTANT

#undef ECC_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT

/* In older versions of wolfSSL (5.7.6 and older) the strcasecmp and strncasecmp
* were dependent on the macro MICROCHIP_PIC32. Defining them here overrides
* that. */
#if (__XC32_VERSION >= 1000) && (__XC32_VERSION < 4000)
#define XSTRCASECMP(s1,s2) strcasecmp((s1),(s2))
#define XSTRNCASECMP(s1,s2,n) strncasecmp((s1),(s2),(n))
#else
#define XSTRCASECMP(s1,s2) strcmp((s1),(s2))
#define XSTRNCASECMP(s1,s2,n) strncmp((s1),(s2),(n))
#endif

/* allow signature wrapper api for wolfSSH use */
#undef NO_SIG_WRAPPER

#endif
113 changes: 113 additions & 0 deletions ide/mplabx/wolfssh.X/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL


# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...
# WARNING: the IDE does not call this target since it takes a long time to
# simply run make. Instead, the IDE removes the configuration directories
# under build and dist directly without calling make.
# This target is left here so people can do a clean when running a clean
# outside the IDE.

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk
29 changes: 29 additions & 0 deletions ide/mplabx/wolfssh.X/mcc-manifest-generated-success.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file has been autogenerated by MPLAB Code Configurator. Please do not edit this file.

manifest_file_version: 1.0.0
project: wolfssh
creation_date: 2025-04-02T16:56:35.669-06:00[America/Denver]
operating_system: Mac OS X
mcc_mode: IDE
mcc_mode_version: v6.20
device_name: ATSAMV71Q21B
compiler: XC32 4.35
mcc_version: 5.5.0
mcc_core_version: 5.7.0
content_manager_version: 5.0.1
is_mcc_offline: false
is_using_prerelease_versions: false
mcc_content_registries: https://registry.npmjs.org/
device_library: {library_class: com.microchip.mcc.harmony.Harmony3Library, name: Harmony
V3, version: 1.5.5}
packs: {name: SAMV71_DFP, version: 4.12.237}
modules:
- {name: core, type: HARMONY, version: v3.13.1}
- {name: csp, type: HARMONY, version: v3.18.0}
- {name: filex, type: HARMONY, version: v6.2.1_rel}
- {name: CMSIS_5, type: HARMONY, version: 5.9.0}
- {name: littlefs, type: HARMONY, version: v2.10.1}
- {name: wolfssl, type: HARMONY, version: v5.4.0}
- {name: net, type: HARMONY, version: v3.11.0}
- {name: crypto, type: HARMONY, version: v3.8.1}
- {name: CMSIS-FreeRTOS, type: HARMONY, version: v10.5.1}
Loading