CPU register access from userspace

Does anyone (or NXP or SolidRun) have a tool that can inspect and write to the processor registers from user space?

We generally write a such a tool when we do BSP development but I haven’t gotten around to doing that. If someone else has written one, it’ll save me some time. In the past, with Freescale PowerPC parts, it’s been a fairly simple memory mapping exercise, you just need to know the right memory offsets. Layerscape should be the same but I haven’t done that research yet. Does SolidRun use the same map that the the NXP LX2160ARDB uses or are there different memory offsets?

I’ve been using the devmem tool for this which can be installed via the apt package devmem2

https://manpages.ubuntu.com/manpages/bionic/man1/devmem2.1.html

If you’re looking to change the serdes configuration, there’s a process that has to be followed which includes halting the lane, changing the config and then re-starting it. It’s explained in one of the NXP manuals, probably the SRM.

You can also change registers pre-boot using the u-boot memory read (md) and memory write (mw) commands

Great, devmem should work! Sounds like a shell script is in order to automate the whole process.

Do I need to add in any offset to the devmem address arg to get to the processor registers?

You just use the physical address of the memory-mapped register you need to access. It’ll only read/write memory mapped registers such as those used to configure peripheral controllers and can’t access registers which are not presented in physical memory such as the cpu registers.

Since its a highly integrated SoC they are all “processor” registers to me but, yeah, technically they’re peripheral regs. I have no need to look at the CPU registers. I was just wondering whether or not there is an offset to the registers described in Memory Map in the NXP Reference manual.

those are the physical addresses of the registers