GithubHelp home page GithubHelp logo

kmilo17pet / quarkts-cpp Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 2.0 8.32 MB

The QuarkTS port for C++. An open-source OS for embedded applications that supports prioritized cooperative scheduling, time control, inter-task communications primitives, hierarchical state machines and CoRoutines.

License: MIT License

CMake 0.61% C 0.97% C++ 97.71% Batchfile 0.36% PowerShell 0.35%
cooperative embedded event-driven firmware iot microcontrollers multitasking os rtos state-machine

quarkts-cpp's Introduction

Built for CodeFactor Codacy Badge DeepSource GitHub release (latest by date) MISRAC++2008 CERT C++ Standard Build Documentation arduino-library-badge Maintenance License Hits

Logo

QuarkTS++ : An open-source OS for small embedded applications.

QuarkTS++is the QuarkTS port for C++.

  • Download the latest release here
  • Read the documentation online here

QuarkTS++ is an operating system that provides a modern environment to build stable and predictable event-driven multitasking embedded software. The OS is built on top of a cooperative quasi-static scheduler and its simplified kernel implements a specialized round-robin scheme using a linked-chain approach and an event-queue to provide true FIFO priority-scheduling.

Features:

  • Prioritized cooperative scheduling.
  • Time control (Timed tasks and software timers)
  • Inter-Task communication primitives, queues, notifications and event-flags.
  • State-Machines ( hierarchical support )
  • Stackless Co-routines.
  • AT Command Line Interface (CLI)

QuarkTS++ is developed using a formal and rigorous process framed in compliance with the MISRA C++ 2008 and CERT coding standard guidelines and complemented with multiple static-analysis checks targeted to safe critical applications. QuarkTS++ builds with many different compilers, some of which are more advanced than others. For that reason, QuarkTS++ does not use any of the features or syntax that have been introduced to the C++ language by, or since, the C++11 standard.

Why cooperative?

Rather than having preemption, tasks manage their own life-cycle. This brings significant benefits, fewer re-entrance problems are encountered, because tasks cannot be interrupted arbitrarily by other tasks, but only at positions permitted by the programmer, so you mostly do not need to worry about pitfalls of the concurrent approach (resource-sharing, race-conditions, deadlocks, etc...).

What is it made for?

The design goal of QuarkTS is to achieve its stated functionality using a small, simple, and (most importantly) robust implementation to make it suitable on resource-constrained microcontrollers, where a full-preemptive RTOS is an overkill and their inclusion adds unnecessary complexity to the firmware development. In addition with a state-machines support, co-routines, time control and the inter-task communication primitives, QuarkTS provides a modern environment to build stable and predictable event-driven multitasking embedded software. Their modularity and reliability make this OS a great choice to develop efficiently a wide range of applications in low-cost devices, including automotive controls, monitoring and Internet of Things.

Why should I choose it?

QuarkTS++ is not intended to replace o compete with the other great and proven RTOS options already available today, for example FreeRTOS or MicroC/OS-II, in fact, you should check these options first. However, due to its size and features, is intended to play in the space between RTOSes and bare-metal. QuarkTS was written for embedded developers who want more functionality than what existing task schedulers offer, but want to avoid the space and complexity of a full RTOS, keeping the taste of a robust and safe one.

quarkts-cpp's People

Contributors

fermuch avatar kmilo17pet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

quarkts-cpp's Issues

task.setName() doesn't work

The task name of the two examples is never displayed in the log.
The task is searched based on its name and, if found, set. This doesn't actually make any sense since the task is already the correct object.
I have now made the following correction in task.cpp:

/*============================================================================*/
bool task::setName(const char *tName) noexcept {
    bool retValue = false;
    const size_t nl = util::strlen(tName, sizeof(name));
    /*cstat -MISRAC++2008-5-14-1*/
    // if ( ( nullptr != getContainer() ) && ( nl > 0U ) && ( nl < sizeof(name) ) ) {
    //     if ( nullptr == os.getTaskByName( tName ) ) {
    if (nl > 0U && nl < sizeof(name)) {
        (void)util::strcpy(name, tName, sizeof(name));  // skipcq: CXX-C1000
        retValue = true;
    }
    //     }
    // }
    // /*cstat +MISRAC++2008-5-14-1*/
    return retValue;
}

reinterpret_cast<unsigned_t> or reinterpret_cast<std::uintptr_t> in logger.cpp

BTW no criticism with your code, loving qlibs and QuarkTS

Compiling on GCC 5.10 on a W10 PC to setup some unit tests and ran into an issue with logger.cpp

Line 203 Example in logger.cpp
(void)util::unsignedToString( reinterpret_cast<unsigned_t>( p ), buffer, 16U ); // skipcq: CXX-C1000

Compiled with an error for 5 lines all related reinterpret_cast<unsigned_t>

E:\CSandbox\QuarkTS-cpp\src\logger.cpp|121|error: cast from 'const void*' to 'qOS::unsigned_t' {aka 'long unsigned int'} loses precision [-fpermissive]|

Tried different CPP standards just in case, but no solution.

Changing reinterpret_cast<unsigned_t> to reinterpret_cast<std::uintptr_t> fixes the compiler issue but wondering if this is a valid solution or a more project centric solution might be better.

(void)util::unsignedToString( reinterpret_caststd::uintptr_t( &sm.getTop() ), buffer, 16 ); // skipcq: CXX-C1000

Everything else compiles fine.

How to access param from a callback?

Given the following signature when adding a new command:

bool commandLineInterface::add( cli::command &cmd, char *textCommand, cli::commandCallback_t cFcn, cli::options_t cmdOpt, void *param )

param seems to be stored inside in the cmd itself.

As far as I understood, there is no way to access that variable. It is private and there is no getter.

Am I missing something?

Example LED_Blink_Flat_State_Machine problems

I am very interested in the FSM extension. The concept seems to me to be a very interesting variant. Unfortunately the example doesn't compile. After my corrections it is not working correctly. I tried to follow the example based on the documentation "https://kmilo17pet.github.io/QuarkTS-cpp/q_fsm.html" but failed. After the fixes it doesn't work. I don't yet fully understand how the timeout should be handled so that the "State_LEDBlink" works.
I would be happy if you could correct the example. I am not yet able to do this myself. Thank you for the excellent product.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.