cancel
Showing results for 
Search instead for 
Did you mean: 

XPSR register bitfields?

Glenn Andrews
Associate II

Is there a way to split the XPSR register view up so you can see each status bit by its name rather than the 32-bit value?

The SFRs have this feature, why do the general registers not have it enabled by default?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello again

Using CubeIDE this is the best result we can have.

Capture.PNG

 I hope you can use it with your students.

Best regards.

II

View solution in original post

9 REPLIES 9
Issamos
Lead II

Hello @Glenn Andrews 

I think this Arm ressource and this post may help. 

Best regards.

II

Hello @Issamos 

Thank you for your reply.

I'm aware of how to decode the binary string using the Arm references and I saw the previous post that implies there is no way to have STM32CubeIDE do it for you. I was hoping that the IDE had been improved in the last 2 years since that post.

It's a hassle to manually decode the flags when a computer program should be able to parse the register and display it in a human-readable format, especially when it does so already for the memory-mapped peripherals.

Is this an ST problem or an Eclipse problem?

Glenn

As an example, here's what Keil shows:

GlennAndrews_0-1693743559201.png

 

I think that you can use this commande.

  • uint32_t __get_xPSR (void) ( you can find it in the PM0264 table 32) 

But I'm not sure that we can use it with cortex's other than the cortex-M33. If you can get the xPSR value, it will be so easy to split it using the same programming manual.

Best regards.

II

I think you're not getting what I'm asking.

Other IDEs and debuggers can view the current xPSR values split up as a bitfield in the IDE registers window. STM32CubeIDE does not appear to be able to do so. I was asking if there was a way to do what seems like a very useful and programmatically trivial thing that is already available for the peripheral registers.

I know I can manually do the maths to work out which bits are set, and I know there are compiler intrinsics to read it programmatically, but that is no help when I want to debug the code and see real-time which flags change.

Context: I'm teaching a class on embedded systems at a low level, and I want the students to understand why when they add one to 0x7FFFFFFF the N flag and V flag get set even though an `unsigned int` is still a positive value. It's easy to do in some IDEs where they see the flags flip over, now I've got to tell them to decode the bitfield by hand.

Hello again

Using CubeIDE this is the best result we can have.

Capture.PNG

 I hope you can use it with your students.

Best regards.

II

Glenn Andrews
Associate II

I'm sad to see "You can't do this thing other IDEs do." Is the solution, but I guess that's it.

Maybe we can have a real time interface that recive the XPSR using a communication API and than split the values and give as the feedback we want.

I hope this happend soon.

Best regards.

II

@IssamosThe real-time interface already exists in the debugger. That's how you get the xPSR register value updated after every instruction step.

All that's needed is the representation in the registers window programmed to show the bitifield as well as the 32-bit number, based on processor type.

I'm amazed Eclipse doesn't already have this in the Registers window, since peripheral registers can split registers up through the SVD file, but it looks like there's no equivalent for CPU registers.