Skip to content

Commit ef0e835

Browse files
committed
OpenPicoRTOS: initial release
1 parent eb09697 commit ef0e835

File tree

141 files changed

+11914
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+11914
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ modules.order
5050
Module.symvers
5151
Mkfile.old
5252
dkms.conf
53+
54+
# documentation
55+
docs/*

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Contributing to picoRTOS
2+
3+
In order to contribute to picoRTOS, here are the steps to follow:
4+
5+
## Step 1
6+
7+
Make your port in the corresponding arch subdirectory. It must provide at least 3
8+
files :
9+
- picoRTOS_types.h
10+
- picoRTOS_port.c
11+
- picoRTOS_portasm.S (or any asm extension required by your compiler)
12+
13+
The reason for this assembly file is not to mix C and assembly language, as it makes
14+
the static analysis difficult if not impossible.
15+
16+
Don't use inline assembly, especially with parameters.
17+
The ASM macro is tolerated if stubbed to allow error-free splint analysis.
18+
19+
## Step 2
20+
21+
Provide a demo for your board in the demo subdirectory. This will serve as a basic
22+
test for your port. A blink test is usually more than enough.
23+
If you provide support for atomic operations, try to use IPCs in your demo, too.
24+
25+
Your code should build with no errors and no warnings.
26+
27+
## Step 3
28+
29+
Add a splint target for your new arch to the root Makefile.
30+
Your code must pass the static analysis with zero errors and zero warnings.
31+
32+
If you use any external libraries or SDKs, the calls must be stubbed and the defines
33+
re-defined (wrapped in ifdefs) to allow splint to do its job properly.
34+
35+
## Step 4
36+
37+
Unless you spot a real bug or see a huge improvement to be made, don't touch to the
38+
common code (picoRTOS.c, picoRTOS-SMP.c and ipc/, notably).
39+
Any modification in these files will affect all ports, and you shouldn't make your
40+
port work at the expense of others.
41+
42+
## Step 5
43+
44+
run ./uncrustify at the root of the project to ensure your code complies with
45+
the coding standard.
46+
47+
On some systems, depending on your version, uncrustify will affect some common header
48+
files like picoRTOS.h and ipc/picoRTOS_cond.h. Please don't commit them.
49+
50+
## Step 6
51+
52+
Commit on your fork (in a dedicated branch) and make a pull request.
53+
54+
## Final word
55+
56+
I understand these guidelines might seem extremely severe, potentially starving this
57+
project from talents, but they are here to garantee error-free software.
58+
59+
This is extremely important in safety critical applications for which this RTOS
60+
has been designed in the first place.

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Helps uncrustifying and generating documentation
2+
3+
uncrustify:
4+
find . -name "*.[ch]" -exec uncrustify -c \
5+
etc/uncrustify.cfg \
6+
--replace --no-backup {} +
7+
8+
naturaldocs:
9+
naturaldocs -i . -xi docs \
10+
-p etc/naturaldocs \
11+
-o HTML docs
12+
13+
.PHONY: uncrustify naturaldocs

README.md

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,128 @@
1-
# OenPicoRTOS
1+
# OpenPicoRTOS [![Latest Release](https://img.shields.io/github/release-date/jnaulet/OpenPicoRTOS)](https://img.shields.io) [![Commits since](https://img.shields.io/github/commits-since/jnaulet/OpenPicoRTOS/latest/v1.5.x)](https://img.shields.io)
2+
3+
Very small, lightning fast, yet portable preemptive RTOS with SMP suppport.
4+
5+
## Presentation
6+
7+
picoRTOS is a teeny tiny RTOS with as little overhead as humanely possible.
8+
9+
## Documentation
10+
11+
HTML documentation of the complete API is available in the documentation directory and
12+
at the following address: https://jnaulet.github.io/OpenPicoRTOS
13+
14+
## Supported architectures
15+
16+
### Single core
17+
18+
- ARM Cortex-M0+
19+
- ARM Cortex-M3
20+
- AVR6
21+
- AVR5
22+
23+
### Multi-core SMP
24+
- RP2040 SMP
25+
26+
### Simulation
27+
28+
- POSIX threads / Linux
29+
- WIN32 threads / Windows
30+
31+
## Featured devices
32+
33+
- Atmel ATMega2560
34+
- Atmel ATMega328P
35+
- Atmel ATSAM3X8E
36+
- Raspberry Pico RP2040
37+
38+
## Working principle
39+
40+
On every new schedule (tick) task 0 is executed first.
41+
Any call to a sleeping function (picoRTOS_schedule, picoRTOS_sleep or
42+
picoRTOS_sleep_until) will allow the scheduler to move to the next task until
43+
it reaches idle or a new tick occurs and the cycle starts over.
44+
45+
To increase speed and predictability, every task is identified by its exclusive
46+
level of priority, no round robin support is offered.
47+
48+
No memory management is offered, everything is static, which makes the static analyzer's
49+
job much easier for critical applications.
50+
51+
## Advanced features
52+
53+
IPCs are available to architectures that support the correct associated atomic operations.
54+
A small infringement has been made to the hard real time philosophy of the project by supporting
55+
the CONFIG_ARCH_EMULATE_ATOMIC on platforms that don't support native atomic operations. This is
56+
not recommended, though.
57+
58+
### The following IPCs are provided:
59+
60+
- futexes (require arch_test_and_set)
61+
- re-entrant mutexes (require arch_compare_and_swap)
62+
- conditions (require mutexes)
63+
- queues (doesn't require atomic ops)
64+
65+
## Interrupt management
66+
67+
Version 1.5 introduces contextual interrupt management as an experimental feature.
68+
69+
All architectures are supported (at least partially) at the moment.
70+
71+
This feature should be used with care, as interrupts tend to destroy the real-time part in
72+
"RTOS".
73+
74+
## How to use
75+
76+
Copy the picoRTOS directory in your project.
77+
78+
Create a picoRTOSConfig.h file in the include path of your project.
79+
80+
Sample configs are available for every supported archs in arch/x/y/samples and in the
81+
demo directory.
82+
83+
Then, add the relevant arch files to your build using the provided devices build files.
84+
85+
Example for ATMega2560:
86+
87+
PICORTOS_DIR := ./picoRTOS
88+
-include $(PICORTOS_DIR)/devices/atmel/atmega2560/Makefile.in
89+
90+
IPCs are not in the build files by default, you need to add them manually to your build:
91+
92+
INCLUDE += -I$(PICORTOS_DIR)/ipc
93+
SRC_C += $(PICORTOS_DIR)/ipc/picoRTOS_futex.c
94+
95+
---
96+
97+
Code-wise, using picoRTOS is quite straightforward :
98+
99+
#include "picoRTOS.h"
100+
101+
void main(void)
102+
{
103+
picoRTOS_init();
104+
105+
struct picoRTOS_task task0;
106+
struct picoRTOS_task task1;
107+
static picoRTOS_stack_t stack0[CONFIG_DEFAULT_STACK_COUNT];
108+
static picoRTOS_stack_t stack1[CONFIG_DEFAULT_STACK_COUNT];
109+
...
110+
111+
picoRTOS_task_init(&task0, task0_main, &task0_context, stack0, CONFIG_DEFAULT_TASK_COUNT);
112+
picoRTOS_task_init(&task1, task1_main, &task1_context, stack1, CONFIG_DEFAULT_TASK_COUNT);
113+
...
114+
115+
picoRTOS_add_task(&task0, TASK0_PRIO);
116+
picoRTOS_add_task(&task1, TASK1_PRIO);
117+
...
118+
119+
picoRTOS_start();
120+
}
121+
122+
Hint: tasks are converted to internal structures in picoRTOS_add_task and can be local
123+
but stacks need to be persistant (prefer static to globals to reduce scope).
124+
125+
## Demo
126+
127+
Some demo code is available under the demo directory for every supported architecture
128+
so you can see for yourself if this software suits your needs.

RELEASE_NOTES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Release notes
2+
3+
## picoRTOS v1.5.4
4+
### What's new ?
5+
6+
picoRTOS is back ! Version 1.5.3 has seen the project being retired for professionnal use, so this
7+
one is a brand new architecture that has been re-written from the ground up.
8+
9+
Unfortunately older users of picoRTOS on PowerPC and C2000 cannot update because despite similar
10+
user interfaces, the port API has been fundamentally rewritten and is not compatible anymore.
11+
12+
Anyway, some features left us, but new features have been added, like "dynamic" priority assignment,
13+
syscalls, queues and much more.
14+
15+
picoRTOS is now safer, faster and more complete, enjoy !

0 commit comments

Comments
 (0)