-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Startup/shutdown refactoring #4499
base: main
Are you sure you want to change the base?
Conversation
|
13b756d
to
e3542c3
Compare
[no changelog]
[no changelog]
[no changelog]
[no changelog]
[no changelog]
[no changelog]
[no changelog]
[no changelog]
[no changelog]
[no changelog]
e3542c3
to
d4cd1a3
Compare
[no changelog]
|
||
// Adds a new address range into the memory region. | ||
// | ||
// The rabge start and end pointers must be aligned to the 4 bytes. |
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.
typo rabge
@@ -41,6 +42,10 @@ | |||
#include "zkp_context.h" | |||
#endif | |||
|
|||
// symbols defined in the linker script | |||
extern uint8_t _stack_section_start; |
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.
maybe we can move the extens to linker_utils?
// Wait for the user to manually power off the device | ||
secure_shutdown(); | ||
// Wait for the user to read the RSOD and then reboots | ||
// (or enters an infinite loop if RSOD_INFINITE_LOOP is defined) |
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.
the need for this comment indicates that the function name is not ideal
// recommended to call it only during the startup sequence. | ||
void clear_unused_stack(void); | ||
|
||
// |
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.
unfinished comment
void* start; | ||
// block end address (exclusive) | ||
void* end; | ||
} memregion_block_t; |
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.
we have similar memory_area_t used in applet code (thought it is start+size instead of end, but its equivalent). Would it make sense to use same structure there, and perhaps the supporting functions for clearing?
#endif | ||
|
||
#ifdef BOARDLOADER | ||
memregion_fill(®ion, 0xFFFFFFFF); // do we really need this??? |
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.
this was originally value from TRNG. Whether its actually useful is unclear to me
#endif | ||
|
||
#ifdef BOARDLOADER | ||
memregion_fill(®ion, 0xFFFFFFFF); // !@# do we really need this??? |
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.
this was originally value from TRNG
// Fill memory region with a value 32-bit value | ||
void memregion_fill(memregion_t* region, uint32_t value); | ||
|
||
#define MEMREGION_ADD_SECTION(region, section_name) \ |
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.
unused, along with the memregion_add_range section. Intentionally? If so, do we need to keep it?
This PR includes significant refactoring of the startup and shutdown code.