Skip to content

Commit 4da11a2

Browse files
aiwyatt787davidflowers
authored andcommitted
Pull request #77: Move changes over to demo project from boot project
Merge in MCU16CE/dspic33-dsc-bootloader-code-examples from ~C74569/dspic33-dsc-bootloader-code-examples:feature/CC16BOOT-8469-update-app-prebuild-to-not-touch-boot-files to develop * commit '999a2b3fa45317429de587b2004cd8b71951909d': Remove python chache files Move flash protection example changes over to demo repo Move changes over to demo project from boot project
2 parents 75a28c7 + 999a2b3 commit 4da11a2

File tree

68 files changed

+1733
-936
lines changed

Some content is hidden

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

68 files changed

+1733
-936
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ REM ====================================
5757
Set reset=
5858
Set cyan=
5959
Set red=
60-
Set private_key_path="..\..\..\boot.X\mdfu\keystore\private_key.pem"
60+
Set private_key_path="..\..\boot.X\mdfu\keystore\private_key.pem"
6161

6262
REM Jump to start of the script logic
6363
goto scriptStart
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export isDebug="$5"
5555
export reset=""
5656
export cyan=""
5757
export red=""
58-
export private_key_path="../../../boot.X/mdfu/keystore/private_key.pem"
58+
export private_key_path="../../boot.X/mdfu/keystore/private_key.pem"
5959

6060
# ====================================
6161
# Functions
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
@echo off
2+
3+
REM ====================================
4+
REM Local Variables
5+
REM ====================================
6+
Set reset=
7+
Set red=
8+
9+
REM Jump to start of the script logic
10+
goto scriptStart
11+
12+
REM ====================================
13+
REM Functions
14+
REM ====================================
15+
16+
REM ------------------------------------
17+
REM Function: MissingPython
18+
REM
19+
REM Description: Prints out a message with RED background that python is not installed and exits the script.
20+
REM ------------------------------------
21+
:MissingPython
22+
echo %red% Python was not found! Install Python3, add it to the system path, and close/reopen MPLAB X. %reset%
23+
exit /b -1
24+
25+
REM ------------------------------------
26+
REM Function: MissingOpenSSL
27+
REM
28+
REM Description: Prints out a message with RED background that OpenSSL is not installed and exits the script.
29+
REM ------------------------------------
30+
:MissingOpenSSL
31+
echo %red% OpenSSL was not found! Install OpenSSL, add it to the system path, and close/reopen MPLAB X. %reset%
32+
echo %red% For OpenSSL installs please check https://wiki.openssl.org/index.php/Binaries %reset%
33+
exit /b -1
34+
35+
REM ------------------------------------
36+
REM Function: Error
37+
REM
38+
REM Description: Prints out a message with RED background that an error has occurred while generating the keystore files and exits the script.
39+
REM ------------------------------------
40+
:Error
41+
echo %red% An error has occurred. The keystore and key creation did not complete. %reset%
42+
exit /b -1
43+
44+
REM ====================================
45+
REM Script Main
46+
REM ====================================
47+
:scriptStart
48+
49+
REM Check that the required tools are installed
50+
python -V || goto MissingPython
51+
openssl version || goto MissingOpenSSL
52+
53+
REM If all required tools are present, create the required key/keystore files
54+
55+
REM Creates the keystore and demo key pair if not already present
56+
python ..\..\boot.X\mdfu\create_demo_key_files.py || goto Error
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# ====================================
2+
# Local Variables
3+
# ====================================
4+
export reset=""
5+
export red=""
6+
7+
# ====================================
8+
# Functions
9+
# ====================================
10+
11+
# ------------------------------------
12+
# Function: MissingPython
13+
#
14+
# Description: Prints out a message with RED background that python is not installed and exits the script.
15+
# ------------------------------------
16+
MissingPython()
17+
{
18+
echo $red Python was not found! Install Python3, add it to the system path, and close/reopen MPLAB X. $reset
19+
exit 1
20+
}
21+
22+
# ------------------------------------
23+
# Function: MissingOpenSSL
24+
#
25+
# Description: Prints out a message with RED background that OpenSSL is not installed and exits the script.
26+
# ------------------------------------
27+
MissingOpenSSL()
28+
{
29+
echo $red OpenSSL was not found! Install OpenSSL, add it to the system path, and close/reopen MPLAB X. $reset
30+
echo $red For OpenSSL installs please check https://wiki.openssl.org/index.php/Binaries $reset
31+
exit 1
32+
}
33+
34+
# ------------------------------------
35+
# Function: Error
36+
#
37+
# Description: Prints out a message with RED background that an error has occurred while generating the keystore files and exits the script.
38+
# ------------------------------------
39+
Error()
40+
{
41+
echo ${red} An error has occurred. The keystore and key creation did not complete. $reset
42+
exit 1
43+
}
44+
45+
# ====================================
46+
# Script Main
47+
# ====================================
48+
# Check that the required tools are installed
49+
python3 -V || MissingPython
50+
openssl version || MissingOpenSSL
51+
52+
# If all required tools are present, create the required key/keystore files
53+
54+
# Creates the keystore and demo key pair if not already present
55+
python3 ../../boot.X/mdfu/create_demo_key_files.py || Error

dspic33a_secure_boot_and_secure_firmware_upgrade_demo/app.X/nbproject/configurations.xml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@
5050
displayName="Important Files"
5151
projectFiles="true">
5252
<logicalFolder name="f1" displayName="postbuild" projectFiles="true">
53-
<itemPath>mcc_generated_files/boot/postBuild.bat</itemPath>
54-
<itemPath>mcc_generated_files/boot/signing_tool.py</itemPath>
55-
<itemPath>mcc_generated_files/boot/asndecode.py</itemPath>
56-
<itemPath>mcc_generated_files/boot/bin_tool.py</itemPath>
57-
<itemPath>mcc_generated_files/boot/update_header_value.py</itemPath>
53+
<itemPath>mdfu/asndecode.py</itemPath>
54+
<itemPath>mdfu/bin_tool.py</itemPath>
55+
<itemPath>mdfu/postBuild.bat</itemPath>
56+
<itemPath>mdfu/postBuild.sh</itemPath>
57+
<itemPath>mdfu/signing_tool.py</itemPath>
58+
<itemPath>mdfu/update_header_value.py</itemPath>
59+
</logicalFolder>
60+
<logicalFolder name="f2" displayName="prebuild" projectFiles="true">
61+
<itemPath>mdfu/preBuild.bat</itemPath>
62+
<itemPath>mdfu/preBuild.sh</itemPath>
5863
</logicalFolder>
5964
<itemPath>Makefile</itemPath>
6065
<itemPath>app.mc3</itemPath>
@@ -150,9 +155,9 @@
150155
<makeCustomizationType>
151156
<makeCustomizationPreStepEnabled>true</makeCustomizationPreStepEnabled>
152157
<makeUseCleanTarget>false</makeUseCleanTarget>
153-
<makeCustomizationPreStep>cd ..${_/_}boot.X${_/_}mdfu &amp;&amp; .${_/_}preBuild${ShExtension}</makeCustomizationPreStep>
158+
<makeCustomizationPreStep>cd mdfu &amp;&amp; .${_/_}preBuild${ShExtension}</makeCustomizationPreStep>
154159
<makeCustomizationPostStepEnabled>true</makeCustomizationPostStepEnabled>
155-
<makeCustomizationPostStep>cd mcc_generated_files${_/_}boot &amp;&amp; .${_/_}postBuild$(ShExtension) $(MP_CC_DIR) ${ProjectDir} ${ImageDir} ${ImageName} ${IsDebug} &amp;&amp; cd ${ProjectDir} &amp;&amp; cd ${ImageDir}</makeCustomizationPostStep>
160+
<makeCustomizationPostStep>cd mdfu &amp;&amp; .${_/_}postBuild$(ShExtension) $(MP_CC_DIR) ${ProjectDir} ${ImageDir} ${ImageName} ${IsDebug} &amp;&amp; cd ${ProjectDir} &amp;&amp; cd ${ImageDir}</makeCustomizationPostStep>
156161
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
157162
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
158163
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>

dspic33a_secure_boot_and_secure_firmware_upgrade_demo/boot.X/mdfu/create_demo_key_files.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import os
22
import subprocess
33

4-
keystore_directory = "keystore"
4+
script_path = os.path.dirname(os.path.realpath(__file__))
5+
keystore_directory_name = "keystore"
6+
keystore_directory = os.path.join(script_path, keystore_directory_name)
7+
58
keystore_file = "keystore.json"
69
keystore_path = os.path.join(keystore_directory, keystore_file)
710

0 commit comments

Comments
 (0)