-
Notifications
You must be signed in to change notification settings - Fork 147
[Renesas RX72N CCRX] Move flash functions to RAM for flash operation #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,8 @@ | |
| #include <string.h> | ||
| #include "hal.h" | ||
| #include "wolfboot/wolfboot.h" | ||
|
|
||
| #include "image.h" | ||
| #include "r_smc_entry.h" | ||
| static const char* state2str(uint8_t s) | ||
| { | ||
| switch(s) { | ||
|
|
@@ -39,6 +40,17 @@ static const char* state2str(uint8_t s) | |
| } | ||
| } | ||
|
|
||
| static const char* upFlag2str(uint8_t s) | ||
| { | ||
| switch(s) { | ||
| case SECT_FLAG_NEW: return "New"; | ||
| case SECT_FLAG_SWAPPING: return "Swapping"; | ||
| case SECT_FLAG_BACKUP: return "Backup"; | ||
| case SECT_FLAG_UPDATED: return "Updated"; | ||
| default: return "Unknown"; | ||
| } | ||
| } | ||
|
|
||
| static void printPart(uint8_t *part) | ||
| { | ||
| #ifdef WOLFBOOT_DEBUG_PARTION | ||
|
|
@@ -47,16 +59,21 @@ static void printPart(uint8_t *part) | |
| #endif | ||
| uint8_t *magic; | ||
| uint8_t state; | ||
| uint8_t upflag; | ||
| uint32_t ver; | ||
|
|
||
| magic = 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", ver); | ||
| state = *(part + WOLFBOOT_PARTITION_SIZE - sizeof(uint32_t) - 1); | ||
| wolfBoot_get_partition_state(0, &state); | ||
| printf("Status: %02x (%s)\n", state,state2str(state)); | ||
| magic = part + WOLFBOOT_PARTITION_SIZE - sizeof(uint32_t); | ||
| if (magic[0] != 0x42) | ||
| magic = part + WOLFBOOT_PARTITION_SIZE - WOLFBOOT_SECTOR_SIZE - sizeof(uint32_t); | ||
| printf("Trailer Mgc: %c%c%c%c\n", magic[0], magic[1], magic[2], magic[3]); | ||
| wolfBoot_get_update_sector_flag(0, &upflag); | ||
| printf("Update flag: %02x (%s)\n", upflag, upFlag2str(upflag)); | ||
|
|
||
| #ifdef WOLFBOOT_DEBUG_PARTION | ||
| v = (uint32_t *)part; | ||
|
|
@@ -68,14 +85,25 @@ static void printPart(uint8_t *part) | |
| #endif | ||
|
|
||
| } | ||
|
|
||
| #ifdef WOLFBOOT_DEBUG_PARTION | ||
| static void verify_flash_write(uint32_t addr, int len) | ||
| { | ||
| uint8_t *p = (uint8_t *)addr; | ||
| int i; | ||
| printf("verify addr=0x%08x: ", addr); | ||
| for (i = 0; i < len && i < 8; i++) { | ||
| printf("%02x ", p[i]); | ||
| } | ||
| printf("\n"); | ||
| } | ||
| #endif | ||
|
Comment on lines
+88
to
+99
|
||
|
|
||
| static void printPartitions(void) | ||
| { | ||
| printf("\n=== Boot Partition[%08x] ===\n", WOLFBOOT_PARTITION_BOOT_ADDRESS); | ||
| printPart((uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS); | ||
| printf("\n=== Update Partition[%08x] ===\n", WOLFBOOT_PARTITION_UPDATE_ADDRESS); | ||
| printPart((uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS); | ||
| printPart((uint8_t*)(uintptr_t)WOLFBOOT_PARTITION_UPDATE_ADDRESS); | ||
| } | ||
|
|
||
| void main(void) | ||
|
|
||
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming: this should be possibly renamed to "DEBUG_PARTITION". Since it's internal to the test application it does not need to be WOLFBOOT_ as it may be confused with a defined option.
It's also unclear how the option is enabled. It might be clearer if we used
#if DEBUG_PARTITIONinstead of ifdef, and explicitly defined as '0' at the beginnig of the app, perhaps with a commentdefine as 1 to enable full header hexdumpor something similar