Skip to content

Commit a22a9b1

Browse files
committed
tc3xx: fix wolfBoot-tc3xx project and wbaurixtool.sh to properly generate macros for non-HSM projects
1 parent 57d224b commit a22a9b1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

IDE/AURIX/wolfBoot-tc3xx/.cproject

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@
491491
<listOptionValue builtIn="false" value="PART_BOOT_EXT"/>
492492
<listOptionValue builtIn="false" value="WOLFBOOT_FLASH_MULTI_SECTOR_ERASE"/>
493493
</option>
494-
<option id="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other.1524582129" name="Other flags" superClass="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -mtc162" valueType="string"/>
494+
<option id="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other.1524582129" name="Other flags" superClass="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-mtc162 -c -fmessage-length=0 &quot;@${workspace_loc:/${ProjName}/wolfBoot_macros.txt}&quot;" valueType="string"/>
495495
<inputType id="com.infineon.aurix.buildsystem.managed.tool.c.compiler.inputType.1768062788" superClass="com.infineon.aurix.buildsystem.managed.tool.c.compiler.inputType"/>
496496
</tool>
497497
<tool id="com.infineon.aurix.buildsystem.managed.tool.cpp.compiler.937301277" name="AURIX G++ Compiler" superClass="com.infineon.aurix.buildsystem.managed.tool.cpp.compiler">
@@ -705,7 +705,7 @@
705705
<listOptionValue builtIn="false" value="PART_SWAP_EXT"/>
706706
<listOptionValue builtIn="false" value="WOLFBOOT_FLASH_MULTI_SECTOR_ERASE"/>
707707
</option>
708-
<option id="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other.1290904533" name="Other flags" superClass="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -mtc162" valueType="string"/>
708+
<option id="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other.1290904533" name="Other flags" superClass="com.infineon.aurix.buildsystem.managed.tool.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-mtc162 -c -fmessage-length=0 &quot;@${workspace_loc:/${ProjName}/wolfBoot_macros.txt}&quot;" valueType="string"/>
709709
<inputType id="com.infineon.aurix.buildsystem.managed.tool.c.compiler.inputType.526570406" superClass="com.infineon.aurix.buildsystem.managed.tool.c.compiler.inputType"/>
710710
</tool>
711711
<tool id="com.infineon.aurix.buildsystem.managed.tool.cpp.compiler.1059779057" name="AURIX G++ Compiler" superClass="com.infineon.aurix.buildsystem.managed.tool.cpp.compiler">

tools/scripts/tc3xx/wbaurixtool.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ WOLFBOOT_DIR="../../../"
2626
PRVKEY_DER="$WOLFBOOT_DIR/priv.der"
2727
PUBKEY_DER="$WOLFBOOT_DIR/priv_pub.der"
2828
TARGET_H="$WOLFBOOT_DIR/include/target.h"
29-
MACROS_IN="$WOLFBOOT_DIR/IDE/AURIX/wolfBoot-tc3xx-wolfHSM/wolfBoot_macros.in"
30-
MACROS_OUT="$WOLFBOOT_DIR/IDE/AURIX/wolfBoot-tc3xx-wolfHSM/wolfBoot_macros.txt"
3129
NVM_CONFIG="$WOLFBOOT_DIR/tools/scripts/tc3xx/wolfBoot-wolfHSM-keys.nvminit"
3230
NVM_BIN="whNvmImage.bin"
3331
NVM_HEX="whNvmImage.hex"
@@ -238,16 +236,22 @@ do_gen_target() {
238236
# Function to clean generated files
239237
do_clean() {
240238
echo "Cleaning generated files"
239+
local macros_out="$WOLFBOOT_DIR/IDE/AURIX/wolfBoot-tc3xx${HSM:+-wolfHSM}/wolfBoot_macros.txt"
240+
241241
rm -f "$PRVKEY_DER"
242242
rm -f "$PUBKEY_DER"
243243
rm -f "$TARGET_H"
244-
rm -f "$MACROS_OUT"
244+
rm -f "$macros_out"
245245
rm -f "$NVM_BIN"
246246
rm -f "$NVM_HEX"
247247
}
248248

249249
# Function to generate macros
250250
do_gen_macros() {
251+
# Set the macros paths dynamically based on HSM flag
252+
local macros_in="$WOLFBOOT_DIR/IDE/AURIX/wolfBoot-tc3xx${HSM:+-wolfHSM}/wolfBoot_macros.in"
253+
local macros_out="$WOLFBOOT_DIR/IDE/AURIX/wolfBoot-tc3xx${HSM:+-wolfHSM}/wolfBoot_macros.txt"
254+
251255
# Use macros options first, then fall back to sign/keygen options
252256
local sign_algo="${MACROS_OPTS[sign_algo]:-${SIGN_OPTS[sign_algo]:-${KEYGEN_OPTS[sign_algo]:-$DEFAULT_SIGN_ALGO}}}"
253257
local hash_algo="${MACROS_OPTS[hash_algo]:-${SIGN_OPTS[hash_algo]}}"
@@ -314,10 +318,10 @@ do_gen_macros() {
314318
-e "s/@ML_DSA_IMAGE_SIGNATURE_SIZE@/$ml_dsa_image_signature_size/g" \
315319
-e "s/@WOLFBOOT_HUGE_STACK@/$use_huge_stack/g" \
316320
-e "s/@WOLFBOOT_USE_WOLFHSM_PUBKEY_ID@/$use_wolfhsm_pubkey_id/g" \
317-
"$MACROS_IN" > "$MACROS_OUT"
321+
"$macros_in" > "$macros_out"
318322

319323
# Remove empty lines from the output file, as they cause compiler errors
320-
sed -i '/^$/d' "$MACROS_OUT"
324+
sed -i '/^$/d' "$macros_out"
321325
}
322326

323327
# Function to generate a wolfHSM NVM image

0 commit comments

Comments
 (0)