Skip to content

Releases: solariun/CorePartition

Safe Notification Functions for, Wait/Notify, VariableLock functions.

03 Jan 14:39
05f5bd2
Compare
Choose a tag to compare

Safe functions are functionalities safer to be called from any interrupt request not managed by the kernel. Although, to take full effect and context change is necessary and is not automatically called.

  • Cpx_SafeNotify*
  • Cpx_SafeNotifyVariableLock*

Cpx_PublishTopic by nature is SAFE to be called from any IRQ, although, no unsafe kernel function should be called from any broker handler to avoid unwanted context change.

Locks and the noval Variable Lock based on Pointers now functions starts with Cpx_ instead

11 Jul 10:47
Compare
Choose a tag to compare

2.7.0 Is Here

With a lot of exiting improvements

  • NOW it has MIT license more free more options.

  • All functions now starts with Cpx_ instead of CorePartition_.

  • There will be no more SetStackOverflow, now just by using Cpx_StackOverflowHandler

  • Full static implementation is now possible, processor, like old pics with no malloc now can fully benefit from it. Although, setjmp and longjmp still a requirement.

  • Full Lock and SharedLock implementation, while locked, the thread is in a "kernel lock state" and can only be resumed uppon proper unlocking from other threads
    Cpx_Lock, Cpx_SharedLock, Cpx_Unlock, Cpx_SharedUnlock.

  • Introducing VariableLock, based on Pointer, with that novel approach, any variable, can be used to notify (one or all) other threads. Alternatively transmitting a payload with Attribute and Value is possible.

  • DeadLock is now detectable, join will leave if that condition arose and you can check with Cpx_GetNumberOfActiveThreads, it is returns zero a deadlock happened.

  • Dropping support for secure threads, I will implement a more modular due to the next version.

  • Dropping support to Preemptive Threads, you can still use the core with timer to trigger it, but, Locks are not tuned for that, be advised.

Working in progress

 IPCs for interrupt request time. Soon a 2.7.1 will be released.

2.6.0 Introducing Async and Sync messaging and interprocess lock

24 Aug 19:08
Compare
Choose a tag to compare

I am pleased to disclose a great additions to CorePartition:

  • Introducing Async Message Broker using Publish/Subscriber and topics to control async process intercommunications.
    Now using topics a thread can subscribe to asynchronously receive data published from other threads.

  • Introducing Sync Wait / Notify thread blocking procedures using Tags as the lock identifier and optionally capable to send messages
    Now CorePartitionOS will provide InKernel Wait/Notify Locks, but the same channel can also be used to send interprocess messages, the destination will be identified with a Tag that resembles Topics but only defines sync messages.

  • Introducing Message Payload, messages will be always identified (what thread generated that) and with a (32bits)Attribute and (64bitds)Value, sou a single topic or tag can do more than just sending a simple message, can send parameters and values (tuple) across the system.
    Not only values will be sent, but attributes that will define what is it for, so, you can use a single TAG to do much more than jus receive data.

  • Rewritten Scheduler to be adapt to the new functions.
    The timer based scheduler was entirely rewritten to accommodate special states for interprocess communications

  • Dropping full FreeRTOS support. It means it still can work, but we will no longer officially support it executing it as part of the RTOS solution, only of Computers OS's

  • The Full thread addressing inside the code was enhanced to make it faster and directly reference the actual thread.

Much Less Memory used, even more Speed, advanced Scheduling and Thread with Stack Isolation, introducing experimental FreeRTOS support

25 May 22:12
Compare
Choose a tag to compare

Introducing thread provisioning, now each not started thread will spend a single pointer (size_t), so you can provision a lot of threads and use it as necessary. each context will vary from 57 bytes on 8bits units to 226 on x86_64 and will only be allocated when a thread is created.
Amazing speed and stability
Improved scheduler
Now you can name a thread up to 8 characters
EXPERIMENTAL- CorePartition can work upon FreeRTOS, just use it inside a single Thread or on your main after initializing FreeRTOS threads. Do not mix process into different thread, it will unpredictable.
NOTE: IT is really a thread library it will fully contextualize every function and save it on memory pages, also will feature a momentum scheduler, a state of art scheduler capable to use time, or whatever you want as prioritizing measurement. All the examples are using milliseconds as prioritizing measurement.

Less Memory, More Speed, advanced Scheduling and Thread with Stack Isolation

17 May 00:53
Compare
Choose a tag to compare

Introducing thread provisioning, now each no used thread will spend a single pointer (size_t), so you can provisioning a lot thread and use it as necessary. each context will vary from 46 bytes on 8bits units to 180 on x86 computer / processor with 64bits and will only be allocated when a thread is created.

Amazing speed and stability

Improved scheduler

Now you can name a thread up to 8 characters

NEW - It now works on FreeRTOS as well.

Less Memory, More Speed and Thread Isolation

13 May 15:12
Compare
Choose a tag to compare
  • Introducing thread provisioning, now each no used thread will spend a single pointer (size_t), so you can provisioning a lot thread and use it as necessary. each context will vary from 46 bytes on 8bits units to 180 on x86 computer / processor with 64bits and will only be allocated when a thread is created.

  • Amazing speed and stability

  • Improved scheduler

  • Now you can name a thread up to 8 characters

Introducing experimental Thread Isolation and improved Sheduler

22 Mar 21:26
Compare
Choose a tag to compare

#Thread Isolation

Now, CorePartition will introduce Thread Isolation, it will dynamicaly encrypt stack on backup and restore of the memory page, it does not intend to be the best securety, but one more barier against digital threats. Every thhread with Secure Memory Page, will be crypted using a 128 bits key that will be dynamically changed every context switch. The developer will have no power or awereness of the procedure and the whole memory page will encrypted on memory.

    Note that it will ONLY encrypt the stack, hipe will remain original.

    Also note that this will design even for small microcontrollers and processor, the examples was also tested for Atmel 328P, 8Mhz, 1.5K RAM and  and ATiny 85,1Mhz,512 bytes of RAM

#Better Scheduler

The Scheduler now works better and smarter, using less resources and less time.

#Refactored thread creation procedures

Fine tuned Momentum Scheduler, tick count with 32bits for better compatibility, Reuse of stopped threads, value By ID provided, Last Duty Cycle

11 Nov 22:57
Compare
Choose a tag to compare

Fine tune Momentum Scheduler, Reuse of stopped threads, value By ID provided, Last Duty Cycle

#CorePartition 2.3

License information

  • Added

    • Last Duty Cycle Measurement
    • Reuse of dead threads, turning it into eventual threads
    • Decrease Memory Consumption
    • 26%. faster than previous version
    • Fine tuned Momentum scheduler
    • Added Thread with start variable;
    • Added examples to handle all this aspects
    • Tick resolution now with 32bits for broad compatibility

    Tested at:
    - AVR ATTiny85 (LowMemoryTrafficLight / BlinkThreads)
    - AVR ATMega328P, ATMega128, ATMega128P ATMega1280 16AU 1124, ATMega2560 16AU 1130
    - ARM STM32F103C
    - Arduino DUE
    - Arduino MKEZERO
    - Arduino MKR1010 (WIFI)
    - ESP8266 - ROBO KIT, ESP-12E, ESP-01
    - Adafrui PRO-Micro mini 5v e 3v

If you want to know a board not present here is compatible, send me a message at [email protected] to figure out or even send me a samble board that I will add a sample for it.

Partitioning a CORE into several Threads with a fast scheduler capable to be specialised through Tick and ticksleep interface, this way you can use nanoseconds, milliseconds or even real ticks to predict time, turning it into a powerful real time processor. This lib was designed to work, virtually, with any modern micro controller or Microchip as long as it uses reverse bottom - up stack addressing, but was aiming single core processors and user space like MSDOS, linux applications, windows applications and Mac to allow desktop softwares and processor to split a core into functions and with a momentum scheduler.

The Momentum Scheduler is optimised to only allow thread to come back to work only upon its "nice" time or later that, with means it will work on real time as long as the developer keep all the functions clean. For some big logic, there will have two way to keep it peace for all the functions, using CorePartition_Yield, that will comply with the nice principle or CorePartition_Sleep that you can dynamically call a specialised nice. If you are using a Tick interface to work as milliseconds, nice will me n milliseconds, examples of how to do it is also provided for Desktop application and processor (through Arduino exemplo for keeping it simple).

HIGHLY suitable for Arduino (All official models included) as well, a .ino project is also provided with an example.

Be aware that the CorePartition Lib is a pico Virtual Core emulation, it will slice your CPU or user space application into n threads (partitions) and will create a virtual stack page (the size of each stack page will be defined by the moment you create a partition), for each partition starting by a function already assigned to initiate the virtual core.

To calculate how much memory it will consume, start with the notion that each thread will consume around 60 ~ 170 bites depending on your target default bit channel size (8bits, 16bits, 32bits ... processor) plus the virtual stack page.

Be AWARE comes with no warrant or guarantees, since I still have a limited number to target to test, but for those it is fully functional till this point. If you intend to use this code, please make a reference of me as its creator. The comercial use is also permitted as long as I am notified and referenced in the code.

Tested at:

ESP8266 8 different boars including ESP-01

Arduino Nano (avr 328p)
Arduino Nano (avr 168) -> Thread.ino must have 2 threads due to memory
Arduino Nano (avr 168p) -> Thread.ino must have 2 threads due to memory

ATTiny85 (1Mhz / 512 bytes ram / 8K rom) -> Use BlinkThread.ino for testing

Sparkfun micro pro (Atmel32u4)

Arduino DUE (Arm m3)

Arduino MK ZERO (arm m0)

Arduino Genuino zero

STM32F103 (Bluepill)

MEGA2506

MEGA1260

testes with I2C chain connections
tested with ISP chain connections

tested and developed at OSX
tested at Linux
tested at Linux PI Zero, 1, 3

This is how to use it

#include "CorePartition.h"

void Thread1(void* pValue)
{
    int nValue = 100;
    
    while (1)
    {
        printf ("Thread1: Value [%d]\n", nValue++);
        
        CorePartition_Yield();
    }
}

void Thread2(void* pValue)
{
    int nValue = 1000;

    while (1)
    {
        printf ("Thread2: Value [%d]\n", nValue++);
        
        CorePartition_Yield();
    }
}


int main ()
{

    CorePartition_Start (2);
    
    //Every 1000 cycles with a Stack page of 210 bytes
    CorePartition_CreateThread (Thread1, NULL,  210, 1000);
    
    //All the time with a Stack page of 150 bytes
    CorePartition_CreateThread (Thread2, NULL, 150, 0);

    join();
}

inside your partitioned program (function) use the directive yield() to let the nano microkernel process next thread.

Please note it is not a regular thread, even though it behaves like one, it is a cooperative thread, once it will let the programmer choose when to yield control control to other threads.

This thread is HIGHLY SUITABLE for small arduinos like NANO (Works like magic) and ATTINY85

ATmega238p with Thermal cam (I2C) and 2 DotMatrix 8x8 ISP chained. 3 threads 1: reading cam, 2: showing cam, 3-Text Scroller

GIF-2019-10-15-22-17-50

ATTiny with 4 threads at 1Mhz

regift

IMG_5502

regift

Fine tune Momentum Scheduler, Reuse of stopped threads, value By ID provided, Last Duty Cycle

11 Nov 11:10
Compare
Choose a tag to compare

#CorePartition 2.3

License information

  • Added

    • Last Duty Cycle Measurement
    • Reuse of dead threads, turning it into eventual threads
    • Decrease Memory Consumption
    • 26%. faster than previous version
    • Fine tuned Momentum scheduler
    • Added Thread with start variable;
    • Added examples to handle all this aspects

    Tested at:
    - AVR ATTiny85 (LowMemoryTrafficLight / BlinkThreads)
    - AVR ATMega328P, ATMega128, ATMega128P ATMega1280 16AU 1124, ATMega2560 16AU 1130
    - ARM STM32F103C
    - Arduino DUE
    - Arduino MKEZERO
    - Arduino MKR1010 (WIFI)
    - ESP8266 - ROBO KIT, ESP-12E, ESP-01
    - Adafrui PRO-Micro mini 5v e 3v

If you want to know a board not present here is compatible, send me a message at [email protected] to figure out or even send me a samble board that I will add a sample for it.

Partitioning a CORE into several Threads with a fast scheduler capable to be specialised through Tick and ticksleep interface, this way you can use nanoseconds, milliseconds or even real ticks to predict time, turning it into a powerful real time processor. This lib was designed to work, virtually, with any modern micro controller or Microchip as long as it uses reverse bottom - up stack addressing, but was aiming single core processors and user space like MSDOS, linux applications, windows applications and Mac to allow desktop softwares and processor to split a core into functions and with a momentum scheduler.

The Momentum Scheduler is optimised to only allow thread to come back to work only upon its "nice" time or later that, with means it will work on real time as long as the developer keep all the functions clean. For some big logic, there will have two way to keep it peace for all the functions, using CorePartition_Yield, that will comply with the nice principle or CorePartition_Sleep that you can dynamically call a specialised nice. If you are using a Tick interface to work as milliseconds, nice will me n milliseconds, examples of how to do it is also provided for Desktop application and processor (through Arduino exemplo for keeping it simple).

HIGHLY suitable for Arduino (All official models included) as well, a .ino project is also provided with an example.

Be aware that the CorePartition Lib is a pico Virtual Core emulation, it will slice your CPU or user space application into n threads (partitions) and will create a virtual stack page (the size of each stack page will be defined by the moment you create a partition), for each partition starting by a function already assigned to initiate the virtual core.

To calculate how much memory it will consume, start with the notion that each thread will consume around 60 ~ 170 bites depending on your target default bit channel size (8bits, 16bits, 32bits ... processor) plus the virtual stack page.

Be AWARE comes with no warrant or guarantees, since I still have a limited number to target to test, but for those it is fully functional till this point. If you intend to use this code, please make a reference of me as its creator. The comercial use is also permitted as long as I am notified and referenced in the code.

Tested at:

ESP8266 8 different boars including ESP-01

Arduino Nano (avr 328p)
Arduino Nano (avr 168) -> Thread.ino must have 2 threads due to memory
Arduino Nano (avr 168p) -> Thread.ino must have 2 threads due to memory

ATTiny85 (1Mhz / 512 bytes ram / 8K rom) -> Use BlinkThread.ino for testing

Sparkfun micro pro (Atmel32u4)

Arduino DUE (Arm m3)

Arduino MK ZERO (arm m0)

Arduino Genuino zero

STM32F103 (Bluepill)

MEGA2506

MEGA1260

testes with I2C chain connections
tested with ISP chain connections

tested and developed at OSX
tested at Linux
tested at Linux PI Zero, 1, 3

This is how to use it

#include "CorePartition.h"

void Thread1(void* pValue)
{
    int nValue = 100;
    
    while (1)
    {
        printf ("Thread1: Value [%d]\n", nValue++);
        
        CorePartition_Yield();
    }
}

void Thread2(void* pValue)
{
    int nValue = 1000;

    while (1)
    {
        printf ("Thread2: Value [%d]\n", nValue++);
        
        CorePartition_Yield();
    }
}


int main ()
{

    CorePartition_Start (2);
    
    //Every 1000 cycles with a Stack page of 210 bytes
    CorePartition_CreateThread (Thread1, NULL,  210, 1000);
    
    //All the time with a Stack page of 150 bytes
    CorePartition_CreateThread (Thread2, NULL, 150, 0);

    join();
}

inside your partitioned program (function) use the directive yield() to let the nano microkernel process next thread.

Please note it is not a regular thread, even though it behaves like one, it is a cooperative thread, once it will let the programmer choose when to yield control control to other threads.

This thread is HIGHLY SUITABLE for small arduinos like NANO (Works like magic) and ATTINY85

ATmega238p with Thermal cam (I2C) and 2 DotMatrix 8x8 ISP chained. 3 threads 1: reading cam, 2: showing cam, 3-Text Scroller

GIF-2019-10-15-22-17-50

ATTiny with 4 threads at 1Mhz

regift

IMG_5502

regift

Improved context switch engine + memory consuption + scheduler interface for specialised tick counter and sleep and Demo improvements and tests

31 Oct 00:52
Compare
Choose a tag to compare

License information

The first ever Universal nanoCore cooperative multithread with scheduler (includes sleep interface for idle times) and interface to specialise how scheduler will treat ticks (to work with microseconds, nanoseconds, ticks, etc). This version supports Interrupt request from timers or signals without any problem.

But, it is a cooperative Thread , it relies on yield () to change context. For Arduino boards based on official Arduino code it will work like preemptive, since every IO block function or sleep will trigger yield. Some ported boards will also offer this capabilities like STM32F01, but you can always use yield on your code

There is a ready to use Arduino example, since it will help test among different targets.

Tested for: Arduinos MEGA 2506, 1280, Genuino Zero, Nano, MKR ZERO MKR 1010, STM32F01, ESP8266-ESP-01, ESP8266, ESP32 (in a single core), Linux, Windows e MacOS terminal program, embedded linux for PI. For all I have used the same example codes here (the main or the Thread.ino at resources)

With this release I am proving some image of a Demo using AMG8833 thermal camera unit (8x8) I2C, plus 2 red dot 8x8 matrix with ISP chain interface, The code works with 3 threads with a Atmega328p, with 1.2k available (the Arduino boot loader took part of the memory) and 32K of ROM. Each thread is consuming around 47 bytes for the thread context plus the stack page.

ATmega238p with Thermal cam (I2C) and 2 DotMatrix 8x8 ISP chained. 3 threads 1: reading cam, 2: showing cam, 3-Text Scroller
GIF-2019-10-15-22-17-50

ATTiny85 with 4 threads at 1Mhz, 512 bytes ram
regift

Added GNU v3 License