-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add flash metadata #308
base: main
Are you sure you want to change the base?
Add flash metadata #308
Conversation
Pull reviewers statsStats of the last 120 days for UWOrbital:
|
#define MAX_FNAME_LINENUM_SIZE 128U | ||
#define MAX_FNAME_LINENUM_SIZE 150U |
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.
not sure where this is from
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.
I think this was from one of Natvaj's logging prs
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.
was the logging pr merged? if so, try pulling from main
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.
shouldve been merged
…mware into kashifb/flash-metadata
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.
Some else needs to review this as well.
#define MAX_FNAME_LINENUM_SIZE 128U | ||
#define MAX_FNAME_LINENUM_SIZE 150U |
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.
I think this was from one of Natvaj's logging prs
int32_t blUartWriteBufferLen = | ||
snprintf(blUartWriteBuffer, BL_MAX_MSG_SIZE, "Failed to init flash, error code: %d\r\n", errCode); | ||
if (blUartWriteBufferLen < 0) { | ||
blUartWriteBytes(BL_UART_SCIREG, strlen("Error with processing message buffer length\r\n"), |
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.
bl error logging should be identical to obc err logging (LOG_ERR_CODE(x)), but ill let @ThenujaL handle this in his PR since hes already porting the logging stuff over
obc/bl/bl_main.c
Outdated
|
||
blFlashFapiInitBank(0U); | ||
|
||
errCode = blFlashFapiBlockErase(METADATA_START_ADDRESS, METADATA_SIZE_BYTES - 1); |
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.
why - 1? I dont think we do that anywhere else
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.
metadata is from 13fff8 to 13ffff (8). currently the erase function deletes the entire sector of the address. 13fff8 + 8 = 140000, so without the -1 it would delete the entire sector starting at 140000 (undefined behavior)
#include <stdint.h> | ||
|
||
typedef enum { | ||
BL_UART_SCIREG_1 = 0, | ||
BL_UART_SCIREG_2 = 1, | ||
BL_UART_SCIREG = 0, |
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.
I'm confused why this enum needs to exist anymore since we only have (and will ever have?) 1 value
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.
yea i just added it from the old asynch logging PR. i can remove it
#define MAX_FNAME_LINENUM_SIZE 128U | ||
#define MAX_FNAME_LINENUM_SIZE 150U |
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.
was the logging pr merged? if so, try pulling from main
obc/bl/source/bl_uart.c
Outdated
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.
why change this? this layer supports both uart ports. why change it to only support 1?
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.
i think the synchronous logging PR implemented this change, it was reverted but we found that the BL didn't work properly on the Rev1 without the port changes from that PR. i could use #if directive to check if board type is OBC_REVISION_1 nd then only use the one port from rev1
Purpose
Read below
Link to notion task: https://www.notion.so/uworbital/Modify-flash-layout-to-store-app-metadata-b4c9aab740cc4f65be1b6852e9623190?pvs=4
New Changes
Testing
-With BL, and app sent over UART using the metadata test example:
-Without BL, app used over uniflash using the metadata test example
-Erase test (flashing 2 binaries using BL consecutively), the two bin sizes should be different
Outstanding Changes
-Unneeded currently IMO unless we plan on storing more than checksum + some cmake definitions later on
NOTE: Flashing the BL and then the app binary using uniflash (instead of sending the app binary through serial) will cause the readAppMetadata function to segfault if DENABLE_BL_BYPASS is set to false. This is because the memory addresses will not have anything in them, however since DENABLE_BL_BYPASS will be set to 0, the function will not return no metadata err code and instead try to access the memory