Skip to content

Commit 32a9d26

Browse files
aiwyatt787davidflowers
authored andcommitted
Pull request #18: Feature/MCU16GITHUB-836 bootloader pre generated demos
Merge in MCU16CE/dspic33-dsc-bootloader-code-examples from feature/MCU16GITHUB-836-bootloader-pre-generated-demos to develop * commit 'ac6fde5e034b45621912b9003ec1082e5ad7dde7': (34 commits) Remove UART from keywords Keep png file types consistent Fix link and broken image Update release notes Update wording Update directions for TALIB and CAL download Change compiler from XCDSC to XC16 Shrink image Shrink image slightly Fix image error Fix rendering issue Add line breaks delete duplicate folder. pull over changes to new folder. Rename per requirements page Fix implicit declaration Pull request #4: Feature/MCU16GITHUB-840 Generate boot.x in MCC Feature/MCU16GITHUB-839 Generate app.x in MCC Update instructions for boot_demo merge Update instructions to reflect MCC generated CAL rather than copy paste Add changelog for initial release Update pathing for MCHP logo ...
2 parents c3ea429 + ac6fde5 commit 32a9d26

File tree

132 files changed

+18829
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+18829
-48
lines changed

.main-meta/main.json

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
11
{
2-
"metaDataVersion":"1.0.0",
3-
"category":"com.microchip.ide.project",
4-
"content":{
5-
"metaDataVersion":"1.3.0",
6-
"name":"com.microchip.mplabx.project.dspic33-dsc-bootloader-code-examples",
7-
"version":"x.x.x",
8-
"displayName":"xxxxxxxxxxxxxxx",
9-
"projectName":"dspic33-dsc-bootloader-code-examples",
10-
"shortDescription":"xxxxxxxxxxxxxxx",
11-
"ide":{
12-
"name":"MPLABX",
13-
"semverRange":">=5.40.0"
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.3.0",
6+
"name": "com.microchip.mplabx.project.dspic33-dsc-bootloader-code-examples",
7+
"version": "1.0.0",
8+
"displayName": "dsPIC33 DSC Bootloader Code Examples",
9+
"projectName": "dspic33-dsc-bootloader-code-examples",
10+
"shortDescription": "dsPIC33 DSC Bootloader Code Examples",
11+
"ide": {
12+
"name": "MPLABX",
13+
"semverRange": ">=6.15.0"
1414
},
15-
"compiler":{
16-
"name":"XC16",
17-
"semverRange":"^1.50.0"
15+
"compiler": {
16+
"name": "XC16",
17+
"semverRange": "^2.10.0"
1818
},
19-
"dfp":{
20-
"name":"xxxxxxxxxxxxxxx",
21-
"semverRange":">=x.x.x"
19+
"dfp": {
20+
"name": "dsPIC33CK-MP_DFP",
21+
"semverRange": ">=1.12.354"
2222
},
23-
"configurator": {
23+
"configurator": {
2424
"name": "MCC",
25-
"semverRange": ">=4.0.1"
25+
"semverRange": ">=5.6.1"
2626
},
27-
"device":{
28-
"metaDataVersion":"1.0.0",
29-
"category":"com.microchip.portal.contentRef",
30-
"content":{
31-
"metaDataVersion":"1.0.0",
32-
"category":"com.microchip.device",
33-
"name":"xxxxxxxxxxxxxxx",
34-
"versionRange":"*"
27+
"device": {
28+
"metaDataVersion": "1.0.0",
29+
"category": "com.microchip.portal.contentRef",
30+
"content": {
31+
"metaDataVersion": "1.0.0",
32+
"category": "com.microchip.device",
33+
"name": "dsPIC33CK1024MP710",
34+
"versionRange": "*"
3535
}
3636
},
37-
"keywords":[
38-
"GPIO",
39-
"UART"
37+
"keywords": [
38+
"GPIO"
4039
]
4140
}
4241
}

README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,17 @@
44
<img alt="Microchip Logo." src="images/microchip_logo_black_red.png">
55
</picture>
66

7-
## dspic33 dsc bootloader code examples
8-
9-
Board Image if any.
7+
## dsPIC33 CAN/CAN-FD Bootloader Demo
108

119
## Summary
12-
10+
An example bootloader using the 16-bit MCC bootloader and the CAN or CAN-FD peripheral.
1311

1412
## Related Documentation
13+
https://www.microchip.com/16-bit-bootloader
1514

15+
## Setup And Operation
1616

17-
## Software Used
18-
19-
20-
## Hardware Used
21-
22-
23-
## Setup
24-
25-
26-
## Operation
17+
See the README files associated with each folder that describe the required hardware, software, and setup instructions.
2718

2819

2920

changelog.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# dspic33-dsc-bootloader-code-examples v1.0.0
1+
# Secure Boot and Secure Firmware Upgrade over CAN-FD for dsPIC33C DSCs Demo v1.0.0
22
### Release Highlights
3-
4-
3+
* Initial Release - Refer to the README.md for a summary and execution procedure
54

65
### Features Added\Updated
6+
* Initial Release
77

88

99

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.3.0",
6+
"name": "com.microchip.mplabx.project.dspic33-dsc-bootloader-code-examples",
7+
"version": "1.0.0",
8+
"displayName": "CAN-FD Secure Boot and Secure Firmware Upgrade Demo",
9+
"projectName": "dspic33-dsc-bootloader-code-examples",
10+
"shortDescription": "This MPLAB® X IDE example demonstrates how to perform secure boot authentication and update via CAN-FD with ECDSA signature verification within MCC Melody.",
11+
"ide": {
12+
"name": "MPLABX",
13+
"semverRange": ">=6.15.0"
14+
},
15+
"compiler": {
16+
"name": "XC16",
17+
"semverRange": "^2.10.0"
18+
},
19+
"dfp": {
20+
"name": "dsPIC33CK-MP_DFP",
21+
"semverRange": ">=1.12.354"
22+
},
23+
"configurator": {
24+
"name": "MCC",
25+
"semverRange": ">=5.6.1"
26+
},
27+
"device": {
28+
"metaDataVersion": "1.0.0",
29+
"category": "com.microchip.portal.contentRef",
30+
"content": {
31+
"metaDataVersion": "1.0.0",
32+
"category": "com.microchip.device",
33+
"name": "dsPIC33CK1024MP710",
34+
"versionRange": "*"
35+
}
36+
},
37+
"keywords": [
38+
"Secure Bootloader",
39+
"Secure Firmware Upgrade",
40+
"Bootloader",
41+
"CAN FD",
42+
"Immutable Boot",
43+
"CodeGuard Security",
44+
"Firmware Upgrade",
45+
"Security",
46+
"Cryptography",
47+
"Public-key Cryptography",
48+
"CryptoAuthentication",
49+
"Authentication",
50+
"Microchip Device Firmware Update",
51+
"Certificate",
52+
"SHA",
53+
"SHA-256",
54+
"Public Key",
55+
"HSM",
56+
"Getting Started",
57+
"MCC",
58+
"XC16",
59+
"XC-DSC",
60+
"Private Key",
61+
"Code Protection",
62+
"TA100",
63+
"dsPIC",
64+
"DSC",
65+
"Over-the-Air Upgrade",
66+
"Automotive",
67+
"Hardware Security Module",
68+
"Flash OTP",
69+
"One-Time Programmable"
70+
]
71+
}
72+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<picture>
2+
<source media="(prefers-color-scheme: dark)" srcset="../images/microchip_logo_white_red.png">
3+
<source media="(prefers-color-scheme: light)" srcset="../images/microchip_logo_black_red.png">
4+
<img alt="Microchip Logo." src="../images/microchip_logo_black_red.png">
5+
</picture>
6+
7+
## Secure Boot and Secure Firmware Upgrade over CAN-FD for dsPIC33C DSCs Demo
8+
9+
![Board picture](./images/board.jpg)
10+
11+
## Introduction
12+
The associated bootloader and application projects demonstrate the following:
13+
* Immutable secure boot via CodeGuard
14+
* A/B type bootloading with Flash partitioning to support two firmware images and anti-roll back
15+
* Secure boot authentication via ECDSA signature verification
16+
* Secure firmware update via CAN-FD
17+
* Crypto acceleration via TA100
18+
19+
## Related Documentation
20+
* [dsPIC33C Touch-CAN-LIN Curiosity Development Board User's Guide](https://www.microchip.com/en-us/development-tool/EV97U97A)
21+
* [dsPIC33CK1024MP710 Datasheet](https://www.microchip.com/en-us/product/dsPIC33CK1024MP710)
22+
23+
## Tools
24+
25+
#### Software
26+
* **THIS PROJECT REQUIRES A NON PUBLIC COPY OF THE CRYPTOGRAPHIC AUTHENTICATION LIBRARY (CAL) FOR TA100 SUPPORT! See the [CryptoAuthentication Library Release Notes](https://onlinedocs.microchip.com/pr/GUID-7F2639F3-1541-4BFC-A031-9A718BFFC502-en-US-16/index.html?GUID-7D69101E-EA71-47BE-B794-7F2CA6363B2C) for download details**
27+
* The unzipped example project files, boot.X and app.X
28+
* [MPLAB® X IDE v6.15 or later](https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide)
29+
* [MPLAB® XC16 v2.10 or later](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers)
30+
* [Universal Bootloader Host Application v1.19.3 or later](https://www.microchip.com/16-bit-bootloader)
31+
* Device Family Pack 1.12.354
32+
* [MPLAB® Code Configurator (MCC) v5.6.1 or later (optional - for code configuration)](https://www.microchip.com/en-us/tools-resources/configure/mplab-code-configurator)
33+
* 16-Bit Bootloader MCC module v1.25.0 or later (optional - for code configuration)
34+
* The drivers for the selected Peak CAN-FD protocol analyzer/protocol generator (available at https://www.peak-system.com/Home.59.0.html?&L=1)
35+
36+
37+
#### Hardware
38+
* [dsPIC33C Touch-CAN-LIN Curiosity Development Board (EV97U97A)](https://www.microchip.com/en-us/development-tool/EV97U97A)
39+
* A Peak CAN protocol analyzer/protocol generator. A PCAN-USB FD was used for development of this demo (https://www.peak-system.com/PCAN-USB-FD.365.0.html?&L=1)
40+
* A CAN cable
41+
* A CAN-FD bus terminator (or modify the Peak analyzer per their user's guide for proper CAN-FD termination)
42+
* A micro USB cable, a USB-Type C cable, or a 9v power adapter for the dsPIC33C Touch CAN LIN Curiosity Development Board (for powering the board)
43+
* [TA100 Trust Anchor External HSM 8-Pin SOIC](https://www.microchip.com/en-us/product/ta100)
44+
* [TA100 8-Pin SOIC CryptoAutomotive™ Socket Board](https://www.microchip.com/en-us/development-tool/AC164167)
45+
46+
## Running the Demo
47+
48+
##### Hardware Setup
49+
1. With the Development Board detached from any power source, programmer, or USB connection, connect the TA100 8-Pin SOIC CryptoAutomotive™ Socket board into the mikroBUS™ A slot with the jumpers set for SPI
50+
2. Connect the Peak analyzer/generator to your computer
51+
3. Connect the Peak analyzer/generator to the CAN/CAN-FD Driver Circuit on the Development Board
52+
4. Connect the micro-USB cable to port J1 of the Development Board to the host computer.<br>
53+
54+
![Hardware Setup](./images/hardware_setup.png)
55+
56+
#### Programming the Bootloader
57+
1. Open the boot.X project in MPLAB® X
58+
2. Open MCC
59+
3. Right click on Project Resources and select "Force Update on All"<br>
60+
![Force Update](./images/MCC_Force_Update.png)
61+
4. Click "Generate"<br>
62+
![Generate](./images/MCC_Generate.png)
63+
5. Accept all incoming code changes for files **within the CryptoAuthenticationLibrary directory** by selecting "Replace All" in the merge helper UI. **NOTE: DO NOT accept incoming changes for boot_demo.c. Accept all other file changes and close out of MCC**<br>
64+
![Merge Resolution](./images/MCC_Merge_Resolution.png)
65+
6. Press the “Make and Program” button on the top bar<br>
66+
![Make and Program Device](./images/make_and_program.png)
67+
7. Select the appropriate programmer if prompted
68+
8. The project should compile and program successfully
69+
9. Verify the LED11 is solid on the Development Board. This indicates the bootloader is running
70+
71+
#### Building the Application
72+
1. Open the app.X project in MPLAB® X
73+
2. Press the “Clean and Build Project” button on the top bar. **NOTE**: Make sure not to hit the program button. This will program the application code over the bootloader that was just programmed<br>
74+
![Clean and Build](./images/clean_and_build.png)
75+
3. The project should compile cleanly. app.X/dist/default/production/app.X.production.hex should be generated
76+
4. Verify that LED11 is still solid
77+
a. If LED11 is blinking instead of solid, then the application code was programmed instead of only compiled. Go back to the “Programming the Bootloader” stage and re-program the bootloader
78+
79+
#### Loading the Application
80+
1. Open the Universal Bootloader Host Application tool (UBHA)<br>
81+
![UBHA](./images/UBHA_open.png)
82+
2. Select the “PIC24/dsPIC” option from the “Device Architecture” selection drop down<br>
83+
![UBHA Device Architecture](./images/UBHA_device_architecture.png)
84+
3. Select “CAN” from the protocol drop down selection box<br>
85+
![UBHA Protocol Selection](./images/UBHA_protocol.png)
86+
4. Select the “Settings->CAN” option from the top menu<br>
87+
![UBHA CAN Settings Dropdown](./images/UBHA_Settings_CAN_Dropdown.png)
88+
5. Select the Peak protocol analyzer being used and the appropriate CAN configuration settings for this demo (listed below). When complete, press “Apply”:
89+
a. Nominal Bit Rate: 125.00 kbits/s
90+
b. CAN-FD: enabled
91+
c. CAN-FD TX Data Length: 8
92+
d. Flexible Data Rate: Enabled
93+
e. Flexible Data Rate: 2Mbits/s
94+
f. Message Format: Standard
95+
g. Host to Device ID: 0xA1
96+
h. Device to Host ID: 0xA2<br>
97+
![CAN Settings](./images/UBHA_CAN_Settings.png)
98+
6. Press the "Read Device Settings" button
99+
a. The Application start address and Application end address fields should have updated. If it did not or if you get a communication error, please go back to the “Programming the Bootloader” stage to make sure the bootloader was programmed correctly<br>
100+
![Read Device Settings](./images/UBHA_Read_Device_Settings.png)
101+
7. Load the application hex file by selecting “File->Open/Load File (*.hex)”
102+
a. Select the file generated in the previous section: app.X/dist/default/production/app.X.production.hex<br>
103+
![Open Hex File](./images/UBHA_Open_Hex.png)
104+
8. Check the "Enable Self Verification After Program" checkbox<br>
105+
![Enable Verification](./images/UBHA_Enable_Verification.png)
106+
9. Press “Program Device”. The application should program erase, program and perform a self verify using the TA100 for an ECDSA verify then read back verify correctly. Note: The reset response may not be fully transmitted before reset which may result in the reset response failing. The reset most likely did occur and the error can be safely ignored.
107+
a. After a few seconds, LED11 should be blinking<br>
108+
![Program Device](./images/UBHA_Program.png)
109+
110+
## Trademarks
111+
112+
MPLAB® is a registered trademark of Microchip Technology Inc. All other trademarks are the property of their respective owner.

0 commit comments

Comments
 (0)