3131#include "hal/stm32h5.h"
3232#include "uart_drv.h"
3333#include "wolfboot/wolfboot.h"
34+ #ifndef WOLFBOOT_NO_SIGN
3435#include "keystore.h"
36+ #endif
3537#include "target.h"
3638
3739#ifdef WOLFBOOT_TPM
@@ -76,9 +78,20 @@ static int uart_poll(void);
7678#define LED_BOOT_PIN (4) /* PG4 - Nucleo - Red Led */
7779#define LED_USR_PIN (0) /* PB0 - Nucleo - Green Led */
7880#define LED_EXTRA_PIN (4) /* PF4 - Nucleo - Orange Led */
81+ #define BOOT_TIME_PIN (13) /* PA13 - scope trigger */
82+
83+ #ifdef WOLFBOOT_TEST_FILLER
84+ #define FILLER_SIZE (64 * 1024)
85+ static volatile uint8_t filler_data [FILLER_SIZE ] = { 0x01 , 0x02 , 0x03 };
86+ #endif
7987
8088#define NVIC_USART3_IRQN (60)
8189
90+ #ifndef GPIOA_MODER
91+ #define GPIOA_MODER (*(volatile uint32_t *)(GPIOA_BASE + 0x00))
92+ #define GPIOA_PUPDR (*(volatile uint32_t *)(GPIOA_BASE + 0x0C))
93+ #define GPIOA_BSRR (*(volatile uint32_t *)(GPIOA_BASE + 0x18))
94+ #endif
8295
8396/* SysTick */
8497static uint32_t cpu_freq = 250000000 ;
@@ -119,6 +132,21 @@ static void boot_led_on(void)
119132 GPIOG_BSRR |= (1 << (pin ));
120133}
121134
135+ void boot_time_pin_on_early (void )
136+ {
137+ uint32_t reg ;
138+ uint32_t pin = BOOT_TIME_PIN ;
139+
140+ RCC_AHB2ENR_CLOCK_ER |= GPIOA_AHB2ENR1_CLOCK_ER ;
141+ /* Delay after an RCC peripheral clock enabling */
142+ reg = RCC_AHB2ENR_CLOCK_ER ;
143+
144+ reg = GPIOA_MODER & ~(0x03 << (pin * 2 ));
145+ GPIOA_MODER = reg | (1 << (pin * 2 ));
146+ GPIOA_PUPDR &= ~(0x03 << (pin * 2 ));
147+ GPIOA_BSRR |= (1 << (pin ));
148+ }
149+
122150static void boot_led_off (void )
123151{
124152 GPIOG_BSRR |= (1 << (LED_BOOT_PIN + 16 ));
@@ -542,6 +570,7 @@ static int cmd_info(const char *args)
542570 printf ("No image in update partition.\r\n" );
543571 }
544572
573+ #ifndef WOLFBOOT_NO_SIGN
545574 printf ("\r\n" );
546575 printf ("Bootloader OTP keystore information\r\n" );
547576 printf ("====================================\r\n" );
@@ -559,6 +588,10 @@ static int cmd_info(const char *args)
559588 printf (" ====================================\r\n " );
560589 print_hex (keybuf , size , 0 );
561590 }
591+ #else
592+ printf ("\r\n" );
593+ printf ("Signing disabled (SIGN=NONE)\r\n" );
594+ #endif
562595 return 0 ;
563596}
564597
@@ -1295,6 +1328,10 @@ void main(void)
12951328 /* Turn on boot LED */
12961329 boot_led_on ();
12971330
1331+ #ifdef WOLFBOOT_TEST_FILLER
1332+ filler_data [FILLER_SIZE - 1 ] = 0xAA ;
1333+ #endif
1334+
12981335 /* Enable SysTick */
12991336 systick_enable ();
13001337
0 commit comments