First, huge thanks to quantum-leaps for the extraordinary work behind QP C.
I'm trying to learn QP and propagating it in the laboratory i work, but I actually running into a wall regarding compiling the mos simplistic of the examples, the dining philosopher problem.
I'm using latest: QP/C 5.5.0 (2015-09-04) and I'm using GCC for compiling, in Win64 environment.
I decide to introduce the philo.c table.c and dpp.h into my actual working source I use. Which compiles fine, but when I add in my main():
Philo_ctor(); /* instantiate all Philosopher active objects */
Table_ctor(); /* instantiate the Table active object */
QF_init(); /* initialize the framework and the underlying RT kernel */
the linker complains with:
LN SAM4S_TFT01-3.2.elf
usr/applications/TFT01-3.2/main.o: In function main':
M:\Workshop\Sources\gcc/../../../../../usr/main.cpp:790: undefined reference toPhilo_ctor()'
Since you are using the GNU-ARM compiler, I would highly recommend that you try to adapt the existing project for this toolset.
I realize that your goal is to build a project for your Atmel SAM4S MCU, but I would start with an attempt to bulid one of the provided examples for GNU. For example, C:\qp\qpc\examples\arm-cm\dpp_ek-tm4c123gxl\qk\gnu. The Makefile is provided in this directory, so you only need to adapt the location of your GNU-ARM toolset. (The makefile used GNU-ARM downloaded from http://gnutoolchains.com/arm-eabi ). This should really take a few minutes of your time, but if you can build DPP for EK-TM4C123GXL (Cortex-M4F), you would test many things, like your toolset, make ulility, runtime libraries, etc.)
Only after you successfullly build one of the provided example projects, I would move on to a new chip. It's just easier to move one step at a time.
I hope this makes sense to you.
--MMS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nevertheless, I worked around the issue by using the makefile of dpp_ek-tm4c123gxl\qk\gnu and realizing the qk kernel involved more sources than I originally included in my makefile.
Then I also discovered that qk is in C and I have a complex C and C++ porgram and when including dpp.h, it lacks c++ extern directives. Adding them was the simple fix to "undefined references" in the constructor.
Now is working and I can see the dpp and work with it in my SAM4s and hopefully, I will learn to implement hierarchical statecharts!.
Besides my gratitude, I would like to tell you guys that the book, "Practical UML Statecharts
in C/C++ " it is indeed, one of the best books I've ever read in the topic. Impressive work guys and huge regards to Miro.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For a C++ program, QP/C++ would be a better choice than QP/C . Specifically, the DPP example in the QP/C++ download is written in C++ and would not run into the issues of extern "C" linking that you experienced with QP/C.
I'm really glad to hear that you like the PSiCC2 book :-)
--MMS
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First, huge thanks to quantum-leaps for the extraordinary work behind QP C.
I'm trying to learn QP and propagating it in the laboratory i work, but I actually running into a wall regarding compiling the mos simplistic of the examples, the dining philosopher problem.
I'm using latest: QP/C 5.5.0 (2015-09-04) and I'm using GCC for compiling, in Win64 environment.
I decide to introduce the philo.c table.c and dpp.h into my actual working source I use. Which compiles fine, but when I add in my main():
the linker complains with:
LN SAM4S_TFT01-3.2.elf
usr/applications/TFT01-3.2/main.o: In function
main': M:\Workshop\Sources\gcc/../../../../../usr/main.cpp:790: undefined reference to
Philo_ctor()'In my config.mk I did the following:
and also:
The funny thing is that the linker complains only with the constructor. If I only place QF_init...everything compiles smoothly.
The other question I have is 'vanilla' o 'preemptive'. As you can see from above I chose 'vanilla' by only adding qv...but not sure if I'm right.
Regards.
Since you are using the GNU-ARM compiler, I would highly recommend that you try to adapt the existing project for this toolset.
I realize that your goal is to build a project for your Atmel SAM4S MCU, but I would start with an attempt to bulid one of the provided examples for GNU. For example,
C:\qp\qpc\examples\arm-cm\dpp_ek-tm4c123gxl\qk\gnu
. The Makefile is provided in this directory, so you only need to adapt the location of your GNU-ARM toolset. (The makefile used GNU-ARM downloaded from http://gnutoolchains.com/arm-eabi ). This should really take a few minutes of your time, but if you can build DPP for EK-TM4C123GXL (Cortex-M4F), you would test many things, like your toolset, make ulility, runtime libraries, etc.)Only after you successfullly build one of the provided example projects, I would move on to a new chip. It's just easier to move one step at a time.
I hope this makes sense to you.
--MMS
Thank you, and your answer is totally correct.
Nevertheless, I worked around the issue by using the makefile of dpp_ek-tm4c123gxl\qk\gnu and realizing the qk kernel involved more sources than I originally included in my makefile.
Then I also discovered that qk is in C and I have a complex C and C++ porgram and when including dpp.h, it lacks c++ extern directives. Adding them was the simple fix to "undefined references" in the constructor.
Now is working and I can see the dpp and work with it in my SAM4s and hopefully, I will learn to implement hierarchical statecharts!.
Besides my gratitude, I would like to tell you guys that the book, "Practical UML Statecharts
in C/C++ " it is indeed, one of the best books I've ever read in the topic. Impressive work guys and huge regards to Miro.
For a C++ program, QP/C++ would be a better choice than QP/C . Specifically, the DPP example in the QP/C++ download is written in C++ and would not run into the issues of
extern "C"
linking that you experienced with QP/C.I'm really glad to hear that you like the PSiCC2 book :-)
--MMS