Merge pull request #11040 from kaspar030/fix_hifive1_reset
boards/hifive1: fix hifive1 reset
This commit is contained in:
commit
b50ad9ed4c
@ -13,6 +13,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|||||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||||
|
|
||||||
# this board uses openocd
|
# this board uses openocd
|
||||||
|
export OPENOCD_CMD_RESET_RUN=_reset
|
||||||
include $(RIOTMAKE)/tools/openocd.inc.mk
|
include $(RIOTMAKE)/tools/openocd.inc.mk
|
||||||
|
|
||||||
# use our own openocd script to flash since HiFive1 has reset problems.
|
# use our own openocd script to flash since HiFive1 has reset problems.
|
||||||
|
|||||||
7
boards/hifive1/dist/openocd.cfg
vendored
7
boards/hifive1/dist/openocd.cfg
vendored
@ -31,7 +31,8 @@ $_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 10000 -work-ar
|
|||||||
flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME
|
flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME
|
||||||
#init
|
#init
|
||||||
#reset -- This type of reset is not implemented yet
|
#reset -- This type of reset is not implemented yet
|
||||||
if {[ info exists pulse_srst]} {
|
|
||||||
|
proc _reset {} {
|
||||||
ftdi_set_signal nSRST 0
|
ftdi_set_signal nSRST 0
|
||||||
ftdi_set_signal nSRST z
|
ftdi_set_signal nSRST z
|
||||||
#Wait for the reset stretcher
|
#Wait for the reset stretcher
|
||||||
@ -39,6 +40,10 @@ if {[ info exists pulse_srst]} {
|
|||||||
#will incur lots of delays for later commands.
|
#will incur lots of delays for later commands.
|
||||||
sleep 1500
|
sleep 1500
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {[ info exists pulse_srst]} {
|
||||||
|
_reset
|
||||||
|
}
|
||||||
#halt
|
#halt
|
||||||
#flash protect 0 64 last off
|
#flash protect 0 64 last off
|
||||||
#
|
#
|
||||||
|
|||||||
@ -17,7 +17,9 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include "periph/pm.h"
|
#include "periph/pm.h"
|
||||||
|
#include "vendor/platform.h"
|
||||||
|
|
||||||
void pm_set_lowest(void)
|
void pm_set_lowest(void)
|
||||||
{
|
{
|
||||||
@ -30,4 +32,13 @@ void pm_off(void)
|
|||||||
|
|
||||||
void pm_reboot(void)
|
void pm_reboot(void)
|
||||||
{
|
{
|
||||||
|
AON_REG(AON_WDOGKEY) = AON_WDOGKEY_VALUE;
|
||||||
|
AON_REG(AON_WDOGCMP) = 0;
|
||||||
|
//wdogconfig: : wdogrsten | enablealways | reset to 0 | max scale
|
||||||
|
AON_REG(AON_WDOGKEY) = AON_WDOGKEY_VALUE;
|
||||||
|
AON_REG(AON_WDOGCFG) |= (AON_WDOGCFG_RSTEN | AON_WDOGCFG_ENALWAYS |\
|
||||||
|
AON_WDOGCFG_ZEROCMP | AON_WDOGCFG_SCALE) ;
|
||||||
|
AON_REG(AON_WDOGKEY) = AON_WDOGKEY_VALUE;
|
||||||
|
AON_REG(AON_WDOGFEED) = AON_WDOGFEED_VALUE;
|
||||||
|
while(1) {}
|
||||||
}
|
}
|
||||||
|
|||||||
4
dist/tools/openocd/openocd.sh
vendored
4
dist/tools/openocd/openocd.sh
vendored
@ -90,6 +90,8 @@
|
|||||||
# the target when starting a debug session. 'reset halt' can also be used
|
# the target when starting a debug session. 'reset halt' can also be used
|
||||||
# depending on the type of target.
|
# depending on the type of target.
|
||||||
: ${OPENOCD_DBG_START_CMD:=-c 'halt'}
|
: ${OPENOCD_DBG_START_CMD:=-c 'halt'}
|
||||||
|
# command used to reset the board
|
||||||
|
: ${OPENOCD_CMD_RESET_RUN:="-c 'reset run'"}
|
||||||
# This is an optional offset to the base address that can be used to flash an
|
# This is an optional offset to the base address that can be used to flash an
|
||||||
# image in a different location than it is linked at. This feature can be useful
|
# image in a different location than it is linked at. This feature can be useful
|
||||||
# when flashing images for firmware swapping/remapping boot loaders.
|
# when flashing images for firmware swapping/remapping boot loaders.
|
||||||
@ -323,7 +325,7 @@ do_reset() {
|
|||||||
-c 'telnet_port 0' \
|
-c 'telnet_port 0' \
|
||||||
-c 'gdb_port 0' \
|
-c 'gdb_port 0' \
|
||||||
-c 'init' \
|
-c 'init' \
|
||||||
-c 'reset run' \
|
${OPENOCD_CMD_RESET_RUN} \
|
||||||
-c 'shutdown'"
|
-c 'shutdown'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user