]> git.sur5r.net Git - openocd/commitdiff
target/cortex_m: return error if breakpoint address is out of range
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 29 May 2018 21:40:36 +0000 (23:40 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 3 Jul 2018 06:28:02 +0000 (07:28 +0100)
If the "Flash Patch and Breakpoint" unit is rev.1 then it can only
accept breakpoint addresses below 0x1FFFFFFF.
Detailed info in "ARM v7-M Architecture Reference Manual", DDI0403E
at chapter "C1.11 Flash Patch and Breakpoint unit".

Print a message and return error if the address of hardware
breakpoint cannot be handled by the breakpoint unit.

Change-Id: I95c92b1f058f0dfc568bf03015f99e439b27c59b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4535
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Christopher Head <chead@zaber.com>
src/target/cortex_m.c

index b6043fccfb64836d80a3adeef2c1f374c5c61425..d1afbd569a6261f10b37f3a5fe6ccd24a57c378f 100644 (file)
@@ -1137,6 +1137,10 @@ int cortex_m_set_breakpoint(struct target *target, struct breakpoint *breakpoint
                breakpoint->set = fp_num + 1;
                fpcr_value = breakpoint->address | 1;
                if (cortex_m->fp_rev == 0) {
+                       if (breakpoint->address > 0x1FFFFFFF) {
+                               LOG_ERROR("Cortex-M Flash Patch Breakpoint rev.1 cannot handle HW breakpoint above address 0x1FFFFFFE");
+                               return ERROR_FAIL;
+                       }
                        uint32_t hilo;
                        hilo = (breakpoint->address & 0x2) ? FPCR_REPLACE_BKPT_HIGH : FPCR_REPLACE_BKPT_LOW;
                        fpcr_value = (fpcr_value & 0x1FFFFFFC) | hilo | 1;