CTRLSTAT = 0xffffffff

Sir,

I am working on Cortex-M4 over serial wire debug protocol, i am able to read IDCODE(0x2ba01477) which is correct as per arm cortex m4 technical reference manual, and i am writing 0x50000000 to CTRLSTAT register to enable CSYSPWRUPREQ and CDBGPWRREQ which is also success without any ACK error,but the thing is when i am trying to read the CTRLSTAT register i got 0xffffffff . I don't understand what might be the problem,Please suggest me what would be the problem??

Thanks & Regards

Parents
  • I just looked in the sources for the stlink tool. This might bring you to the solution.

    In the file "stlink-common.c", line 1593 ...

    After the sequence you mentioned, it writes a small piece of code into the SRAM and executes it.

    This piece of code copies a data block from the address that register r0 points to, to the address that register r1 points to, the length of the data block is r2 bytes.

    So this small piece of code can be used for both reading flash memory and writing flash memory.

    In the same file, line 1765, you'll find the routine (run_flash_loader) that sets the parameters and runs the piece of code in SRAM.

    The routine, which sets the value of a core register is also interesting, it's called stlink_write_reg, and is actually located in stlink-usb.c as _stlink_usb_write_reg at line 680.

Reply
  • I just looked in the sources for the stlink tool. This might bring you to the solution.

    In the file "stlink-common.c", line 1593 ...

    After the sequence you mentioned, it writes a small piece of code into the SRAM and executes it.

    This piece of code copies a data block from the address that register r0 points to, to the address that register r1 points to, the length of the data block is r2 bytes.

    So this small piece of code can be used for both reading flash memory and writing flash memory.

    In the same file, line 1765, you'll find the routine (run_flash_loader) that sets the parameters and runs the piece of code in SRAM.

    The routine, which sets the value of a core register is also interesting, it's called stlink_write_reg, and is actually located in stlink-usb.c as _stlink_usb_write_reg at line 680.

Children