Project's structure
Note: PlatformIO Environment
Link to book: file:///G:/Workspace/cuav/Documentation/PSiCC2.pdf
QP Website: ...
Using QP requires
-
QP Source Code
-
Installation of QTools
-
Add to Path
-
- 2 ways to connect the QP Library:
-
- Clone the QP repo into the of the project
-
- Clone the QP repo anywhere and configure the path in platformio.ini file of the project: E.g. lib_extra_dirs = ../Dependencies/ --> Recommend since there is a generate_src_filter script to declare the preprocessor
* Users' definition of QP callback functions:
- Kernel: QV, QK, QX
- - HArdware/Project specific: declared in include/ Folder
QP::QF::TICK_X(0, (void*)0);
void QF::onStartup(void);
#ifndef Q_UTEST
//........................................................
#ifndef Q_SPY
void QP::QV::onIdle(void) { // called with interrupts DISABLED
#ifdef NDEBUG
// Put the CPU and peripherals to the low-power mode. You might need to customize the clock management for your application, see the datasheet for your particular MCU.
QV_CPU_SLEEP(); // atomically go to sleep and enable interrupts
#else
QF_INT_ENABLE(); // simply re-enable interrupts
#endif
}
#endif
// ............................................................................
extern "C" Q_NORETURN Q_onAssert(char const * const module, int location) {
//
// NOTE: add here your application-specific error handling
//
(void)module;
(void)location;
QF_INT_DISABLE(); // disable all interrupts
for (;;) { // freeze in an endless loop for now...
}
}
#endif
Examples: ...
User should declare this function itself
void __attribute__((weak)) QS::onCommand(unsigned char cmdId,
unsigned long param1, unsigned long param2, unsigned long param3)
bool QS::onStartup(void const* arg);
void QS::onCleanup(void);
void QS::onFlush(void);
void __attribute__((weak)) QS::onCommand(unsigned char cmdId ,unsigned long param1, unsigned long param2, unsigned long param3)
QSTimeCtr QS::onGetTime(void);
#ifndef Q_UTEST
void QP::QV::onIdle(void); // Redeclare of QVConfig to flush the qspy records
#endif
Examples: ... QSPY_BlinkyAO
void QS::onTestLoop();
void __attribute__((weak)) QS::onTestSetup(void);
void __attribute__((weak)) QS::onTestTeardown(void);
void __attribute__((weak)) QS::onTestEvt(QEvt *e);
void __attribute__((weak)) QS::onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status);
void __attribute__((weak)) QP::QS::onCommand(uint8_t cmdId, uint32_t param1, uint32_t param2, uint32_t param3)
Examples: ...
QUTEST_SelfTest
QUTEST_BlinkyAO
QUTEST_UARTSensor
PlatformIO or CMake
- Sidenote:
- check library.json in <qp> folder.
- The extra script is used to generate the build flags and compiling options
- The blinky object
QRelay.py
CustomTestRunner.py
Integrating Qutest and Platformio
Testing without platformio
-
Read chain+ --> Compiler find the neceesary source files
-
lib_deps = include/
Environment
Testing QP Flags
Build and Source file
Testing
WARNING: the .pio contains the included path --> new project might not be able to compile
TODO:
- Unstable testing. The test results are not 100% deterministic
- Connection of CustomTestRunner must be reworked --> Sometimes we observe that the com port of teensy does not reconnect
- COM port is still hard coded. Is there anyway to regconize the port automatically?
- Rework the flag adjustment of QP librariey dependencies
- Integrate automated document generation
- Check port clean up after testing/ reconnect port/ etc.
Further improvement
- Remote cheking before merging --> setup CI pipeline
- Add unittest for the designed modules