The gdbstub ROM will be read/writeable until one write to this register.
This will ease future gdbstub updates.
---
 cores/sysctl/rtl/sysctl.v    |    4 ++++
 software/include/hw/sysctl.h |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/cores/sysctl/rtl/sysctl.v b/cores/sysctl/rtl/sysctl.v
index 3facb99..de0bc1d 100644
--- a/cores/sysctl/rtl/sysctl.v
+++ b/cores/sysctl/rtl/sysctl.v
@@ -42,6 +42,7 @@ module sysctl #(
 
        input [31:0] capabilities,
 
+       output reg debug_write_lock,
        output reg hard_reset
 );
 
@@ -134,6 +135,7 @@ always @(posedge sys_clk) begin
                hard_reset <= 1'b0;
 
                debug_scratchpad <= 8'd0;
+               debug_write_lock <= 1'b0;
        end else begin
                timer0_irq <= 1'b0;
                timer1_irq <= 1'b0;
@@ -181,6 +183,7 @@ always @(posedge sys_clk) begin
 
                                        /* Debug monitor (gdbstub) */
                                        5'b10100: debug_scratchpad <= 
csr_di[7:0];
+                                       5'b10101: debug_write_lock <= 1'b1;
 
                                        // 11101 is clk_freq and is read-only
                                        // 11110 is capabilities and is 
read-only
@@ -210,6 +213,7 @@ always @(posedge sys_clk) begin
 
                                /* Debug monitor (gdbstub) */
                                5'b10100: csr_do <= debug_scratchpad;
+                               5'b10101: csr_do <= debug_write_lock;
 
                                /* Read only SoC properties */
                                5'b11101: csr_do <= clk_freq;
diff --git a/software/include/hw/sysctl.h b/software/include/hw/sysctl.h
index 58529b0..48cb334 100644
--- a/software/include/hw/sysctl.h
+++ b/software/include/hw/sysctl.h
@@ -43,6 +43,7 @@
 #define ICAP_WRITE             (0x20000)
 
 #define CSR_DBG_SCRATCHPAD     MMPTR(0xe0001050)
+#define CSR_DBG_WRITE_LOCK     MMPTR(0xe0001054)
 
 #define CSR_FREQUENCY          MMPTR(0xe0001074)
 #define CSR_CAPABILITIES       MMPTR(0xe0001078)
-- 
1.7.2.5

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to