commit c116df59e703424e5aaba03efeb57f05c974d554
parent aeae25313b7599727d104ff3eef34124ea00e769
Author: Brian Swetland <swetland@frotz.net>
Date: Fri, 10 Mar 2023 12:47:53 -0800
transport: correctly manage the CSW protection bits
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/arm-debug.h b/src/arm-debug.h
@@ -105,3 +105,7 @@
#define MAP_CSW_DBG_SW_EN 0x80000000U // Debug SW Access Enable
#define MAP_CSW_KEEP 0xFF00FF00U // preserve mode/type/prot fields
+
+
+#define AHB_CSW_PROT_PRIV 0x02000000U
+#define AHB_CSW_MASTER_DEBUG 0x20000000U
diff --git a/src/transport-dap.c b/src/transport-dap.c
@@ -505,7 +505,10 @@ int dc_attach(DC* dc, unsigned flags, unsigned tgt, uint32_t* idcode) {
DEBUG("attach: CTRL/STAT %08x\n", n);
DEBUG("attach: MAP.CSW %08x\n", dc->map_csw_keep);
- dc->map_csw_keep &= MAP_CSW_KEEP;
+ //preserving existing settings is insufficient
+ //dc->map_csw_keep &= MAP_CSW_KEEP;
+
+ dc->map_csw_keep = AHB_CSW_PROT_PRIV | AHB_CSW_MASTER_DEBUG;
dc_set_status(dc, DC_ATTACHED);