@@ -32,6 +32,60 @@ static volatile const uint32_t __attribute__((used)) wolfboot_version = WOLFBOOT
3232extern void (* * const IV_RAM )(void );
3333#endif
3434
35+ #if defined(WOLFBOOT_PARTION_INFO ) && defined(PRINTF_ENABLED )
36+
37+ #include <printf.h>
38+
39+ static void printPart (uint8_t * part )
40+ {
41+ #ifdef WOLFBOOT_PARTION_VERBOS
42+ uint32_t * v ;
43+ int i ;
44+ #endif
45+ uint8_t * magic ;
46+ uint8_t state ;
47+ uint32_t ver ;
48+
49+ magic = part ;
50+ wolfBoot_printf ("Magic: %c%c%c%c\n" , magic [0 ], magic [1 ], magic [2 ], magic [3 ]);
51+ ver = wolfBoot_get_blob_version (part );
52+ wolfBoot_printf ("Version: %02x\n" , ver );
53+ state = * (part + WOLFBOOT_PARTITION_SIZE - sizeof (uint32_t ) - 1 );
54+ wolfBoot_printf ("Status: %02x\n" , state );
55+ magic = part + WOLFBOOT_PARTITION_SIZE - sizeof (uint32_t );
56+ wolfBoot_printf ("Tail Mgc: %c%c%c%c\n" , magic [0 ], magic [1 ], magic [2 ], magic [3 ]);
57+
58+ #ifdef WOLFBOOT_PARTIION_VERBOS
59+ v = (uint32_t * )part ;
60+ for (i = 0 ; i < 0x100 /4 ; i ++ ) {
61+ if (i % 4 == 0 )
62+ wolfBoot_printf ("\n%08x: " , (uint32_t )v + i * 4 );
63+ wolfBoot_printf ("%08x " , v [i ]);
64+ }
65+
66+ wolfBoot_printf ("\n\nImage:" );
67+
68+ for ( ; i < 0x100 /4 + 16 ; i ++ ) {
69+ if (i % 4 == 0 )
70+ wolfBoot_printf ("\n%08x: " , (uint32_t )v + i * 4 );
71+ wolfBoot_printf ("%08x " , v [i ]);
72+ }
73+
74+ wolfBoot_printf ("\n\n" );
75+ #endif
76+
77+ }
78+
79+
80+ static void printPartitions (void )
81+ {
82+ wolfBoot_printf ("\n=== Boot Partition[%08x] ===\n" , WOLFBOOT_PARTITION_BOOT_ADDRESS );
83+ printPart ((uint8_t * )WOLFBOOT_PARTITION_BOOT_ADDRESS );
84+ wolfBoot_printf ("\n=== Update Partition[%08x] ===\n" , WOLFBOOT_PARTITION_UPDATE_ADDRESS );
85+ printPart ((uint8_t * )WOLFBOOT_PARTITION_UPDATE_ADDRESS );
86+ }
87+ #endif
88+
3589#ifdef PLATFORM_sim
3690extern char * * main_argv ;
3791extern int main_argc ;
@@ -60,6 +114,9 @@ int main(void)
60114 wolfBoot_tpm2_init ();
61115#endif
62116
117+ #if defined(WOLFBOOT_PARTION_INFO ) && defined(PRINTF_ENABLED )
118+ printPartitions ();
119+ #endif
63120 wolfBoot_start ();
64121
65122 /* wolfBoot_start should never return. */
0 commit comments