Fix the base priority when doing a soft-reset

This commit is contained in:
iabdalkader 2016-05-16 14:26:48 +02:00
parent 8f35a14ad8
commit 39f439cda5

View File

@ -174,9 +174,10 @@ static const char fresh_selftest_py[] =
"\n" "\n"
" print('COLOR BARS TEST PASSED...')\n" " print('COLOR BARS TEST PASSED...')\n"
"\n" "\n"
"print('')\n" "if __name__ == '__main__':\n"
"test_int_adc()\n" " print('')\n"
"test_color_bars()\n" " test_int_adc()\n"
" test_color_bars()\n"
; ;
#endif #endif
@ -320,8 +321,7 @@ soft_reset:
// Initialise low-level sub-systems. Here we need to very basic things like // Initialise low-level sub-systems. Here we need to very basic things like
// zeroing out memory and resetting any of the sub-systems. Following this // zeroing out memory and resetting any of the sub-systems. Following this
// we can run Python scripts (eg boot.py), but anything that is configurable // we can run Python scripts (eg main.py).
// by boot.py must be set after boot.py is run.
readline_init0(); readline_init0();
pin_init0(); pin_init0();
@ -422,9 +422,6 @@ soft_reset:
__fatal_error(buf); __fatal_error(buf);
} }
// Re-enable FS IRQ (disabled in usbdbg)
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
// Run self tests the first time only // Run self tests the first time only
f_res = f_stat("selftest.py", NULL); f_res = f_stat("selftest.py", NULL);
if (first_soft_reset && f_res == FR_OK) { if (first_soft_reset && f_res == FR_OK) {
@ -460,14 +457,15 @@ soft_reset:
nlr_pop(); nlr_pop();
}// if this gets interrupted again ignore it. }// if this gets interrupted again ignore it.
} }
// Re-enable FS IRQ (disabled in usbdbg)
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
} }
// If there's no script ready, just re-exec REPL // If there's no script ready, just re-exec REPL
while (!usbdbg_script_ready()) { while (!usbdbg_script_ready()) {
nlr_buf_t nlr; nlr_buf_t nlr;
// Re-enable FS IRQ (disabled in usbdbg)
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
if (nlr_push(&nlr) == 0) { if (nlr_push(&nlr) == 0) {
// enable IDE interrupt // enable IDE interrupt
usbdbg_set_irq_enabled(true); usbdbg_set_irq_enabled(true);
@ -477,13 +475,14 @@ soft_reset:
nlr_pop(); nlr_pop();
} }
// Re-enable FS IRQ (disabled in usbdbg)
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
} }
if (usbdbg_script_ready()) { if (usbdbg_script_ready()) {
nlr_buf_t nlr; nlr_buf_t nlr;
// Re-enable FS IRQ (disabled in usbdbg)
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
// execute the script // execute the script
if (nlr_push(&nlr) == 0) { if (nlr_push(&nlr) == 0) {
// parse, compile and execute script // parse, compile and execute script
@ -496,7 +495,7 @@ soft_reset:
// Disable all other IRQs except Systick and Flash IRQs // Disable all other IRQs except Systick and Flash IRQs
// Note: FS IRQ is disable, since we're going for a soft-reset. // Note: FS IRQ is disable, since we're going for a soft-reset.
irq_set_base_priority(2); irq_set_base_priority(IRQ_PRI_FLASH+1);
// soft reset // soft reset
storage_flush(); storage_flush();