New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TW#16748] Error in ULP macros #1327
Comments
The macro works well and passes the build in my environment. Please refers to the usage of I_END() in deep_sleep example. I added I_END() right after the last line and passed the compile. If your code is different, please paste it here to help us know what happened. |
From ulp.h on my computer:
The error "error: initializer element is not constant" I see is common when compiling in gnu99, I see that the newest toolchain i downloaded is using that flavor when compiling. c99, c89 and gnu99 don't allow initialization of globals with non-constant data, defines or literals. In c11 it was removed. What flavor should the files be compiled with? I downloaded the msys + toolchain from the archive you mention in the getstarted page a couple of days ago. Which flavor is you're compiler using? |
Could you please post the code snippet you are trying to compile? gist.github.com is a great place for code snippets. |
File i'm trying to compile with log output: (This is another file but the same error occurs) |
You need to place definition of Also there are other problems in your code: I_WR_REG takes 4 arguments, not 5. And bit arguments of I_WR_REG are bit numbers, not bit masks (e.g. |
Thank you, compilation succeed. Can you update the page http://esp-idf.readthedocs.io/en/latest/api-guides/ulp_macros.html with the information that the program need to be local and can not be global. Does not say in the docs. It would be great if you update and mention it. If you have time to answer, when ADC measurements are taken from ULP, is the data int16_t and stored in the first 16bit of uint32 or is it uint16_t? Just so I can typecast the values correctly in main cpu. |
Ok, the example will be updated to mention this. Thank you for pointing out this issue. ULP registers are 16-bit, and ADC measurement is stored in the lower 12 bits of the 16-bit register. When writing from ULP register to RTC memory, 16 bits of the register are stored in the lower half of the 32-bit memory word. Higher 32 bits are written with a value which depends on the address of the ULP instruction being executed. See http://esp-idf.readthedocs.io/en/latest/api-guides/ulp_instruction_set.html#st-store-data-to-the-memory. |
Thank you! |
The global function "SOC_REG_TO_ULP_PERIPH_SEL" in "ulp.h" can't set the values for the instruction macros using it to set "periph_sel". I get the message "error: initializer element is not constant" when compiling. Log is added below.
Have tried to make the "periph_sel" member to an argument of the macro who uses it for example:
and using the defines
directly as an argument and that worked. Using the function didn't work because it isn't a constant.
The text was updated successfully, but these errors were encountered: