|
1 | | -This is example code for adding a wolfSSH echoserver to a MPLABX project. |
| 1 | +# wolfSSH MPLABX |
2 | 2 |
|
3 | | -For SAMV71: |
| 3 | +This is example project to create a wolfSSH library and example code for adding |
| 4 | +a wolfSSH echoserver to a MPLABX project. |
4 | 5 |
|
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. |
| 6 | +Tested on a ATSAMV71Q21B with MPLABX version 6.20. |
9 | 7 |
|
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 | | -``` |
| 8 | +### Building wolfSSH library |
17 | 9 |
|
18 | | -5) Remove the generated app.c from Source Files |
19 | | -6) Download wolfssh into src/third_party/wolfssh, for example: |
| 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. |
20 | 18 |
|
21 | 19 | ``` |
22 | | -cd src/third_party |
23 | | -git clone git@github.com:wolfssl/wolfssh |
| 20 | +cd ide/mplabx/wolfssh.X |
| 21 | +make |
24 | 22 | ``` |
25 | 23 |
|
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 |
| 24 | +- To build using the IDE open the project ide/mplabx/wolfssh.X and click build. |
30 | 25 |
|
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 | 26 |
|
41 | | -If present remove NO_FILESYSTEM and NO_SIG_WRAPPER. Add NO_WOLFSSL_DIR. |
| 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 |
42 | 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" |
43 | 44 |
|
44 | 45 | Notes: |
45 | 46 |
|
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. |
| 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. |
47 | 51 |
|
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``` |
| 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``` |
0 commit comments