[Answered]: Musing on ulp_load_binary() samples ...
Posted: 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:
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?"
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));
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?"