Renesance RX72N: combiler error with LVGL

I just added the LVGL librarie to our new project and got many combiler errors in lv_theme_mono.c like the folowing for example.

lvgl/src/lv_themes/lv_theme_mono.c(114):E0523043:Illegal member reference for "."

After a closer look it shows me that the errors are ocuring always when FG_COLOR is used. Folowing is the original implementation of FG_COLOR.

#define COLOR_INV(c)    ((c) == 0 ? LV_COLOR_WHITE : LV_COLOR_BLACK)
#define RADIUS          (LV_MATH_MAX(LV_DPI / 30, 2))
#define BORDER_WIDTH    (LV_MATH_MAX(LV_DPI / 60, 1))

It looks like that the combiler can not work with this combination of the macros. First I added brackets arround the second line to prevent missuse there. Second I replaced for tests FG_COLOR with a fix color LV_COLOR_WHITE. Now everything combiles but is not a nice solution.

#define COLOR_INV(c)    ((c) == 0 ? LV_COLOR_WHITE : LV_COLOR_BLACK)
#define BG_COLOR        ( == 0 ? LV_COLOR_WHITE : LV_COLOR_BLACK)
#define RADIUS          (LV_MATH_MAX(LV_DPI / 30, 2))
#define BORDER_WIDTH    (LV_MATH_MAX(LV_DPI / 60, 1))

Does someone have a hit how this problem can occure and how to fix it without changing the librarie or at least solve it in a nice way?

Thanks for every hint.

LVGL Version



Renesas RX72N

i have used vs build v7.10.1,your probrom havn’t come up. maybe @embeddedt can give you some advice

I guess it has something to do with the compiler how and in which order the macros are interpreted. So, can this problem somehow be connected with our Renesas MCU? If yes, do we find a nice solution that works for all MCUs?

Has someone experience with LVGL and Renesas MCUs?

With the mentioned “work around” LVGL works flawlessly. But I would like to be able to upgrade LVGL later without making changes all the time to the library.


I think it would be mandadory (as good programming practice) to put parenthesis around a ternary expression (if it is not used standalone).
Of course it’s good practice to always put parenthesis around a macro expression if it contains more than a single element.

I’m absolutely with you and could be fixed in the LVGL library, but this for its own did not solve my problem. The error occurs when “COLOR_INV(BG_COLOR)” gets called.

© in the first line cannot be resolved maybe because the © is not resolved to a LV_COLOR at this point.

Hmm, I think the c in COLOR_INV© is resolved, as normally there is no problem.
The parenthesis around the ternary expression is within COLOR_INV macro.

Maybe you can run the lv_theme_mono.c just through the preprocessor and take a look at the output.
I don’t know what it is for the RX72N…

With gcc this is done with:

arm-none-eabi-gcc -E lv_theme_mono.c > lv_theme_mono.txt 

@Night @robekras At first glance, this may be either a compiler bug, or some non-standard behavior on our part. LV_COLOR_WHITE and LV_COLOR_BLACK are macros which build a struct, not variables, something like this:

/* simplified */
#define LV_COLOR_MAKE(r, g, b) ((lv_color_t){(uint8_t)((b8 >> 7) | (g8 >> 7) | (r8 >> 7))})

I’m not sure whether C allows you to access the members of a struct in the same statement it’s built in. Evidently, other compilers don’t have a problem with this, so I suspect the RX27N compiler may be noncompliant in this regard. However, it’s also possible that this is nonstandard, and other compilers just accept it.

I just reached out to Renesas via the Customer Hub.
After a few messages back and forth with a helpful support engineer he reached out to the company’s compiler team in Japan.
He then told me that the problem is in fact a bug in the CCRX compiler. So I guess it is safe to assume that the LVGL code in that specific file is standard and can be used like that.

1 Like