test-app: read the RX partition state through wolfBoot

- app_renesas_rx.c: printPart() takes the partition id and reads the
  state through wolfBoot_get_partition_state(); the trailer line
  prints BOOT or none.
- main() calls hal_init() before printing.
pull/951/head
Yosuke Shimizu 2026-10-16 14:50:14 +09:00 committed by Daniele Lacamera
parent 6432acc612
commit 64a44dee86
1 changed files with 9 additions and 11 deletions

View File

@ -65,11 +65,12 @@ static const char* state2str(uint8_t s)
}
}
static void printPart(uint8_t *part)
static void printPart(uint8_t part_id, uint8_t *part)
{
uint8_t *magic;
uint32_t ver;
uint8_t state;
int has_trailer;
#ifdef WOLFBOOT_DEBUG_PARTION
uint32_t *v;
int i;
@ -79,10 +80,11 @@ static void printPart(uint8_t *part)
printf("Magic: %c%c%c%c\n", magic[0], magic[1], magic[2], magic[3]);
ver = wolfBoot_get_blob_version(part);
printf("Version: %02x\n", (uint8_t)ver);
state = *(part + WOLFBOOT_PARTITION_SIZE - sizeof(uint32_t) - 1);
has_trailer = (wolfBoot_get_partition_state(part_id, &state) == 0);
if (!has_trailer)
state = IMG_STATE_NEW;
printf("Status: %02x (%s)\n", state, state2str(state));
magic = part + WOLFBOOT_PARTITION_SIZE - sizeof(uint32_t);
printf("Trailer Mgc: %c%c%c%c\n", magic[0], magic[1], magic[2], magic[3]);
printf("Trailer Mgc: %s\n", has_trailer ? "BOOT" : "none");
#ifdef WOLFBOOT_DEBUG_PARTION
v = (uint32_t*)part;
@ -97,18 +99,16 @@ static void printPart(uint8_t *part)
static void printPartitions(void)
{
printf("\n=== Boot Partition[%08x] ===\n", WOLFBOOT_PARTITION_BOOT_ADDRESS);
printPart((uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS);
printPart(PART_BOOT, (uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS);
printf("\n=== Update Partition[%08x] ===\n", WOLFBOOT_PARTITION_UPDATE_ADDRESS);
printPart((uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS);
printPart(PART_UPDATE, (uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS);
}
int main(void)
{
uint8_t firmware_version = 0;
#ifdef DEBUG_UART
uart_init();
#endif
hal_init();
#if !defined(WOLFBOOT_RENESAS_TSIP)
printf("| ------------------------------------------------------------------- |\n");
@ -124,8 +124,6 @@ int main(void)
printf("| ------------------------------------------------------------------------------- |\n\n");
#endif
hal_init();
printPartitions();
/* The same as: wolfBoot_get_image_version(PART_BOOT); */