mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-24 17:28:32 +03:00
DFU: initialize g_dfu during real power up
At power-up we need to initialize g_dfu once, to ensure a consistent state. Afterwards we want to keep it across (software) reset, but on power-up the memory would otherwise be filled with random data, causing issues with detection of DFU/Runtime switching.
This commit is contained in:
@@ -176,6 +176,7 @@ extern int main(void)
|
|||||||
{
|
{
|
||||||
uint8_t isUsbConnected = 0;
|
uint8_t isUsbConnected = 0;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
uint32_t reset_cause = (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos;
|
||||||
|
|
||||||
led_init();
|
led_init();
|
||||||
led_blink(LED_GREEN, BLINK_3O_30F);
|
led_blink(LED_GREEN, BLINK_3O_30F);
|
||||||
@@ -201,7 +202,11 @@ extern int main(void)
|
|||||||
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",
|
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",
|
||||||
g_unique_id[0], g_unique_id[1],
|
g_unique_id[0], g_unique_id[1],
|
||||||
g_unique_id[2], g_unique_id[3]);
|
g_unique_id[2], g_unique_id[3]);
|
||||||
TRACE_INFO("Reset Cause: 0x%x\n\r", (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos);
|
TRACE_INFO("Reset Cause: 0x%x\n\r", reset_cause);
|
||||||
|
|
||||||
|
/* clear g_dfu on power-up reset */
|
||||||
|
if (reset_cause == 0)
|
||||||
|
memset(g_dfu, 0, sizeof(*g_dfu));
|
||||||
|
|
||||||
board_main_top();
|
board_main_top();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user