Multi-core GUI help

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multi-core GUI help

Jump to solution
729 Views
CMoran
Contributor III

I have a RT1176 running FreeRTOS, with several threads. One of the threads is running LVGL for a GUI, this project is only running on the M7 core of the processor. I'm interested in having the GUI being the only thread running on M7 core and move the less intensive threads to the M4 core. Although I haven't had any experience with multi-core processing. Has anyone done anything like this or have examples or guides on how to setup something like this? I don't particularly know where to start.

Labels (2)
0 Kudos
1 Solution
601 Views
CMoran
Contributor III

After a while of trying different things I was able to setup the simple example I had outlined above. I built it off of the freertos_message_buffers_cm7/cm4 projects, I wrote down a summary of what needed to be changed in order to get it to function.

Change the projects from using Redlib (nohost-nf) to NewlibNano (nohost).

In the m7, change the memory map from:

CMoran_0-1686583692548.png

to this:

CMoran_1-1686583736693.png

 

In the m7, add the preprocessor symbols:

XIP_BOOT_HEADER_DCD_ENABLE=1

USE_SDRAM

DATA_SECTION_IS_CACHEABLE=1

LV_CONF_INCLUDE_SIMPLE=1

FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE=1

SDK_I2C_BASED_COMPONENT_USED=1

VG_COMMAND_CALL=1

VG_TARGET_FAST_CLEAR=0

 

In the m7, change the "Managed Linker Script" from this:

CMoran_2-1686583978962.png

to this:

CMoran_3-1686584031603.png

 

In the m7, add the various files required to run LVGL and the screen over MIPI. I copied and pasted them from the lvgl_guider_cm7 project.

That should be all that is needed to be done setting wise, other than that I changed the default project behaviour of the m7 to use xMessageBufferSend on an event triggered by a button press on from LVGL, and the m4 to print "Hello World (from M4)!" if the message received (an integer) was not 0. I've also attached the modified projects to this reply. All that's needed to run them is the MIMXRT1170-EVK board, RK055HDMIPI4MAO LCD screen, and a connection to a pc to read the debug console on a terminal.

On program start a message should print in the terminal for each core starting:

"M7 Core Started."

"M4 Core Started."

and every press of the button in the middle of the screen will add the

"Hello World (from M4)!"

line.

View solution in original post

0 Kudos
6 Replies
689 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @CMoran ,

FreeRTOS doesn't support running on multicore. You can have the two core running FreeRTOS standalone.

 

Regards,

Jing

0 Kudos
682 Views
CMoran
Contributor III

Yes I understand that part, it's more the setup and communication between the two cores that I'm lost, other than just looking at pre-built SDK samples I haven't found too much documentation for setting up multicore projects. Currently as it stands, my GUI thread just sets states into an app instance structure, and then the application thread just checks what state it is and executes accordingly.

0 Kudos
664 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @CMoran ,

There are some SEMA4 and MU examples in SDK which can help. And there are more such demos in multicore_examples folder in SDK.

 

Regards,

Jing

0 Kudos
654 Views
CMoran
Contributor III

Okay, I spent most of yesterday looking through SDK examples. I have a simple idea to serve as a proof of concept and a building block for more complex systems.

What I would like to do is essentially take the "lvgl_guider_cm7" demo and have it running on the M7 core. That demo uses LVGL to draw a button with a label on the screen. I would then want it so that when the button is pushed, the M4 core prints something to the terminal, like "Hello World".

Now the issue that I'm facing with this, is that in order for LVGL to run on the M7 core it needs to have access to the board's external SDRAM, as the frame buffer (1280pixels * 720pixels * 24bits per pixel) is too large to fit into the internal memory. Any attempt (currently) that I've made to change the memory map to accommodate for this has made it so that the debugger will throw errors.

0 Kudos
602 Views
CMoran
Contributor III

After a while of trying different things I was able to setup the simple example I had outlined above. I built it off of the freertos_message_buffers_cm7/cm4 projects, I wrote down a summary of what needed to be changed in order to get it to function.

Change the projects from using Redlib (nohost-nf) to NewlibNano (nohost).

In the m7, change the memory map from:

CMoran_0-1686583692548.png

to this:

CMoran_1-1686583736693.png

 

In the m7, add the preprocessor symbols:

XIP_BOOT_HEADER_DCD_ENABLE=1

USE_SDRAM

DATA_SECTION_IS_CACHEABLE=1

LV_CONF_INCLUDE_SIMPLE=1

FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE=1

SDK_I2C_BASED_COMPONENT_USED=1

VG_COMMAND_CALL=1

VG_TARGET_FAST_CLEAR=0

 

In the m7, change the "Managed Linker Script" from this:

CMoran_2-1686583978962.png

to this:

CMoran_3-1686584031603.png

 

In the m7, add the various files required to run LVGL and the screen over MIPI. I copied and pasted them from the lvgl_guider_cm7 project.

That should be all that is needed to be done setting wise, other than that I changed the default project behaviour of the m7 to use xMessageBufferSend on an event triggered by a button press on from LVGL, and the m4 to print "Hello World (from M4)!" if the message received (an integer) was not 0. I've also attached the modified projects to this reply. All that's needed to run them is the MIMXRT1170-EVK board, RK055HDMIPI4MAO LCD screen, and a connection to a pc to read the debug console on a terminal.

On program start a message should print in the terminal for each core starting:

"M7 Core Started."

"M4 Core Started."

and every press of the button in the middle of the screen will add the

"Hello World (from M4)!"

line.

0 Kudos