This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new f35c2bf hw/mcu/fe310: Add fast reboot path
f35c2bf is described below
commit f35c2bf99dc6e4cfdc995b125bc92640d4446542
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed Nov 6 12:54:56 2019 +0100
hw/mcu/fe310: Add fast reboot path
hal_reset_handler() for fe310 can now act in two ways
- (default) it will jump to the beginning of flash starting
from bootloader _reset_handler.
- when HAL_SYSTEM_RESET_FULL is 0 hal_reset_handler will just
jump to application _reset_handler.
This functionality can be useful when .bssnz section is used,
in this case bootloader will not overwrite it with it's own
data.
---
hw/mcu/sifive/fe310/src/hal_system.c | 7 ++++++-
hw/mcu/sifive/fe310/syscfg.yml | 8 ++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/mcu/sifive/fe310/src/hal_system.c
b/hw/mcu/sifive/fe310/src/hal_system.c
index e8dda0e..70737ef 100644
--- a/hw/mcu/sifive/fe310/src/hal_system.c
+++ b/hw/mcu/sifive/fe310/src/hal_system.c
@@ -24,13 +24,18 @@
void
hal_system_reset(void)
{
-
+ extern void _reset_handler(void);
#if MYNEWT_VAL(HAL_SYSTEM_RESET_CB)
hal_system_reset_cb();
#endif
while (1) {
HAL_DEBUG_BREAK();
+ if (MYNEWT_VAL(HAL_SYSTEM_RESET_FULL)) {
+ ((void (*)(void))SPI0_MEM_ADDR)();
+ } else {
+ _reset_handler();
+ }
}
}
diff --git a/hw/mcu/sifive/fe310/syscfg.yml b/hw/mcu/sifive/fe310/syscfg.yml
index b2fb043..9361824 100644
--- a/hw/mcu/sifive/fe310/syscfg.yml
+++ b/hw/mcu/sifive/fe310/syscfg.yml
@@ -77,3 +77,11 @@ syscfg.defs:
OS_TICKLESS_SLEEP:
description: 'Enable tickless sleep'
value: 1
+ HAL_SYSTEM_RESET_FULL:
+ description: >
+ When set to 1, hal_system_reset() reboots by jumping to start of
flash.
+ When set to 0, hal_system_reset() jumps directly to _reset_handler
of
+ application skipping bootloader code.
+ This maybe useful when .bssnz section is being used to store data
across
+ software reboots.
+ value: 1