Add support for all core registers on the STM32F4DISCOVERY, including floating point registers. #101

Merged
merged 3 commits into from Jul 9, 2012

Projects

None yet

2 participants

@prattmic
prattmic commented Jul 9, 2012

I have extended stlink to include support for all of the core registers of the device:

  • r0-r12
  • sp, lr, pc, xpsr
  • msp, psp
  • control, faultmask, basepri, primask
  • s0-31
  • fpscr

The ST-LINK on the board did not seem to support all of these registers, but as per section C1.6 of the ARMv7-M Architecture Reference Manual, they can all be read and written with accesses to the Debug Core Register Selection and Data registers.

Thus, I have used the standard ST-LINK memory access capabilities to read and write to the registers. A target descriptor XML document is sent to GDB to explain which registers the target has.

I have built and tested this for the STM32F4DISCOVERY, and the target descriptor should not be sent to GDB for any other boards, and as such they should not be affected by these changes. I have tested on a STM32L-DISCOVERY, and it did not seem to be affected.

It is possible that some of the changes I have made may be extended to other boards to provide better access to registers such as the msp, psp, control, etc. With their own target descriptor document, it should be fairly trivial to add support for them.

prattmic added some commits Jul 9, 2012
@prattmic prattmic Read Cortex M4F floating point registers
Since the ST-LINK does not seem to support reading these registers, I
have implemented functions that will manually request these registers
and add them to the reg struct.

As of now, these functions are just backend and are not integrated into
anything, however I have verified that they work with the STM32F407
DISCOVERY board.
a71f48d
@prattmic prattmic Extra registers integration with GDB
The support for extra registers has been added to GDB.  Now all core
registers can be read from GDB.  Write support has not yet been added.
b1e65ea
@prattmic prattmic Write to extra (FP, etc) registers from GDB
The extra registers added in my previous commit can now be modified from
within GDB.  Since the ST-LINK does not support accessing these
registers, a workaround was used from reading an writing to them.

That is, the Debug Core Register Selector Register (DCRSR) can be written
with the register requested, and it will be read/written to/from the
Debug Core Register Data Register (DCRDR).  The standard ST-LINK memory
access functions are used to make these accesses.

A target descriptor XML file is sent to GDB from the server, which tells
GDB which registers exist on the target.

This is only supported for the STM32F4, and has only been tested on the
STM32F4DISCOVERY.  I tested st-util on an STM32L-DISCOVERY and my
changes did not seem to interfere with its operation.
c6274f0
@texane texane merged commit fde8b6b into texane:master Jul 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment