Home
Welcome to Chopin's homepage!
distortos - 7 months & 0x3FF commits!
Written by Freddie Chopin   
Sunday, 22 February 2015 20:52

distortos project - mentioned in previous news article - is still evolving. Today it is exactly 7 months since the first commit in the repository, and the total number of these commits reached a nice value of 1023. Many readers - at least those who are a bit into RTOSes for microcontrollers - may wonder "who needs another RTOS project?". Answer to this question is very complex and I could write a separate article about that, so for now a link to README file - in which I tried to explain the main reasons for this project's existence - must suffice. I think that at least the huge emphasis placed on C++ and C++11 support makes this project worthwhile, although this feature should not diminish other advantages (some of which are of course "future" (; ), important for people who don't intend to use C++ (this feature is one of the "future" ones for sure, as for now only C++11 API is available).

There are still many features missing, but these 7 months were well spent - quite a lot was done, and these things work remarkably well (;

The most important features are obviously threads (Thread, StaticThread and ThreadBase classes), which can accept any number of arguments of any type - thanks to new features of C++11 standard - not only the void* known from other RTOSes. Moreover - regular functions, member functions, functors or lambdas can be used as thread's function.

All of these features are also present in software timers (SoftwareTimer class).

Scheduler supports full preemption based on thread's priority (there are 256 priority levels), and when several threads with the same priority are present, they are scheduled according to FIFO or round-robin algorithm (selected for each thread individually).

Semaphore (Semaphore class) is probably the most basic synchronization object. It is possible to configure maximal value the semaphore can "have", so this object can also be used as binary semaphore. Semaphores can be "posted" from interrupts.

Mutex (Mutex class) is one of more advanced synchronization mechanisms. Just as in POSIX standard, it can be configured to use any of the three "modes" - normal, error-checking or recursive - and any of the three "protocols" - normal, priority inheritance or priority protocol (also known as priority ceiling). Unlike many other RTOSes, priority inheritance protocol works with no limitations: through any number of inheritance "levels" and with any number of mutexes locked by threads in any order (diagram and description of test case of this particular feature).

Classic condition variable (ConditionVariable class) is a mechanism which extends functionality of mutexes.

Queues can be used for standard communication between threads and interrupts (in any combination). There are four variants of queues:

Messages added to queues which don't support priorities (...FifoQueue) are ordered in FIFO order, while queues which do support priorities (...MessageQueue) allow adding messages with one of 256 priority levels. Queues without support for objects (...Raw...) copy the messages with memcpy() function, while queues with support for objects use all operations required in such scenario (construction, destruction, assignment operator, swap, emplace, ...).

All blocking operations are also available in non-blocking variants and in blocking versions with timeout (absolute or relative), which - thanks to C++11 std::chrono - can be easily expressed in any unit (like seconds, minutes, hours, ... - link), not only in system "ticks".

All errors are signaled with error codes - functions use neither errno variable, nor C++ exceptions.

The only supported architecture - for now - is ARMv7-M, so ARM Cortex-M3 (ARM Cortex-M4 can be used without enabling FPU) (added 20.03.2015) and ARM Cortex-M4(F), and the only "officially" supported chip is STM32F407VG (known from STM32F4Discovery board), although using any different chip with proper core would be trivial.

I saved the best part (I hope) for the end - use of all functionalities mentioned above is possible without dynamic memory allocation. All previously described objects can be constructed as global variables or on stack.

I'm sure I forgot to mention some more interesting features...

Feel encouraged to test the code, ask questions, post comments, send suggestions and cooperate (; Stay tuned!

Last Updated on Friday, 20 March 2015 09:47
 
Work in progress...
Written by Freddie Chopin   
Friday, 29 August 2014 19:37

I was thinking about doing something like that for a long time... However usually intent is far away from something concrete, especially when you don't have that much free time in your hands. Finally I pulled myself together, so here is a little "teaser" of what I'm currently working on (among other things).

bool ThreadFunctionTypesTestCase::run_() const
{
    using scheduler::makeStaticThread;

    // thread with regular function
    {
        uint32_t sharedVariable {};
        constexpr uint32_t magicValue {0x394e3bae};

        auto regularFunctionThread = makeStaticThread<testThreadStackSize>(UINT8_MAX,
                regularFunction, std::ref(sharedVariable), magicValue);
        regularFunctionThread.start();
        regularFunctionThread.join();

        if (sharedVariable != magicValue)
            return false;
    }

    // thread with state-less functor
    {
        uint32_t sharedVariable {};
        constexpr uint32_t magicValue {0x2c2b7c30};

        auto functorThread = makeStaticThread<testThreadStackSize>(UINT8_MAX, Functor{},
                std::ref(sharedVariable), magicValue);
        functorThread.start();
        functorThread.join();

        if (sharedVariable != magicValue)
            return false;
    }

    // thread with member function of object with state
    {
        constexpr uint32_t magicValue {0x33698f0a};
        Object object {magicValue};

        auto objectThread = makeStaticThread<testThreadStackSize>(UINT8_MAX,
                &Object::function, std::ref(object));
        objectThread.start();
        objectThread.join();

        if (object.getVariable() != magicValue)
            return false;
    }

    // thread with capturing lambda
    {
        uint32_t sharedVariable {};
        constexpr uint32_t magicValue {0x24331acb};

        auto capturingLambdaThread = makeStaticThread<testThreadStackSize>(UINT8_MAX,
                [&sharedVariable, magicValue]()
                {
                    sharedVariable = magicValue;
                });
        capturingLambdaThread.start();
        capturingLambdaThread.join();

        if (sharedVariable != magicValue)
            return false;
    }

    return true;
}

Intriguing? Curious? Interesting? (;

It's a fragment of functional tests of an open-source project, which currently is in early alpha stage (first line of code was written just last month), but basic things - like the ones shown in the piece of code above - are working (on STM32F4) pretty well (; There is not much to say now, the only trace of this project is the github repository and this news... Just like in any open-source project the most important things are the users and the community, so any thoughts, ideas, remarks, opinions etc. can be posted here - in comments - or on github. If anyone's up for some coding, I'm open to cooperation. Work is ongoing, so "stay tuned" (;

Complete source file from which the fragment above was taken can be seen under this link.

Last Updated on Sunday, 22 March 2015 21:18
 
OpenOCD version 0.8.0 released
Written by Freddie Chopin   
Monday, 28 April 2014 08:45
Previous version of OpenOCD was released almost exactly one year ago and package for Windows was downloaded almost 20000 times, so it's high time for a new version. The sources of version 0.8.0 were published yesterday and the package with Windows binaries is already available on my website (Download > Software > OpenOCD). The list of changes since the previous release is a bit long, so a link to official release announcement must be enough... One important information from my side - currently all interfaces using libftdi library require WinUSB driver (previously libusb-win32 was required) - this change is related to switching to the new version of library - libftdi1. The easiest way to install the driver is to use zadig software, and a short description of the process can be found in "drivers\libusb-1.0 drivers.txt" file, which is a part of the package.
Last Updated on Monday, 28 April 2014 09:00
 
New versions - OpenOCD 0.7.0 and bleeding-edge-toolchain-130503
Written by Freddie Chopin   
Sunday, 05 May 2013 16:31

Weather during May's first weekend was truly disappointing, fortunately new software versions are "blooming" (;

On Friday, 3rd of May 2013, ~3 months after previous release, I have published the most recent compilation of the bleeding-edge-toolchain, tagged as 130503. Of the most interesting additions, configure options for newlib are worth mentioning, some of them very fresh: --disable-newlib-fvwrite-in-streamio, --disable-newlib-fseek-optimization and --disable-newlib-wide-orient. These options reduce code size of programs using stdio.h's functions. Additionally - thanks to removal of --enable-newlib-register-fini - if the program does not use functions like atexit() then support for that functionality will not be linked. Due to transfer limits of this website all bleeding-edge-toolchain files were moved to sourceforge website, in Download > Software > bleeding-edge-toolchain you will find links to appropriate locations.

And today, on 5th of May 2013, OpenOCD 0.7.0 was released. Since release of previous 0.6.1 version almost 7 months have passed and the Windows package was downloaded over 11000 times. There are not a lot of new things, but worth mentioning are: support for Texas Instruments' ICDI debugger, improved MIPS handling, support for Cortex-R4 (ARMv7R) architecture, support for ChibiOS/RT debugging, support for LPC43xx and LPC18xx (for chips with internal flash and with external memory connected via SPIFI interface), EFM32, STM32W and i.MX6. Package with Windows binaries is - as usually - available in Download > Software > OpenOCD.

Download and enjoy!

Additionally - "thanks" to monotony caused by constant rainfall - I have decided to start a facebook page for my company DISTORTEC, so I invite you to take a look and "Like!" it > https://www.facebook.com/Distortec

UPDATE 11.05.2013:

There is another version of bleeding-edge-toolchain available, tagged as 130509. There were exactly two reasons for this compilation. First one - it turns out that there is no --disable-newlib-atexit-alloc option, it should be --disable-newlib-atexit-dynamic-alloc - thanks to this option functions related to atexit() don't allocate memory dynamically. Second reason is related to the project I'm currently doing, which requires printf() / scanf() specifiers introduced in C99, like all those strange %hhx and so on. This second change causes a slight increase in RAM requirements of these functions - about ~80 bytes - you know, nothing is for free (; .

Last Updated on Saturday, 11 May 2013 08:23
 
.info domain is back!
Written by Freddie Chopin   
Monday, 22 April 2013 19:12
After almost two months of problems www.freddiechopin.info domain is happily back! .pl domain will still remain active, with redirect to .info.
 
«StartPrev123456789NextEnd»

Page 1 of 9