ULP global variables
ULP global variables
Hi guys! I tried to change any global variable with ULP, but doesnt work. What I do wrong?
(The code simply read the variable before, and after the ULP to check if the variable has changed.)
C code
Assembly code
(The code simply read the variable before, and after the ULP to check if the variable has changed.)
C code
Assembly code
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: ULP global variables
Hi urbanze,
Maybe you are missing the "ulp_" prefix?
Ref. https://esp-idf.readthedocs.io/en/lates ... -variables
EDIT: If this is not the case, then try a classic example https://github.com/espressif/esp-idf/tr ... system/ulp.
This example is using global variables and it works for me.
I can't read anything on these screen shoots I will be guessing thenurbanze wrote:I tried to change any global variable with ULP, but doesnt work. What I do wrong?
Maybe you are missing the "ulp_" prefix?
Ref. https://esp-idf.readthedocs.io/en/lates ... -variables
EDIT: If this is not the case, then try a classic example https://github.com/espressif/esp-idf/tr ... system/ulp.
This example is using global variables and it works for me.
Re: ULP global variables
Thanks for reply krz!. I know about "ulp_" variables, and yes, I using this and doenst work... I think is anything about load or store, but need help...krzychb wrote:Hi urbanze,
I can't read anything on these screen shoots I will be guessing thenurbanze wrote:I tried to change any global variable with ULP, but doesnt work. What I do wrong?
Maybe you are missing the "ulp_" prefix?
Ref. https://esp-idf.readthedocs.io/en/lates ... -variables
EDIT: If this is not the case, then try a classic example https://github.com/espressif/esp-idf/tr ... system/ulp.
This example is using global variables and it works for me.
Why you cant view screen shots?
Re: ULP global variables
ULP code seems to be missing a store after the increment.
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: ULP global variables
I can view the screen shots but not the tiny fontkrzychb wrote:Why you cant view screen shots?
Copy and paste of code would work better for me in this case.
Also a plan text is easier for anybody to copy back for testing instead of retyping.
@ESP_igrr, thank you for help with this one!
Re: ULP global variables
.global xESP_igrr wrote:ULP code seems to be missing a store after the increment.
x: .long 0
.global entry
entry:
move r0, x
ld r0, r0, 0
add r0, r0, 1
st r0, r0, 0
halt
//or this
move r0, x
move r2, 10
ld r0, r0, 0
st r2, r0, 0
halt
Anyone doenst work, how can I do this simples process?¿
Re: ULP global variables
krzychb wrote:I can view the screen shots but not the tiny fontkrzychb wrote:Why you cant view screen shots?
Copy and paste of code would work better for me in this case.
Also a plan text is easier for anybody to copy back for testing instead of retyping.
@ESP_igrr, thank you for help with this one!
Code in C have:
variable: extern uint32_t ulp_x = 1;
and load/run to ulp.
Code in ulp
.global x
x: .long 0
.global entry
entry:
move r0, x
ld r0, r0, x
add r0, r0, 1
halt
I comment before with another two tests, and anyone doenst worked
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: ULP global variables
How do verify whether "ulp_x" is changing its value or not?urbanze wrote:Code in C have:
variable: extern uint32_t ulp_x = 1;
and load/run to ulp.
Re: ULP global variables
Should be e.g.:urbanze wrote:
Code in ulp
.global x
x: .long 0
.global entry
entry:
move r0, x
ld r0, r0, x
add r0, r0, 1
halt
I comment before with another two tests, and anyone doenst worked
.global x
x: .long 0
.global entry
entry:
move r1, x // load address of x in r1
ld r0, r1, 0 // load data from x in r0
add r0, r0, 1 // increment r0
st r0,r1,0 // store r0 as new content of x
halt
Re: ULP global variables
krzychb wrote:How do verify whether "ulp_x" is changing its value or not?urbanze wrote:Code in C have:
variable: extern uint32_t ulp_x = 1;
and load/run to ulp.
Code: Select all
void ulp()
{
Serial.printf("\nULP_X: %d", ulp_x & UINT16_MAX);
delay(100);
ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t));
ulp_run((&ulp_entry - RTC_SLOW_MEM) / sizeof(uint32_t));
delay(100);
Serial.printf("\nULP_X: %d", ulp_x & UINT16_MAX);
}
Who is online
Users browsing this forum: No registered users and 188 guests