ULP General Purpose Registers R4-R7

boarchuz
Posts: 97
Joined: Tue Aug 21, 2018 5:28 am

ULP General Purpose Registers R4-R7

Postby boarchuz » Mon May 13, 2019 3:55 am

The ULP CP instruction set says "ULP coprocessor has 4 16-bit general purpose registers, labeled R0, R1, R2, R3".
I'm currently using the macros to program it, and only R0-R3 are defined here: https://github.com/espressif/esp-idf/bl ... /ulp.h#L35

Yet, looking through the registers, there also exists R4-R7 here: https://github.com/espressif/esp-idf/bl ... eg.h#L1801
I just tested these in a program by simply defining them as 4-7 and replacing R1-R3 with R4-R7 respectively, and everything seems to be working fine.

So, naturally, I'm curious why these aren't documented or used. Are they safe to use? Is it as simple as the method I described above, or was that just a coincidence?

ESP_Sprite
Posts: 2716
Joined: Thu Nov 26, 2015 4:08 am

Re: ULP General Purpose Registers R4-R7

Postby ESP_Sprite » Mon May 13, 2019 4:32 am

Those are scratch registers for the RTC peripheral, not CPU registers for the ULP. As the macros you use are very simple and don't have any real sanity checks in them, they will accept R4-R7 but they will generate non-working code as these registers do not exist and even if they did, the ISA has no way of addressing them.

boarchuz
Posts: 97
Joined: Tue Aug 21, 2018 5:28 am

Re: ULP General Purpose Registers R4-R7

Postby boarchuz » Tue May 14, 2019 4:49 am

Thanks, Sprite, that makes sense.
It seems to have worked for a while... Then I returned later to find the board non-functional as a MOSFET had died, so not a good idea to play with those registers :lol:

I think the macros aren't really supported but I'll add here that it would be great to have the 8-bit stage counter available too. It seems about the only thing missing from the set of macros since the commands commented as "not implemented yet" actually are in my experience.

Who is online

Users browsing this forum: Google [Bot] and 17 guests