-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,67 @@ | ||
TNeoKernel: a real-time kernel | ||
============== | ||
|
||
TNeoKernel was born as a thorough review and re-implementation of TNKernel. The new kernel has well-formed code, inherited bugs are fixed as well as new features being added, and it is tested carefully with unit-tests. | ||
TNeoKernel is a compact and fast real-time kernel for the embedded 32/16 bits | ||
microprocessors. It performs a preemptive priority-based scheduling and a | ||
round-robin scheduling for the tasks with identical priority. | ||
|
||
TNeoKernel was born as a thorough review and re-implementation of TNKernel. The new kernel has well-formed code, inherited bugs are fixed as well as new features being added, it is well documented and tested carefully with unit-tests. | ||
|
||
Currently it is available for PIC32 only, but will probably be ported to other architectures. Tested on PIC32MX. | ||
|
||
Comprehensive documentation is available in two forms: | ||
|
||
* [TNeoKernel documentation (html)](http://goo.gl/Ywpvjk) | ||
* [TNeoKernel documentation (pdf)](http://goo.gl/XWCvQz) | ||
|
||
Documentation is generated by means of [doxygen](http://goo.gl/RQHRYr). | ||
* [Latest stable TNeoKernel (html)](http://goo.gl/bwyAxZ) | ||
* [Latest stable TNeoKernel (pdf)](http://goo.gl/d9W9HE) | ||
|
||
Note: the project is in BETA stage for now. This means that API still may change. I have plans to get it out of BETA until december, 2014. | ||
|
||
-------------- | ||
Index of all docs available can be found [here](http://goo.gl/HJFOqe). | ||
|
||
#Overview | ||
|
||
* Fixed a lot of bugs of original TNKernel, see below (especially with mutexes and associated priority algorithms) | ||
* Tested by detailed unit tests | ||
* Separate stack for interrupts | ||
* Nested interrupts are supported | ||
* Shadow register set interrupts are supported | ||
* Recursive mutexes (optionally) | ||
* No timer task, so, system tick processing works much faster and takes less RAM | ||
Documentation is generated by means of [doxygen](http://goo.gl/RQHRYr). | ||
|
||
This project was initially a fork of PIC32 TNKernel port by Anders Montonen: [TNKernel-PIC32](https://github.com/andersm/TNKernel-PIC32 "TNKernel-PIC32"). I don't like several design decisions of original TNKernel, as well as **many** of the implementation details, but Anders wants to keep his port as close to original TNKernel as possible. So I decided to fork it and have fun implementing what I want. | ||
----------------------------------------------------------------------------- | ||
|
||
The more I get into how TNKernel works, the less I like its code. There is a lot of code duplication and a lot of inconsistency, all of this leads to bugs. So I decided to rewrite it almost completely, and that's what I'm doing now. | ||
This project was initially a fork of [PIC32 TNKernel | ||
port](https://github.com/andersm/TNKernel-PIC32) by Anders Montonen. I don't | ||
like several design decisions of original TNKernel, as well as **many** of the | ||
implementation details, but Anders wants to keep his port as close to original | ||
TNKernel as possible. So I decided to fork it and have fun implementing what I | ||
want. | ||
|
||
I decided not to care much about compatibility with original TNKernel API because I really don't like several API decisions, so, I actually had to choose new name for this project, in order to avoid confusion, hence "TNeoKernel". You can read about differences from original TNKernel at the wiki page: [Differences from original TNKernel](/dfrank/tneokernel/wiki/diff_orig_tnkernel) | ||
The more I get into how TNKernel works, the less I like its code. It appears as | ||
a very hastily-written project: there is a lot of code duplication and a lot of | ||
inconsistency, all of this leads to bugs. More, TNKernel is not documented well | ||
enough and there are no unit tests for it, so I decided to reimplement it almost | ||
completely. Refer to the page [Why reimplement TNKernel](http://dfrank.bitbucket.org/tneokernel_api/latest/html/why_reimplement.html) for details. | ||
|
||
Together with almost totally re-writting TNKernel, I'm implementing detailed unit tests for it, to make sure I didn't break anything, and of course I've found several bugs in original TNKernel. Several of them: | ||
I decided not to care much about compatibility with original TNKernel API | ||
because I really don't like several API decisions, so, I actually had to choose | ||
new name for this project, in order to avoid confusion, hence "TNeoKernel". | ||
Refer to the [Differences from TNKernel API](http://dfrank.bitbucket.org/tneokernel_api/latest/html/tnkernel_diff.html) page for details. | ||
|
||
* If low-priority `task_low` locks mutex M1 with priority inheritance, high-priority `task_high` tries to lock mutex M1 and gets blocked -> `task_low`'s priority elevates to `task_high`'s priority; then `task_high` stops waiting for mutex by timeout -> priority of `task_low` remains elevated. The same happens if `task_high` is terminated by `tn_task_terminate()`; | ||
* If low-priority task `task_low1` locks mutex M1 with priority inheritance, another task `task_low2` with the same priority tries to lock M1 and gets blocked, then high-priority task `task_high` tries to lock M1 and gets blocked (priority of `task_low1` becomes equal to priority of `task_high`). Now, `task_low1` unlocks M1 -> priority of `task_low1` returns to base value, `task_low2` locks M1 (because it is the next task in the mutex's queue), and its priority should be elevated to priority of `task_high`, but it doesn't happen. | ||
* `tn_mutex_delete()` : if mutex is not locked, `TERR_ILUSE` is returned. I believe task should be able to delete non-locked mutex; | ||
* if task that waits for mutex is in `WAITING_SUSPENDED` state, and mutex is deleted, `TERR_NO_ERR` is returned after returning from `SUSPENDED` state, instead of `TERR_DLT` | ||
* `tn_sys_tclice_ticks()` : if wrong param is given, `TERR_WRONG_PARAM` is returned and interrupts remain disabled. | ||
Together with almost totally re-writing TNKernel, I've implemented detailed | ||
[unit tests](http://dfrank.bitbucket.org/tneokernel_api/latest/html/unit_tests.html) for it, to make sure I didn't break anything, and of course I've found several bugs in original TNKernel 2.7: refer to the section [Bugs of TNKernel 2.7](http://dfrank.bitbucket.org/tneokernel_api/latest/html/why_reimplement.html#why_reimplement__bugs). Unit tests are, or course, a "must-have" for the project like this; it's so strange bug original TNKernel seems untested. | ||
|
||
I'm rewriting it in centralized and consistent way, and test it carefully by unit tests, which are, of course, must-have for project like this. It's so strange but original TNKernel seems untested. | ||
Note that PIC32-dependent routines (such as context switch and so on) are | ||
originally implemented by Anders Montonen; I examined them in detail and | ||
changed several things which I believe should be implemented differently. | ||
Anders, great thanks for sharing your job. | ||
|
||
Note that PIC32-dependent routines (such as context switch and so on) are originally implemented by Anders Montonen; I examined them in detail and changed several things which I believe should be implemented differently. Anders, great thanks for sharing your job. | ||
Another existing PIC32 port, [the one by Alex | ||
Borisov](http://www.tnkernel.com/tn_port_pic24_dsPIC_PIC32.html), also affected | ||
my project a bit. In fact, I used to use Alex's port for a long time, but it | ||
has several concepts that I don't like, so I had to move eventually. | ||
Nevertheless, Alex's port has several nice ideas and solutions, so I didn't | ||
hesitate to take what I like from his port. Alex, thank you too. | ||
|
||
Another existing PIC32 port, [the one by Alex Borisov](http://www.tnkernel.com/tn_port_pic24_dsPIC_PIC32.html), also affected my project. In fact, I used to use Alex's port for a long time, but it has several concepts that I don't like, so I had to move eventually. Nevertheless, Alex's port has several nice ideas and solutions, so I didn't hesitate to take what I like from his port. Alex, great thanks to you too. | ||
And, of course, great thanks to the author of original TNKernel, Yuri Tiomkin. | ||
Although the implementation of TNKernel is far from perfect in my opinion, the | ||
ideas behind the implementation are generally really nice (that's why I decided | ||
to reimplement it instead of starting from scratch), and it was great entry | ||
point to the real-time kernels for me. | ||
|
||
And, of course, great thanks to the author of original TNKernel, Yuri Tiomkin. Although the implementation of TNKernel is far from perfect in my opinion, the ideas behind the implementation are generally really nice (that's why I decided to reimplement it instead of starting from scratch), and it was great entry point to the real-time kernels for me. | ||
I would also like to thank my chiefs in the [ORION](http://orionspb.ru/) | ||
company, Alexey Morozov and Alexey Gromov, for being flexible about my time. | ||
|
||
#Wiki contents | ||
For comprehensive information, refer to the documentation (see links at the top of this page) | ||
|
||
* [Building the project](/dfrank/tneokernel/wiki/building) | ||
* [PIC32 port implementation details](/dfrank/tneokernel/wiki/pic32_details) | ||
* [Differences from original TNKernel](/dfrank/tneokernel/wiki/diff_orig_tnkernel) | ||
* [Differences from the port by Alex Borisov](/dfrank/tneokernel/wiki/diff_alexb_tnkernel) | ||
* [Why refactor?](/dfrank/tneokernel/wiki/why_refactor) | ||
* [License](/dfrank/tneokernel/wiki/license) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters