Description
I am getting unaligned access hardfault errors at runtime. This seems to be caused by the lv_style_get_prop_inlined function, within lv_style.h. The error also seems to be dependent on my GCC compiler optimisation settings.
Initially, hardfaults were occuring after running for approximately 5 mins (though this time did vary). This would be an unaligned access fault, stopping within the lv_style_get_prop_inlined function in lv_style.h, at either line 365:
return LV_RES_INV;
or line 374:
for(i = 0; i < style->prop_cnt; i++) {
These occurred with compiler optimisation turned off (-O0). These issues were solved by changing compiler optimization to ‘Optimise More’ (-O2).
However, after adding the following line of code into my application:
lv_scr_load_anim(scr1, LV_SCR_LOAD_ANIM_MOVE_BOTTOM, 500, 0, false);
the same hardfault occurs immediately when running the program, this time at lv_style.h line 359:
for(const_prop = style->v_p.const_props; const_prop->prop != LV_STYLE_PROP_INV; const_prop++) {
To fix this, I had to turn optimisation back off, after which the program is now running successfully again. Changing the optimisation setting back to ‘Optimise More’ (-O2) reintroduced the issue, confirming that is was indeed the optimisation setting that fixed it.
At this point, I’m a bit stuck. Ideally I want optimisation on, and I can only presume that by changing the optimisation state, the alignment is being changed which fixes the issue. Is there anything else that I might be missing?
Please let me know if there’s any more information that I can provide that would help.
What MCU/Processor/Board and compiler are you using?
i.MX RT1060 (ARM M7) Evaluation board / GCC, with FreeRTOS
What LVGL version are you using?
v8.0.2 (latest master)