|
1 | 1 | /* app_zynq.c |
2 | 2 | * |
3 | | - * Test bare-metal boot application |
| 3 | + * Test bare-metal boot application for AMD ZynqMP ZCU102 |
4 | 4 | * |
5 | 5 | * Copyright (C) 2025 wolfSSL Inc. |
6 | 6 | * |
|
21 | 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA |
22 | 22 | */ |
23 | 23 |
|
24 | | -#include <stdlib.h> |
25 | 24 | #include <stdint.h> |
26 | | -#include <string.h> |
27 | 25 |
|
28 | 26 | #include "wolfboot/wolfboot.h" |
| 27 | +#include "printf.h" |
29 | 28 |
|
30 | 29 | #ifdef TARGET_zynq |
31 | 30 |
|
32 | | -volatile uint32_t time_elapsed = 0; |
33 | | -void main(void) { |
| 31 | +/* Provide current_el() for hal/zynq.o (normally in boot_aarch64.c) */ |
| 32 | +unsigned int current_el(void) |
| 33 | +{ |
| 34 | + unsigned long el; |
| 35 | + __asm__ volatile("mrs %0, CurrentEL" : "=r" (el) : : "cc"); |
| 36 | + return (unsigned int)((el >> 2) & 0x3U); |
| 37 | +} |
| 38 | + |
| 39 | +/* Stub for QSPI DMA code in hal/zynq.o (not used with SD card boot) */ |
| 40 | +void flush_dcache_range(unsigned long start, unsigned long end) |
| 41 | +{ |
| 42 | + (void)start; |
| 43 | + (void)end; |
| 44 | +} |
| 45 | + |
| 46 | +void main(void) |
| 47 | +{ |
| 48 | +#ifdef WOLFBOOT_FIXED_PARTITIONS |
| 49 | + uint32_t boot_version, update_version; |
| 50 | +#endif |
| 51 | + |
| 52 | + wolfBoot_printf("\n\n"); |
| 53 | + wolfBoot_printf("===========================================\n"); |
| 54 | + wolfBoot_printf(" wolfBoot Test Application - AMD ZynqMP\n"); |
| 55 | + wolfBoot_printf("===========================================\n\n"); |
| 56 | + |
| 57 | + wolfBoot_printf("Current EL: %d\n", current_el()); |
| 58 | + |
| 59 | +#ifdef WOLFBOOT_FIXED_PARTITIONS |
| 60 | + boot_version = wolfBoot_get_image_version(PART_BOOT); |
| 61 | + update_version = wolfBoot_get_image_version(PART_UPDATE); |
| 62 | + wolfBoot_printf("BOOT: Version: %d (0x%08x)\n", boot_version, boot_version); |
| 63 | + wolfBoot_printf("UPDATE: Version: %d (0x%08x)\n", update_version, update_version); |
| 64 | +#else |
| 65 | + wolfBoot_printf("Boot mode: Disk-based (MBR partitions)\n"); |
| 66 | +#endif |
| 67 | + |
| 68 | + wolfBoot_printf("Application running successfully!\n"); |
| 69 | + wolfBoot_printf("\nEntering idle loop...\n"); |
34 | 70 |
|
35 | | - /* Wait for reboot */ |
36 | | - while(1) |
37 | | - ; |
| 71 | + /* Idle loop */ |
| 72 | + while (1) { |
| 73 | + __asm__ volatile("wfi"); |
| 74 | + } |
38 | 75 | } |
39 | 76 | #endif /** TARGET_zynq **/ |
0 commit comments