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.
解決済! 解決策の投稿を見る。
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:
to this:
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:
to this:
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.
Hi @CMoran ,
FreeRTOS doesn't support running on multicore. You can have the two core running FreeRTOS standalone.
Regards,
Jing
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.
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
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.
Hi @CMoran ,
I don't know what's the problem. But you can refer to these posts.
1.move m4 to sdram
https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/How-to-move-CM4-core-project-to-SDRAM-in-RT1176/...
2.debug in sdram
https://community.nxp.com/t5/MCUXpresso-IDE/Running-and-debugging-program-in-SDRAM/m-p/1405167
3.Using NonCached Memory on i.MXRT
https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/Using-NonCached-Memory-on-i-MXRT/ta-p/1183369
4.usb host
https://community.nxp.com/t5/i-MX-RT/USB-Host-enumeration-fails/m-p/1436138
Regards,
Jing
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:
to this:
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:
to this:
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.