This is an automated email from Gerrit.

"Tom Hebb <tommyh...@gmail.com>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/6958

-- gerrit

commit 0ef135de01bf814df4e486d3fb47ece2ac644d53
Author: Thomas Hebb <tommyh...@gmail.com>
Date:   Sun Sep 27 16:45:11 2020 -0700

    tcl/target/gd32vf103: add main flash alias
    
    The GD32VF103 creates an alias to either main flash or the bootloader at
    0x0, depending on how it was booted. As such, we want to indicate to
    debuggers that the memory at 0x0 is flash and so cannot support software
    breakpoints. To do this, add an alias to the main flash in the config.
    This isn't strictly accurate in the case where we're running the
    bootloader, but it still suits our purpose of fixing breakpoint
    behavior.
    
    I originally submitted[1] this change to the riscv-openocd fork of
    OpenOCD. That fork's maintainers accepted it, but have not upstreamed it
    like they have several other of my changes.
    
    Change-Id: I9eb8462d354f096eee231c0e5e2bffa538a5903e
    Signed-off-by: Thomas Hebb <tommyh...@gmail.com>

diff --git a/tcl/target/gd32vf103.cfg b/tcl/target/gd32vf103.cfg
index dcd0f4e59f..1b94773f6f 100644
--- a/tcl/target/gd32vf103.cfg
+++ b/tcl/target/gd32vf103.cfg
@@ -37,6 +37,14 @@ $_TARGETNAME configure -work-area-phys 0x20000000 
-work-area-size $_WORKAREASIZE
 set _FLASHNAME $_CHIPNAME.flash
 flash bank $_FLASHNAME stm32f1x 0x08000000 0 0 0 $_TARGETNAME
 
+# Address 0 is only aliased to main flash when the chip is not running its
+# built-in bootloader. When it is, it's instead aliased to a read only section
+# of flash at 0x1fffb000. However, we can't detect or dynamically switch this,
+# so just pretend it's always aliased to main flash. We need to tell OpenOCD
+# about this alias because otherwise we'll try to use software breakpoints on
+# code in flash, which don't work because flash mappings are read-only.
+flash bank $_CHIPNAME.flashalias virtual 0x0 0 0 0 $_TARGETNAME $_FLASHNAME
+
 # DBGMCU_CR register cannot be set in examine-end event as the running RISC-V 
CPU
 # does not allow the debugger to access memory.
 # Stop watchdogs at least before flash programming.

-- 

Reply via email to