Skip to content

Commit 7379cbd

Browse files
committed
Move flash protection example changes over to demo repo
1 parent 8748edd commit 7379cbd

File tree

63 files changed

+1604
-926
lines changed

Some content is hidden

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

63 files changed

+1604
-926
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
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
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/flash_protection_examples/flash_region_erase/bootEraseFlashProtection.X/nbproject/configurations.xml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@
5353
<logicalFolder name="ExternalFiles"
5454
displayName="Important Files"
5555
projectFiles="true">
56+
<logicalFolder name="f1" displayName="postbuild" projectFiles="true">
57+
<itemPath>mdfu/asndecode.py</itemPath>
58+
<itemPath>mdfu/bin_tool.py</itemPath>
59+
<itemPath>mdfu/postBuild.bat</itemPath>
60+
<itemPath>mdfu/postBuild.sh</itemPath>
61+
<itemPath>mdfu/signing_tool.py</itemPath>
62+
<itemPath>mdfu/update_header_value.py</itemPath>
63+
</logicalFolder>
64+
<logicalFolder name="f2" displayName="prebuild" projectFiles="true">
65+
<itemPath>mdfu/preBuild.bat</itemPath>
66+
<itemPath>mdfu/preBuild.sh</itemPath>
67+
</logicalFolder>
5668
<itemPath>Makefile</itemPath>
5769
<itemPath>bootEraseFlashProtection.mc3</itemPath>
5870
</logicalFolder>
@@ -78,16 +90,6 @@
7890
<itemPath>bsp/s3.c</itemPath>
7991
</logicalFolder>
8092
<logicalFolder name="f3" displayName="MCC Generated Files" projectFiles="true">
81-
<logicalFolder name="f1" displayName="boot" projectFiles="true">
82-
<logicalFolder name="f1" displayName="src" projectFiles="true">
83-
<itemPath>mcc_generated_files/boot/asndecode.py</itemPath>
84-
<itemPath>mcc_generated_files/boot/bin_tool.py</itemPath>
85-
<itemPath>mcc_generated_files/boot/postBuild.bat</itemPath>
86-
<itemPath>mcc_generated_files/boot/postBuild.sh</itemPath>
87-
<itemPath>mcc_generated_files/boot/signing_tool.py</itemPath>
88-
<itemPath>mcc_generated_files/boot/update_header_value.py</itemPath>
89-
</logicalFolder>
90-
</logicalFolder>
9193
<logicalFolder name="f2" displayName="flash" projectFiles="true">
9294
<logicalFolder name="f1" displayName="src" projectFiles="true">
9395
<itemPath>mcc_generated_files/flash/src/flash.c</itemPath>
@@ -160,9 +162,9 @@
160162
<makeCustomizationType>
161163
<makeCustomizationPreStepEnabled>true</makeCustomizationPreStepEnabled>
162164
<makeUseCleanTarget>false</makeUseCleanTarget>
163-
<makeCustomizationPreStep>cd ..${_/_}..${_/_}..${_/_}boot.X${_/_}mdfu &amp;&amp; .${_/_}preBuild${ShExtension}</makeCustomizationPreStep>
165+
<makeCustomizationPreStep>cd mdfu &amp;&amp; .${_/_}preBuild${ShExtension}</makeCustomizationPreStep>
164166
<makeCustomizationPostStepEnabled>true</makeCustomizationPostStepEnabled>
165-
<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>
167+
<makeCustomizationPostStep>cd mdfu &amp;&amp; .${_/_}postBuild$(ShExtension) $(MP_CC_DIR) ${ProjectDir} ${ImageDir} ${ImageName} ${IsDebug} &amp;&amp; cd ${ProjectDir} &amp;&amp; cd ${ImageDir}</makeCustomizationPostStep>
166168
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
167169
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
168170
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>

0 commit comments

Comments
 (0)