Hi Timothy,
Thank you for your interest in QP real-time embedded frameworks.
All built-in kernels (QV, QK, or QXK) in QP/C and QP/C++ have been ported to Cortex-M with all major compilers (ARM-clang, GNU-ARM, and IAR-ARM). The PSoC Creator seems to be using ARM-GCC, which is supported as the GNU-ARM port.
However, the existing ports have been tested only in single-core MCUs. A proper operation on multicore, when both cores are active and exchange data, would require some careful attention to avoid concurrency hazards.
I would recommend that you try QP on just one core (either Cortex-M4 or Cortex-M0). You can try any built-in kernel (QV, QK, or QXK), but I would recommend staring simple (say, QV).
Finally, the built-in kernels are not the only option of running QP. You can use a 3rd-party RTOS, which can execute QP and insulate it from the multicore problem. The list of official QP ports to 3rd-party RTOSs is here: https://www.state-machine.com/qpc/ports_rtos.html
--MMS
Last edit: Quantum Leaps 2024-04-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For now I'm only planning to have QV running on the CM4 core 👍🏻
I've used QP on prior projects. However each time I've built out from working example QP projects. Creating my own QP project from scratch has left me a bit at a loss for what the steps are 🤔 You mentioned that running with the ARM-GCC compiler and using an M4 shouldn't be a problem. Assuming that I don't need to modify any of the porting files, do I just need to include the correct QP project headers/code, and then add the required QP initialization code to my project?
Is there perhaps a tutorial on how this integration process should look?
Also, is there a way that I can pre-compile the QP source once, and include it as a library so I don't have to rebuild QP source when I do a clean and rebuild?
Thank you for the input 😊
Timothy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But really there is not much of "integration" here. I presume that in your first step you'd simply like to run the standard DPP example on your PSoC. Of course, you'd need to change the bsp.c for your PSoC. But beyond that, you don't need to change any other source code and you should use the exact same files in your build.
So, can just look into the provided Makefile for GNU-ARM so see which source files you need:
# C source filesC_SRCS:=\bsp.c\main.c\philo.c\table.c\system_stm32c0xx.c\startup_stm32c031xx.c
# C++ source filesCPP_SRCS:=OUTPUT:=$(PROJECT)LD_SCRIPT:=$(PROJECT).ld
QP_SRCS:=\qep_hsm.c\qep_msm.c\qf_act.c\qf_actq.c\qf_defer.c\qf_dyn.c\qf_mem.c\qf_ps.c\qf_qact.c\qf_qeq.c\qf_qmact.c\qf_time.c\qv.c\qv_port.c
QP_ASMS:=QS_SRCS:=\qs.c\qs_rx.c\qs_fp.c
@quantum-leaps Thank you for the guidance. I managed to get everything set up in PSoC Creator with QP running.
In case anyone in the future is looking to use QP / QV in a PSoC Creator project, I've attached my test project.
Project
Blinky-derived example of QP / QV running on an Infineon PSoC 6 MCU
Execution
* Cycles through Off -> Only Green LED ON -> Only Red LED ON -> Off
* Outputs AO state entries over UART-USB connection
* Blue LED pulsed when QP enters Idle State
* RGB LED turns Yellow in case of Q_onError() call
Hardware Platform: CYBLE-416045-EVAL 02 board
QP Version tested on: 7.3.4
QP folder location: "c:\qp\"
Built with PSoC Creator 4.4, PDL 3.1.7
Note 1: The project should be on the same drive that the QP library is installed. qp is expected to be on root.
Note 2: In case the project complains that the included QP files are missing, but "qp" is installed in the root of the drive, you may need to re-add the QP files to the project. I couldn't figure out how to use Absolute Paths when pointing to those files... so I modded the .cyprj file by hand.
Hello there!
I’m working on integrating the QP Framework (7.3.4) into the Infineon PSoC 6 dual-core MCU (CM4 & CM0), leveraging the PSoC Creator IDE (v4.4).
I’ve been looking around online for guidance on what’s required to have QP running on the bare-metal MCU, and found a few resources:
Are there any other noteworthy resources on how to get the QP Framework running on my MCU & IDE?
Thank you in advance!
Timothy
Last edit: Timothy 2024-04-18
Hi Timothy,
Thank you for your interest in QP real-time embedded frameworks.
All built-in kernels (QV, QK, or QXK) in QP/C and QP/C++ have been ported to Cortex-M with all major compilers (ARM-clang, GNU-ARM, and IAR-ARM). The PSoC Creator seems to be using ARM-GCC, which is supported as the GNU-ARM port.
However, the existing ports have been tested only in single-core MCUs. A proper operation on multicore, when both cores are active and exchange data, would require some careful attention to avoid concurrency hazards.
I would recommend that you try QP on just one core (either Cortex-M4 or Cortex-M0). You can try any built-in kernel (QV, QK, or QXK), but I would recommend staring simple (say, QV).
Finally, the built-in kernels are not the only option of running QP. You can use a 3rd-party RTOS, which can execute QP and insulate it from the multicore problem. The list of official QP ports to 3rd-party RTOSs is here: https://www.state-machine.com/qpc/ports_rtos.html
--MMS
Last edit: Quantum Leaps 2024-04-18
Hey there MMS 👋🏻
For now I'm only planning to have QV running on the CM4 core 👍🏻
I've used QP on prior projects. However each time I've built out from working example QP projects. Creating my own QP project from scratch has left me a bit at a loss for what the steps are 🤔 You mentioned that running with the ARM-GCC compiler and using an M4 shouldn't be a problem. Assuming that I don't need to modify any of the porting files, do I just need to include the correct QP project headers/code, and then add the required QP initialization code to my project?
Is there perhaps a tutorial on how this integration process should look?
Also, is there a way that I can pre-compile the QP source once, and include it as a library so I don't have to rebuild QP source when I do a clean and rebuild?
Thank you for the input 😊
Timothy
Hi Timothy,
Yes, there is a "Getting Started" guide (on the state-machine.com home page that you could read.
But really there is not much of "integration" here. I presume that in your first step you'd simply like to run the standard DPP example on your PSoC. Of course, you'd need to change the bsp.c for your PSoC. But beyond that, you don't need to change any other source code and you should use the exact same files in your build.
So, can just look into the provided Makefile for GNU-ARM so see which source files you need:
And here are the include directories you need:
~~~
INCLUDES = \
-I../.. \
-I$(QPC)/include \
-I$(QP_PORT_DIR) \
-I$(QPC)/3rd_party/CMSIS/Include \
-I$(QPC)/3rd_party/nucleo-c031c6
~~~
--MMS
Last edit: Quantum Leaps 2024-04-19
@quantum-leaps Thank you for the guidance. I managed to get everything set up in PSoC Creator with QP running.
In case anyone in the future is looking to use QP / QV in a PSoC Creator project, I've attached my test project.
Project
Blinky-derived example of QP / QV running on an Infineon PSoC 6 MCU
Execution
* Cycles through Off -> Only Green LED ON -> Only Red LED ON -> Off
* Outputs AO state entries over UART-USB connection
* Blue LED pulsed when QP enters Idle State
* RGB LED turns Yellow in case of Q_onError() call
Hardware Platform: CYBLE-416045-EVAL 02 board
QP Version tested on: 7.3.4
QP folder location: "c:\qp\"
Built with PSoC Creator 4.4, PDL 3.1.7
Note 1: The project should be on the same drive that the QP library is installed. qp is expected to be on root.
Note 2: In case the project complains that the included QP files are missing, but "qp" is installed in the root of the drive, you may need to re-add the QP files to the project. I couldn't figure out how to use Absolute Paths when pointing to those files... so I modded the .cyprj file by hand.
Last edit: Timothy 2024-06-05