Skip to content
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

Improve STM32H7B3I DK configuration to run LVGL #68254

Merged

Conversation

CharlesDias
Copy link
Contributor

Using the default configuration, the FPS range is 12 to 17, while CPU usage often reaches maximum capacity.

document_5026149297339499817.mp4

After updating the defconfig, it was possible to keep the 33 FSP with less CPU usage.

  • enable ICache, DCache, and cache management.
  • enable Chrom-ART.
  • enable double frame buffer and full refresh.
  • set bits per pixel to 16 if the RGB565 is used.
document_5026149297339499816.mp4

@zephyrbot zephyrbot added the platform: STM32 ST Micro STM32 label Jan 29, 2024
@CharlesDias CharlesDias changed the title Fix STM32H7B3I DK configuration to run LVGL Improve STM32H7B3I DK configuration to run LVGL Jan 29, 2024
@CharlesDias CharlesDias force-pushed the stm32h7b3i_dk_improve_lvgl branch 2 times, most recently from 7acc510 to c10d188 Compare January 29, 2024 22:51
@ajarmouni-st ajarmouni-st added area: Display Enhancement Changes/Updates/Additions to existing features labels Jan 30, 2024
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CharlesDias for this contribution.
Please update documentation as well, otherwise it is fine to me.

As a side note, I'd like we can make this less board specific and move whatever is possible to soc/arm/st_stm32/stm32h7, but that can be done in a next step. Having this part of V3.6 would already be a good deal.

@CharlesDias
Copy link
Contributor Author

Dear @erwango,

I saw that the job **Run tests with twister / twister-build (1) (pull_request_target) ** is failing because of some functions that are declared but not used.

Could you give me some tip? Thank you.

modules/lvgl/CMakeFiles/modules__lvgl.dir/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c.obj -c /__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:689:28: error: '_lv_gpu_stm32_dma2d_invalidate_cache' defined but not used [-Werror=unused-function]
  689 | LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address, lv_coord_t offset, lv_coord_t width,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:606:28: error: '_lv_draw_stm32_dma2d_copy_buffer' defined but not used [-Werror=unused-function]
  606 | LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * dest_buf, lv_coord_t dest_stride,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:371:28: error: 'lv_gpu_stm32_dma2d_wait_cb' defined but not used [-Werror=unused-function]
  371 | LV_STM32_DMA2D_STATIC void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx)
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:333:32: error: 'lv_draw_stm32_dma2d_img' defined but not used [-Werror=unused-function]
  333 | LV_STM32_DMA2D_STATIC lv_res_t lv_draw_stm32_dma2d_img(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * img_dsc,
      |                                ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

@CharlesDias
Copy link
Contributor Author

Thanks @CharlesDias for this contribution. Please update documentation as well, otherwise it is fine to me.

As a side note, I'd like we can make this less board specific and move whatever is possible to soc/arm/st_stm32/stm32h7, but that can be done in a next step. Having this part of V3.6 would already be a good deal.

Dear @erwango, could you clarify which documentation part I have to update? Thank you!

@ajarmouni-st
Copy link
Collaborator

ajarmouni-st commented Jan 30, 2024

Thanks @CharlesDias for this contribution. Please update documentation as well, otherwise it is fine to me.
As a side note, I'd like we can make this less board specific and move whatever is possible to soc/arm/st_stm32/stm32h7, but that can be done in a next step. Having this part of V3.6 would already be a good deal.

Dear @erwango, could you clarify which documentation part I have to update? Thank you!

https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/arm/stm32h7b3i_dk/doc/index.rst

Here is an example https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/arm/stm32f746g_disco/doc/index.rst

@erwango
Copy link
Member

erwango commented Jan 30, 2024

Dear @erwango,

I saw that the job **Run tests with twister / twister-build (1) (pull_request_target) ** is failing because of some functions that are declared but not used.

Could you give me some tip? Thank you.

modules/lvgl/CMakeFiles/modules__lvgl.dir/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c.obj -c /__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:689:28: error: '_lv_gpu_stm32_dma2d_invalidate_cache' defined but not used [-Werror=unused-function]
  689 | LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address, lv_coord_t offset, lv_coord_t width,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:606:28: error: '_lv_draw_stm32_dma2d_copy_buffer' defined but not used [-Werror=unused-function]
  606 | LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * dest_buf, lv_coord_t dest_stride,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:371:28: error: 'lv_gpu_stm32_dma2d_wait_cb' defined but not used [-Werror=unused-function]
  371 | LV_STM32_DMA2D_STATIC void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx)
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/zephyr/modules/lib/gui/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c:333:32: error: 'lv_draw_stm32_dma2d_img' defined but not used [-Werror=unused-function]
  333 | LV_STM32_DMA2D_STATIC lv_res_t lv_draw_stm32_dma2d_img(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * img_dsc,
      |                                ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

I'd suggest asking in discord Infrastructure channel. It should be possible not enabling this option when compiling external libraries. This is likely what is done when compiling TF-M.

@zephyrbot zephyrbot added the area: Samples Samples label Jan 30, 2024
@CharlesDias CharlesDias force-pushed the stm32h7b3i_dk_improve_lvgl branch 2 times, most recently from d39f396 to 40d2111 Compare January 30, 2024 16:51
@CharlesDias
Copy link
Contributor Author

Dear @erwango and @ajarmouni-st,

I updated the documentation. Let me know if I need to do something else. Also, I posted the issue related to "Run tests with twister / twister-build (1) (pull_request_target)" on discord Infrastructure channel.

Thanks!

@CharlesDias
Copy link
Contributor Author

Related to the CI job that failed, I verified that the call to the lv_gpu_stm32_dma2d_wait_cb and lv_draw_stm32_dma2d_img functions were commented out on zephyrproject-rtos/lvgl@7cfca5d, and the _lv_draw_stm32_dma2d_copy_buffer is never called.

In this case, those functions are not called anymore. Also, I ran the console commands:

grep -r --include=*.{c,h} --include=CMakeLists.txt "_lv_draw_stm32_dma2d_copy_buffer" .
grep -r --include=*.{c,h} --include=CMakeLists.txt "lv_gpu_stm32_dma2d_wait_cb" .
grep -r --include=*.{c,h} --include=CMakeLists.txt "lv_draw_stm32_dma2d_img" .

Within the Zephyr project, and no modules, drivers, etc., call these functions.

Should these functions be removed?

image

@CharlesDias
Copy link
Contributor Author

I opened this PR (zephyrproject-rtos/lvgl#50) to remove the unused functions.

@erwango
Copy link
Member

erwango commented Jan 30, 2024

I opened this PR (zephyrproject-rtos/lvgl#50) to remove the unused functions.

If this is the actual fix, it has to be fixed in upstream lvgl first.

@CharlesDias
Copy link
Contributor Author

Dear @erwango and @faxe1008,

The lvgl/lvgl#5561 has been merged into the upstream LVGL project, but not yet into https://github.com/zephyrproject-rtos/lvgl. Will the zephyrproject-rtos/lvgl repository only be updated when a new LVGL version becomes available?

Thanks.

@faxe1008
Copy link
Collaborator

@CharlesDias yes as soon as 8.3.12 is released we will update our fork. I would advise against tracking unreleased changes if the fix is not mission critical.

@erwango erwango added this to the v3.7.0 milestone Feb 13, 2024
@CharlesDias
Copy link
Contributor Author

Solved conflicts.

@faxe1008
Copy link
Collaborator

@CharlesDias Great news, there will most likely be a LVGL release 8.4 that incorporates your fixes on 17 of March :^). Will follow up with a sync PR on our fork asap. Would love to see this one get merged.

@erwango
Copy link
Member

erwango commented Mar 13, 2024

@CharlesDias What's the status of this PR ? I don't see CI errors anymore but LVGL fix is apparently not yet merged.
I'm willing to approve, but I'd like to avoid it is merged while not fully ready.

@CharlesDias
Copy link
Contributor Author

@CharlesDias What's the status of this PR ? I don't see CI errors anymore but LVGL fix is apparently not yet merged. I'm willing to approve, but I'd like to avoid it is merged while not fully ready.

@erwango, on my local build, the warnings still exist. I don't know why the CI doesn't catch them anymore. I tested with samples/modules/lvgl/demos -- -DCONFIG_LV_Z_DEMO_MUSIC=y and it seems good.

image

@erwango
Copy link
Member

erwango commented Mar 15, 2024

@CharlesDias What's the status of this PR ? I don't see CI errors anymore but LVGL fix is apparently not yet merged. I'm willing to approve, but I'd like to avoid it is merged while not fully ready.

@erwango, on my local build, the warnings still exist. I don't know why the CI doesn't catch them anymore. I tested with samples/modules/lvgl/demos -- -DCONFIG_LV_Z_DEMO_MUSIC=y and it seems good.

Ok, let's wait the warning to be fixed to be on the safe side.
I'm adding a DNM label. Please remove it (or ping me if you can't do it) once this is actually solved in tree.

erwango
erwango previously approved these changes Mar 15, 2024
@erwango erwango added the DNM This PR should not be merged (Do Not Merge) label Mar 15, 2024
@faxe1008
Copy link
Collaborator

@CharlesDias Yesterday 8.4.0 was released. I opened PRs in the module and the main repo. Feel free to also check that your changes still work as intended :^)
#70470

@CharlesDias
Copy link
Contributor Author

@CharlesDias Yesterday 8.4.0 was released. I opened PRs in the module and the main repo. Feel free to also check that your changes still work as intended :^)
#70470

Hi, @faxe1008. I tested using the #70470 and still works! And the warnings disappeared. :-)

@faxe1008 faxe1008 removed the DNM This PR should not be merged (Do Not Merge) label Mar 25, 2024
Copy link
Collaborator

@faxe1008 faxe1008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CharlesDias the update of the module was just merged. Noticed the thing with the copyright, but this also provides you with an opportunity to retrigger CI :^)

@@ -0,0 +1,9 @@
#
# Copyright 2023 BrainCo Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: copied the Copyright :^)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks!

Update Kconfig to improve LVGL Demo performance.

- enable ICache,  DCache, and cache management.
- enable Chrom-ART.
- enable double frame buffer and full refresh.
- set bits per pixel to 16.

Signed-off-by: Charles Dias <charlesdias.cd@outlook.com>
@fabiobaltieri fabiobaltieri merged commit a0ddba5 into zephyrproject-rtos:main Mar 26, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Display area: Samples Samples Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants