[Answered]: Musing on ulp_load_binary() samples ...

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Answered]: Musing on ulp_load_binary() samples ...

Postby kolban » Mon Nov 20, 2017 3:30 am

Am studying the ULP co-processor and looking at samples. I came across this one from our examples repository:

https://github.com/espressif/esp-idf/bl ... main.c#L45

The code I am looking at reads as follows:

Code: Select all

ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t));
Now imagine the binary is 40 bytes long ... that would give us 40 div 4 = 10 32bit words as the size parameter. Great. But now imagine that the binary is 41 bytes long. 41 div 4 is still 10 ... and we have lost a byte.

If the assembler assures that its binary result is always 32bit aligned ... then no issues and end of story. Which means that my question boils down to "Is the output of an assembly of a ULP co-processor source always going to be evenly divisible by 4?"
Last edited by kolban on Mon Nov 20, 2017 8:30 pm, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Musing on ulp_load_binary() samples ...

Postby ESP_igrr » Mon Nov 20, 2017 6:15 pm

Each ULP instruction is 32-bit, so assembler output size will be divisible by 4.

Who is online

Users browsing this forum: No registered users and 90 guests