|
1 | 1 | This is example code for adding a wolfSSH echoserver to a MPLABX project. |
2 | 2 |
|
3 | | -The steps to use the code is as follows: |
4 | | -1) Add wolfssh.c source file to project build. |
5 | | -2) Make sure that current MPLABX project handles setting up TCP stack (see MPLABX examples for this /microchip/harmony/XXX/apps/examples/) |
6 | | -3) Add include path to wolfssh root directory. |
7 | | -4) Add preprocessor macro WOLFSSL_USER_SETTINGS (this is so wolfssl/wolfssh includes user_settings.h) to the project properties. |
8 | | -5) Add include path to user_settings.h to project properties. |
9 | | -6) Add APP_SSH_Tasks() and APP_SSH_Initialize() declarations to app.h header file. |
10 | | -7) Add call to APP_SSH_Initialize() to system_init.c |
11 | | -8) Add call to APP_SSH_Tasks() to system_tasks.c |
12 | | - |
13 | | -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 needs to use wolfssl versions that are later than 4/5/2018 (mid v3.14.0) for hardware acceleration and versions v3.14.0 and later for software only. |
| 3 | +For SAMV71: |
| 4 | + |
| 5 | +1) Import the .mc3 settings. Create a new project for SAMV71, click on CM for content manager. Click "Load Manifest" and select the ide/mplabx/mcc-manifest-samv71.yml file and then click apply. |
| 6 | +2) Open MCC then click "Import" and import ide/mplabx/wolfssh-sftp-server-samv71.mc3 and then click "Generate" |
| 7 | +3) Adjust the "Preprocessor macros" to include WOLFSSH_IGNORE_FILE_WARN and WOLFSSL_USER_SETTINGS |
| 8 | +4) Create a user_sttings.h file in config/sam_v71_xult_freertos that includes config.h i.e. |
| 9 | + |
| 10 | +user_settings.h |
| 11 | +``` |
| 12 | + 1 #ifndef USER_SETTINGS_H |
| 13 | + 2 #define USER_SETTINGS_H |
| 14 | + 3 #include "config.h" |
| 15 | + 4 #endif |
| 16 | +``` |
| 17 | + |
| 18 | +5) Remove the generated app.c from Source Files |
| 19 | +6) Download wolfssh into src/third_party/wolfssh, for example: |
| 20 | + |
| 21 | +``` |
| 22 | +cd src/third_party |
| 23 | +git clone git@github.com:wolfssl/wolfssh |
| 24 | +``` |
| 25 | + |
| 26 | +7) Right click on the project and add existing item. Select src/third_party/wolfssh/ide/mplabx/wolfssh.c |
| 27 | +8) Right click on the project and add existing folder. Select src/third_party/wolfssh/src |
| 28 | +9) Increase the heap size to 200,000 by right clicking on the project, selecting "Properties"->"x32-ld" |
| 29 | +10) In "Header Files"/config/sam_v71_xult_freertos/configuration.h alter the configuration to support wolfSSH |
| 30 | + |
| 31 | +``` |
| 32 | +// wolfSSH |
| 33 | +#define WOLFSSL_WOLFSSH |
| 34 | +#ifndef NO_FILESYSTEM |
| 35 | + #define WOLFSSH_SFTP |
| 36 | +#endif |
| 37 | +#define WOLFSSH_NO_HMAC_SHA2_512 |
| 38 | +#define DEFAULT_WINDOW_SZ 16384 |
| 39 | +``` |
| 40 | + |
| 41 | +If present remove NO_FILESYSTEM and NO_SIG_WRAPPER. Add NO_WOLFSSL_DIR. |
| 42 | + |
| 43 | + |
| 44 | +Notes: |
| 45 | + |
| 46 | +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. |
14 | 47 |
|
15 | 48 | 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``` |
0 commit comments