setting breakpoint from code

Hi, my app (cortex m3) needs to set up a breakpoint directly from code, in order to jump to an interrupt when an instruction from a certain address is fetched. This WITHOUT using a debugger.

Any hint or tutorial? I think the only possible way is the patch block but it seems quite complicated.

Best regards


No Data
  • You can use debug monitor exception for that:

    - set MON_EN(bit 16) in DEMCR (0xE000EDFC)

    - Set FPB comparator register 0-5 for instruction address, with bit 0 (ENABLE) set to 1, REPLACE (bit[31:30]) = b01/b10/b11 depending on address

    - Set FPB comparator register 6-7 for literal data address, with bit 0 (ENABLE) set to 1 (bit[31:30] is ignored)

    - Enable FPB (FPB control register bit 0 set to 1)

    You also need to define your debug monitor handler.