Skip to content

Commit ceffc78

Browse files
bigbrettdanielinux
authored andcommitted
- support for wolfHSM ML-DSA on simulator and AURIX (DMA only)
- consolidate AURIX scripts into wbaurixtool.sh - documentation updates
1 parent 21a4082 commit ceffc78

28 files changed

+3398
-111
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ IDE/AURIX/Configurations/*
211211
!IDE/AURIX/Configurations/placeholder.txt
212212
IDE/AURIX/wolfHSM-infineon-tc3xx/*
213213
!IDE/AURIX/wolfHSM-infineon-tc3xx/placeholder.txt
214+
IDE/AURIX/wolfBoot-tc3xx/wolfBoot_macros.txt
215+
IDE/AURIX/wolfBoot-tc3xx-wolfHSM/wolfBoot_macros.txt
216+
IDE/AURIX/test-app/Lcf_Gnuc_Tricore_Tc.lsl
217+
IDE/AURIX/test-app-wolfHSM/Lcf_Gnuc_Tricore_Tc.lsl
214218

215219
tpm_seal_key.key
216220

IDE/AURIX/README.md

Lines changed: 104 additions & 14 deletions
Large diffs are not rendered by default.

IDE/AURIX/test-app-wolfHSM/.cproject

Lines changed: 611 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>test-app-wolfHSM</name>
4+
<comment></comment>
5+
<projects>
6+
<project>wolfBoot-tc3xx-wolfHSM</project>
7+
</projects>
8+
<buildSpec>
9+
<buildCommand>
10+
<name>com.infineon.aurix.buildsystem.builders.booster</name>
11+
<triggers>full,incremental,</triggers>
12+
<arguments>
13+
</arguments>
14+
</buildCommand>
15+
<buildCommand>
16+
<name>com.infineon.aurix.buildsystem.builders.autodiscovery</name>
17+
<triggers>full,incremental,</triggers>
18+
<arguments>
19+
</arguments>
20+
</buildCommand>
21+
<buildCommand>
22+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
23+
<triggers>clean,full,incremental,</triggers>
24+
<arguments>
25+
</arguments>
26+
</buildCommand>
27+
<buildCommand>
28+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
29+
<triggers>full,incremental,</triggers>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
33+
</buildSpec>
34+
<natures>
35+
<nature>org.eclipse.cdt.core.cnature</nature>
36+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
37+
<nature>com.infineon.aurix.buildsystem.aurixnature</nature>
38+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
39+
</natures>
40+
<linkedResources>
41+
<link>
42+
<name>Configurations</name>
43+
<type>2</type>
44+
<locationURI>SDK_CONFIGURATION_DIR</locationURI>
45+
</link>
46+
<link>
47+
<name>Libraries</name>
48+
<type>2</type>
49+
<locationURI>SDK_DIR</locationURI>
50+
</link>
51+
</linkedResources>
52+
<variableList>
53+
<variable>
54+
<name>SDK_CONFIGURATION_DIR</name>
55+
<value>$%7BPARENT-1-PROJECT_LOC%7D/Configurations</value>
56+
</variable>
57+
<variable>
58+
<name>SDK_DIR</name>
59+
<value>$%7BPARENT-1-PROJECT_LOC%7D/SDK</value>
60+
</variable>
61+
</variableList>
62+
</projectDescription>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* Cpu0_Main.c
2+
*
3+
* Copyright (C) 2014-2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfBoot.
6+
*
7+
* wolfBoot 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 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfBoot 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 wolfBoot. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
#include "Bsp.h"
21+
#include "IfxCpu.h"
22+
#include "IfxPort.h"
23+
#include "IfxScuWdt.h"
24+
#include "Ifx_Types.h"
25+
#include "wolfboot/wolfboot.h"
26+
27+
IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0;
28+
29+
30+
#define LED &MODULE_P00, 5 /* LED: Port, Pin definition */
31+
#define BLINK_TIME_BASE 500 /* Wait time constant in milliseconds */
32+
#define BLINK_TIME_UPDATE 100 /* Wait time constant in milliseconds */
33+
34+
#define BASE_FW_VERSION 1
35+
36+
/* This function initializes the port pin which drives the LED */
37+
static void initLED(void)
38+
{
39+
/* Initialization of the LED used in this example */
40+
IfxPort_setPinModeOutput(LED,
41+
IfxPort_OutputMode_pushPull,
42+
IfxPort_OutputIdx_general);
43+
44+
/* Switch OFF the LED (low-level active) */
45+
IfxPort_setPinLow(LED);
46+
}
47+
48+
void core0_main(void)
49+
{
50+
size_t blinkTime;
51+
52+
IfxCpu_enableInterrupts();
53+
54+
/* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
55+
* Enable the watchdogs and service them periodically if it is required
56+
*/
57+
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
58+
IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword());
59+
60+
/* Wait for CPU sync event */
61+
IfxCpu_emitEvent(&g_cpuSyncEvent);
62+
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
63+
64+
initLED();
65+
66+
if (wolfBoot_current_firmware_version() <= BASE_FW_VERSION) {
67+
/* We are booting into the base firmware, so stage the update and set
68+
* the LED to blink slow */
69+
wolfBoot_update_trigger();
70+
blinkTime = BLINK_TIME_BASE;
71+
}
72+
else {
73+
/* we are booting into the updated firmware so acknowledge the update
74+
* (to prevent rollback) and set the LED to blink fast */
75+
wolfBoot_success();
76+
blinkTime = BLINK_TIME_UPDATE;
77+
}
78+
79+
while (1) {
80+
IfxPort_togglePin(LED);
81+
waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, blinkTime));
82+
}
83+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* Cpu1_Main.c
2+
*
3+
* Copyright (C) 2014-2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfBoot.
6+
*
7+
* wolfBoot 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 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfBoot 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 wolfBoot. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
#include "Ifx_Types.h"
21+
#include "IfxCpu.h"
22+
#include "IfxScuWdt.h"
23+
24+
extern IfxCpu_syncEvent g_cpuSyncEvent;
25+
26+
void core1_main(void)
27+
{
28+
IfxCpu_enableInterrupts();
29+
30+
/* !!WATCHDOG1 IS DISABLED HERE!!
31+
* Enable the watchdog and service it periodically if it is required
32+
*/
33+
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
34+
35+
/* Wait for CPU sync event */
36+
IfxCpu_emitEvent(&g_cpuSyncEvent);
37+
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
38+
39+
while(1)
40+
{
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* Cpu2_Main.c
2+
*
3+
* Copyright (C) 2014-2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfBoot.
6+
*
7+
* wolfBoot 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 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfBoot 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 wolfBoot. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
#include "Ifx_Types.h"
21+
#include "IfxCpu.h"
22+
#include "IfxScuWdt.h"
23+
24+
extern IfxCpu_syncEvent g_cpuSyncEvent;
25+
26+
void core2_main(void)
27+
{
28+
IfxCpu_enableInterrupts();
29+
30+
/* !!WATCHDOG2 IS DISABLED HERE!!
31+
* Enable the watchdog and service it periodically if it is required
32+
*/
33+
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
34+
35+
/* Wait for CPU sync event */
36+
IfxCpu_emitEvent(&g_cpuSyncEvent);
37+
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
38+
39+
while(1)
40+
{
41+
}
42+
}

IDE/AURIX/test-app/Lcf_Gnuc_Tricore_Tc.lsl renamed to IDE/AURIX/test-app-wolfHSM/Lcf_Gnuc_Tricore_Tc.lsl.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ LCF_HEAP2_OFFSET = (LCF_USTACK2_OFFSET - LCF_HEAP_SIZE);
6464

6565

6666
LCF_WOLFBOOT_BOOT_PART_BASEADDR = 0xA0300000;
67-
LCF_WOLFBOOT_HEADER_OFFSET = 0x100;
67+
68+
/* size of wolfBoot header, configured by aurixtool.sh based on --sign-algo */
69+
LCF_WOLFBOOT_HEADER_OFFSET = @LCF_WOLFBOOT_HEADER_OFFSET@;
6870

6971
LCF_CODE_BASE_ADDR = LCF_WOLFBOOT_BOOT_PART_BASEADDR + LCF_WOLFBOOT_HEADER_OFFSET;
7072

@@ -116,10 +118,10 @@ MEMORY
116118
pfls0 (rx!p): org = 0xA0000000, len = 3M
117119

118120
/* placeholder for wolfBoot image header */
119-
pfls1_hdr (rx!p): org = 0xA0300000, len = 256
121+
pfls1_hdr (rx!p): org = LCF_WOLFBOOT_BOOT_PART_BASEADDR, len = LCF_WOLFBOOT_HEADER_OFFSET
120122

121123
/* pfls1 is the remainder of the wolfBoot BOOT partition. Everything goes here */
122-
pfls1 (rx!p): org = 0xA0300100, len = 0x17DF00 /* 0x17E000 - 256B */
124+
pfls1 (rx!p): org = LCF_CODE_BASE_ADDR, len = (0x17E000 - LCF_WOLFBOOT_HEADER_OFFSET)
123125

124126
/* reserved for wolfBoot UPDATE partition */
125127
pfls1_update (rwx!p): org = 0xA047E000, len = 0x17E000 /* ~1.5MiB */

0 commit comments

Comments
 (0)