@ Embedded Controllers.
At-RTOS ·
At-RTOS(@ Real-Time Operating System) is an open and user-friendly Real-Time Operating System(RTOS) designed for various embedded controllers' supporting, as it's beginning it will be an important member of the At-EC family.
The goal of the system is to explore and try to provide a range of features and capabilities based on the RTOS to support and simplify your embedded firmware development.
We hope the At-RTOS will be a popular community-based embedded controller's real-time operating system in the future. If this project was useful to you, give it a ⭐. It is very important for us to know it is useful to you and your attention will encourage us.
Welcome PRs! If you are interested in contributing, Pls join us at Discord.
At-RTOS branch and release news as shown in the following table:
The release note is here.
At-RTOS is a type of Real-Time Operating System that focuses on adaptability and flexibility to cater to the needs of various embedded controllers. It's used to manage and control the hardware and firmware resources of embedded systems, ensuring real-time thread execution and system stability.
It provides a range of features and capabilities such as thread scheduling, messages routing and interrupt handling, and more, to meet the requirements of embedded systems for real-time performance and reliability. It supports concurrent execution of multiple threads, enabling the management of multiple threads while ensuring synchronization and communication between them.
It's also offers extensive APIs(Application Programming Interfaces) that allow developers to configure the system, create threads, communicate betwwen threads, customize kernel clock, and more, with ease. Additionally At-RTOS supports various hardware platforms and compiilers specifically for the ARM Cortex M seiral architecture, offering good portability and scalability.
Overall, At-RTOS is powerful, flexible, and scalable real-time operating system suitable for the development and deployment of various embbedded systems. For more information on At-RTOS, it is recommended to refer to relevant technical documentation and sample codes.
And the keywords of the At-RTOS are shown as the following lists.
- Open source: Royalty free.
- Tickless: At-RTOS makes it painless to create battery-powered application.
- Preemptive and Cooperative Scheduling: You can easily config your thread to pass preemptive and cooperative scheduling through your thread's priority setting.
- Resource Mutexes: It helps to protect your globally sensitive data from tampering by other threads.
- Binary and Counting Semaphores: It provides selectable counting and binary semaphore for thread communication in the system.
- Queue Messages: It's for thread-safe messages' communication.
- Subscribtion Messages: It's for thread-safe messages' communication.
- Multiple Events: It's for thread-safe events' communication.
- Memory Pools: It's for thread memory pool resource management.
- Software Timers with callback: It supports your varity time requirements application.
- Fully configurable (ROM and RAM): No limits on number of At-RTOS objects, except your devices' available memory.
- Tiny footprint: It has low ROM/RAM consumption.
- Learn Once, Write Anywhere: We don't make assumptions about the rest of your technology stack, so you can develop new features in At-RTOS without rewriting existing code.
At-RTOS supports many architectures, and has covered the major architectures in the current kernel system. It supports the following architectures, and it lists the chip that was verified.
-
ARM Cortex-M
lists:- Cortex-M3: GD32103C-START
- Cortex-M4: GD32F307E-START
- Cortex-M23:
- Cortex-M33: GD32W515P-EVAL
-
RISC-V
lists:- Reserved:
There is planned support for the ARM Cortex remaining architectures though no chips are now supported in my hand, If you perform it in your system, I'll thank you for your PRs to update the chip that is verified into lists.
The main compilers now supported by At-RTOS are:
-
Compiler
lists:- MDK KEIL (AC5).
- MDK KEIL (AC6).
- IAR IDE.
- ARMCLANG.
- CMAKE ARM GCC.
- CMAKE Native GCC.
# At-RTOS important source code tree is shown as follows.
At-RTOS
├── arch
│ └── arch32
├── clock
│ ├── clock_systick.c
│ └── CMakeLists.txt
├── port
│ ├── port.c
│ ├── port_keil_ac5.c
│ ├── port_keil_ac6.c
│ ├── port_iar.s
│ └── CMakeLists.txt
├── include
│ ├── kernel
│ │ ├── at_rtos.h
│ │ └── *.h
│ ├── arch.h
│ ├── port.h
│ ├── clock_tick.h
│ └── CMakeLists.txt
├── kernel
│ ├── kernel.c
│ ├── *.c
│ └── CMakeLists.txt
├── build_version.h
└── CMakeLists.txt
- arch : This folder provided the chip core architecture resource to support At-RTOS kernel feature.
- clock : It was implemented for At-RTOS kernel system tick to support system timers.
- port : It's used to support different compilers such as KEIL, IAR and GCC.
- include : It used to contain the At-RTOS kernel header files, Moreover it contained the portable arch, clock and port header files.
- kernel : This folder was implemented for the At-RTOS kernel files.
At-RTOS was designed specifically to take advantage of the powerful hardware features introduced with the ARM Cortex M architecture. The following HW resources were used in the At-RTOS kernel.
- Nested Vectored Interrupt Controller (NVIC)
- Service Call (SVC instruction)
- SysTick
- PendSV
- Floating Point Unit (FPU)
- Memory Protection Unit (MPU)
- Thread Mode/Handler Mode
At-RTOS ported a template At-RTOS configuration header file atos_configuration.h. Your board support package must provide the following variable symbols instead of this one.
/**
* If you using ARM Cortex M serial architecture, the Cortex-M Core architecture must be declared as the following list.
*
* ARCH_ARM_CORTEX_CM3
* ARCH_ARM_CORTEX_CM4
* ARCH_ARM_CORTEX_CM33
**/
#define ARCH_ARM_CORTEX_CM33
/**
* If you are use ARM Cortex M seiral architecture and use the system tick as the kernel timer.
* In most cases, PORTAL_SYSTEM_CORE_CLOCK_MHZ must be set to the frequency of the clock
* that drives the peripheral used to generate the kernels periodic tick interrupt.
* The default value is set to 120mhz.
*/
#define PORTAL_SYSTEM_CORE_CLOCK_MHZ (120u)
Your application will certainly need a different value, so set the kernel component instance number correctly. This is very often, but not always. It's according to your system design.
The symbols in the configuration header file look like <kernel component>_INSTANCE_SUPPORTED_NUMBER
, and the kernel component is shown as the following table:
- THREAD
- SEMAPHORE
- EVENT
- MUTEX
- QUEUE
- TIMER
- POOL
- ...
The more details you can see the descriptions in the template file atos_configuration.h.
The at_rtos.h is an interface of At-RTOS kernel. You can check the interface usage in this file to perform it in your embedded controller system.
The following sample codes illustrate how to create your first thread:
/* Include the At-RTOS interface's header file. */
#include "at_rtos.h"
/* Define a thread hook to specific the stack size and prioriy of the thread */
OS_THREAD_DEFINE(defined_thread, 1024, 7); // Set the thread stack size to 1024 bytes and the schedule prioriy level to 7.
/* User thread's entry function. */
static void the_thread_entry_function(void)
{
while(1) {
os.thread_sleep(1000u);
}
}
/* The main routine */
int main(void)
{
/* Initialize the your your thread. */
os_thread_id_t id = os.thread_init(defined_thread, the_thread_entry_function);
if (os.id_isInvalid(id)) {
printf("Thread %s init failed\n", id.pName);
}
/* The At-RTOS kernel schedule starts to run. */
os.schedule_run();
RUN_UNREACHABLE();
}
The following kernel H file path must be included in your project workshop.
<root path>\
<root path>\include\
<root path>\include\kernel\
The following kernel C file should be placed in your project workshop based on your chip feature and compiler.
<root path>\kernel\<all of them>.c
<root path>\clock\clock_systick.c
<root path>\port\port_common.c
<root path>\port\<your compiler>.c
The At-EC road-map documentation is not ready. The At-RTOS is a beginning and basic component and will be an important member of the At-EC family.
The contributing documentation is not ready, You can check the open issue right now that we're developing.
The At-RTOS is completely open-source, can be used in commercial applications for free, does not require the disclosure of code, and has no potential commercial risk. License information and copyright information can generally be seen at the beginning of the code:
/**
* Copyright (c) Riven Zheng (zhengheiot@gmail.com).
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
**/
The MIT License is here.