Skip to content

Commit

Permalink
Merge pull request wolfSSL#7151 from lealem47/pic24
Browse files Browse the repository at this point in the history
MICROCHIP PIC24 support and example project
  • Loading branch information
JacobBarthelmeh authored Feb 12, 2024
2 parents d5142d8 + 154841a commit 83ae724
Show file tree
Hide file tree
Showing 17 changed files with 1,451 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ user_settings_asm.h
/IDE/Espressif/**/sdkconfig
/IDE/Espressif/**/sdkconfig.old

# MPLAB
/IDE/MPLABX16/wolfssl.X/dist/default/
/IDE/MPLABX16/wolfssl.X/.generated_files
/IDE/MPLABX16/wolfcrypt_test.X/dist/default/
/IDE/MPLABX16/wolfcrypt_test.X/.generated_files

# auto-created CMake backups
**/CMakeLists.txt.old

Expand Down
62 changes: 62 additions & 0 deletions IDE/MPLABX16/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# wolfSSL MPLAB X Project Files for XC16

This directory contains project files for the Microchip MPLAB X IDE. These
projects have been set up to use the Microchip PIC24 Starter Kit
and the Microchip XC16 compiler.

In order to generate the necessary auto-generated MPLAB X files, make sure
to import the wolfssl.X project into your MPLAB X workspace before trying to
build the wolfCrypt test. This will correctly set up the respective project's
Makefiles.

## Included Project Files

### wolfSSL library (wolfssl.X)

This project builds a static wolfSSL library. The settings for this project are in `user_settings.h`:
```
<wolfssl_root>/IDE/MPLABX16/user_settings.h
```

After this project has been built, the compiled library will be located at:
```
<wolfssl_root>/IDE/MPLABX16/wolfssl.X/dist/default/production/wolfssl.X.a
```

### wolfCrypt Test App (wolfcrypt_test.X)

This project tests the wolfCrypt cryptography modules. It is generally a good
idea to run this first on an embedded system after compiling wolfSSL in order
to verify all underlying crypto is working correctly. This project depends on
files generated by Microchip's MCC tool to view the UART output. Follow the
steps below to generate that code.

## Generating MCC UART code

1. Open the MPLAB Code Configurator application.

2. Set the Project path to the wolfSSL/IDE/MPLABX16 and enter your PIC device
into the interface.

3. Select MCC Clasic as the content type and click `Finish`.

4. Under the Device Resources section, find the UART entry and add the UART1
peripheral.

5. Note the UART settings and check the `Enable UART Interrupts` and
`Redirect Printf to UART` boxes.

6. Click the `Generate` button.


**Note** : If using an older version of `xc16`, you may have to add the
following to `user_settings.h`.
```
#define WOLFSSL_HAVE_MIN
#define WOLFSSL_HAVE_MAX
```

## Support

Please send questions or comments to support@wolfssl.com

8 changes: 8 additions & 0 deletions IDE/MPLABX16/include.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# vim:ft=automake
# All paths should be given relative to the root
#

EXTRA_DIST += \
IDE/MPLABX16/README.md \
IDE/MPLABX16/main.c \
IDE/MPLABX16/user_settings.h
39 changes: 39 additions & 0 deletions IDE/MPLABX16/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* main.c
*
* Copyright (C) 2006-2024 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/

#include <stdio.h>

#include <wolfssl/wolfcrypt/settings.h>
#include <wolfcrypt/test/test.h>

#include <stdlib.h>

#include "xc.h"
#include "mcc_generated_files/mcc.h"

int main(void) {
SYSTEM_Initialize();

wolfcrypt_test(NULL);

return 0;
}

Loading

0 comments on commit 83ae724

Please sign in to comment.