Skip to content

Commit 154841a

Browse files
author
Lealem Amedie
committed
MICROCHIP PIC24 support and example project
1 parent d043333 commit 154841a

17 files changed

Lines changed: 1451 additions & 2 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,12 @@ user_settings_asm.h
406406
/IDE/Espressif/**/sdkconfig
407407
/IDE/Espressif/**/sdkconfig.old
408408

409+
# MPLAB
410+
/IDE/MPLABX16/wolfssl.X/dist/default/
411+
/IDE/MPLABX16/wolfssl.X/.generated_files
412+
/IDE/MPLABX16/wolfcrypt_test.X/dist/default/
413+
/IDE/MPLABX16/wolfcrypt_test.X/.generated_files
414+
409415
# auto-created CMake backups
410416
**/CMakeLists.txt.old
411417

IDE/MPLABX16/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# wolfSSL MPLAB X Project Files for XC16
2+
3+
This directory contains project files for the Microchip MPLAB X IDE. These
4+
projects have been set up to use the Microchip PIC24 Starter Kit
5+
and the Microchip XC16 compiler.
6+
7+
In order to generate the necessary auto-generated MPLAB X files, make sure
8+
to import the wolfssl.X project into your MPLAB X workspace before trying to
9+
build the wolfCrypt test. This will correctly set up the respective project's
10+
Makefiles.
11+
12+
## Included Project Files
13+
14+
### wolfSSL library (wolfssl.X)
15+
16+
This project builds a static wolfSSL library. The settings for this project are in `user_settings.h`:
17+
```
18+
<wolfssl_root>/IDE/MPLABX16/user_settings.h
19+
```
20+
21+
After this project has been built, the compiled library will be located at:
22+
```
23+
<wolfssl_root>/IDE/MPLABX16/wolfssl.X/dist/default/production/wolfssl.X.a
24+
```
25+
26+
### wolfCrypt Test App (wolfcrypt_test.X)
27+
28+
This project tests the wolfCrypt cryptography modules. It is generally a good
29+
idea to run this first on an embedded system after compiling wolfSSL in order
30+
to verify all underlying crypto is working correctly. This project depends on
31+
files generated by Microchip's MCC tool to view the UART output. Follow the
32+
steps below to generate that code.
33+
34+
## Generating MCC UART code
35+
36+
1. Open the MPLAB Code Configurator application.
37+
38+
2. Set the Project path to the wolfSSL/IDE/MPLABX16 and enter your PIC device
39+
into the interface.
40+
41+
3. Select MCC Clasic as the content type and click `Finish`.
42+
43+
4. Under the Device Resources section, find the UART entry and add the UART1
44+
peripheral.
45+
46+
5. Note the UART settings and check the `Enable UART Interrupts` and
47+
`Redirect Printf to UART` boxes.
48+
49+
6. Click the `Generate` button.
50+
51+
52+
**Note** : If using an older version of `xc16`, you may have to add the
53+
following to `user_settings.h`.
54+
```
55+
#define WOLFSSL_HAVE_MIN
56+
#define WOLFSSL_HAVE_MAX
57+
```
58+
59+
## Support
60+
61+
Please send questions or comments to support@wolfssl.com
62+

IDE/MPLABX16/include.am

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# vim:ft=automake
2+
# All paths should be given relative to the root
3+
#
4+
5+
EXTRA_DIST += \
6+
IDE/MPLABX16/README.md \
7+
IDE/MPLABX16/main.c \
8+
IDE/MPLABX16/user_settings.h

IDE/MPLABX16/main.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* main.c
2+
*
3+
* Copyright (C) 2006-2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
22+
#include <stdio.h>
23+
24+
#include <wolfssl/wolfcrypt/settings.h>
25+
#include <wolfcrypt/test/test.h>
26+
27+
#include <stdlib.h>
28+
29+
#include "xc.h"
30+
#include "mcc_generated_files/mcc.h"
31+
32+
int main(void) {
33+
SYSTEM_Initialize();
34+
35+
wolfcrypt_test(NULL);
36+
37+
return 0;
38+
}
39+

0 commit comments

Comments
 (0)