Skip to content

Add CMSIS-RTOS documentation #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2017
Merged

Conversation

bulislaw
Copy link
Member

Document CMSIS-RTOS and RTX usage in mbed OS.

Should be merged after ARMmbed/mbed-os#4294

@AnotherButler could you please have a look

Copy link
Contributor

@AnotherButler AnotherButler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bulislaw I've left four queries for you. Would you like me to make my grammar edits directly to your PR, or would you like me to leave them in comment form for you to make?

@@ -0,0 +1,77 @@
# CMSIS & RTX

CMSIS/RTX code is imported from the original CMSIS repository which can be found: https://github.com/ARM-software/CMSIS_5/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: Who or what does the importing? Please clarify.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMSIS/RTX is a separate repository (also owned by ARM). We take code from this external repo and import it in mbed OS codebase. Every now and again we will import new version of the code.


## Configuration

mbed OS changes to RTX configuration are all maintained in a single file: `mbed-os/rtos/rtx2/mbed_rtx_conf.h`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: Who or what maintains these changes? Please clarify.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do. The point is not to change configuration options in different places of mbed OS as we used to do it, but have one central file where all of the default changes are made.


#### Other

* irq_cm0.s is used for both M0 and M0P cores in mbed OS for all toolchains
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: Who or what uses irq_cm0.s? Please clarify.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mbed OS is using these files for M0/M0P boards. The point i wanted to make is that there's one original file, with name suggesting it's for M0 only, but in reality we use it for both type of cores.

rtx_os.h | Doxygen added; added per-thread uVisor context |
irq_cm4.s | For all toolchains: added case for Cortex M4 cores without VFP |
svc_user.c | Removed as it's template file and should not be in our code base |
rt_OsEventObserver.{c,h} | Added an interface for uVisor to get notified about certain events from privileged code |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: Is the Description column a description of what the filename does? If so, could you please reword the Description column to be in present tense [such as "Adds Doxygen" instead of "Doxygen added"]? If not, could you please clarify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of the 'Changes' section, 'description' column documents what changes we (mbed OS) made to the original code imported from external repository.

Copy link
Member Author

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that! Sounds better now :)


## Memory considerations

Please note that mbed OS doesn't use any of the RTX memory models, which are based on static carveouts (memory pools). This approach is not ideal for generic system like mbed OS as calculating required numbers of RTOS objects is impossible. To avoid declaring arbitrary large buffers, carved out on compile time, limiting amount of available memory, mbed OS shifts the responsibility of supplying the backing memory to CMSIS-RTOS2 users.
Please note that mbed OS doesn't use any of the RTX memory models, which are based on static carveouts (memory pools). This approach is not ideal for generic system, such as mbed O,S because calculating required numbers of RTOS objects is impossible. To avoid declaring arbitrary large buffers, carved out on compile time, limiting amount of available memory, mbed OS shifts the responsibility of supplying the backing memory to CMSIS-RTOS2 users.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O,S because


Therefore developers will need to use mbed OS RTOS C++ API or supply backing memory for RTX objects to `os*New` calls when using CMSIS-RTOS2 APIs directly (please consult CMSIS-RTOS2 documentation for API details). `mbed_rtos_storage.h` header provides handy wrappers that can be used to secure required memory without exposing the code to RTX implementation details.
Therefore developers need to use the mbed OS RTOS C++ API or supply backing memory for RTX objects to `os*New` calls when using CMSIS-RTOS2 APIs directly. (Please consult CMSIS-RTOS2 documentation for API details.) `mbed_rtos_storage.h` header provides handy wrappers that you can use to secure required memory without exposing the code to RTX implementation details.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directly. (Please consult CMSIS-RTOS2 documentation for API details.) I think the dot should be on the other side of the bracketed bit, as it refers to the CMSIS-RTOS2 rather than mbed_rtos_storage.h


## Code structure

Due to differences in how mbed OS and CMSIS directory structures look like, we can't import the original code directly, some directory changes are necessary:
Due to differences in how the mbed OS and CMSIS directory structures look, you can't import the original code directly. Some directory changes are necessary:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a big deal, but it's not about the users, it's about the maintainers (us). This import is done, and may be needed to be done in the future to update CMSIS (external component) version.

@@ -51,6 +51,7 @@ Due to different use cases between mbed OS and CMSIS, we had to make some modifi
Filename | Description |
---------|-------------|
`cmsis_compiler.h` | Added IAR missing __ALIGNED attribute for earlier (less than 7.8.4) versions |
``cmain.S`` | custom IAR non-rtos boot sequence for mbed |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change "non-rtos" to "non-RTOS" for consistent capitalization.


## Memory considerations

Please note that mbed OS doesn't use any of the RTX memory models, which are based on static carveouts (memory pools). This approach is not ideal for generic system, such as mbed O,S because calculating required numbers of RTOS objects is impossible. To avoid declaring arbitrary large buffers, carved out on compile time, limiting amount of available memory, mbed OS shifts the responsibility of supplying the backing memory to CMSIS-RTOS2 users.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generic system => generic systems or a generic system
mbed O,S => mbed OS,
carved out on compile time => carved out at compile time
limiting amount of available memory => limiting the amount of available memory


Please note that mbed OS doesn't use any of the RTX memory models, which are based on static carveouts (memory pools). This approach is not ideal for generic system, such as mbed O,S because calculating required numbers of RTOS objects is impossible. To avoid declaring arbitrary large buffers, carved out on compile time, limiting amount of available memory, mbed OS shifts the responsibility of supplying the backing memory to CMSIS-RTOS2 users.

Therefore developers need to use the mbed OS RTOS C++ API or supply backing memory for RTX objects to `os*New` calls when using CMSIS-RTOS2 APIs directly. (Please consult CMSIS-RTOS2 documentation for API details.) `mbed_rtos_storage.h` header provides handy wrappers that you can use to secure required memory without exposing the code to RTX implementation details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference is to avoid starting a paragraph with "Therefore"

Filename | Description |
---------|-------------|
`cmsis_compiler.h` | Added IAR missing __ALIGNED attribute for earlier (less than 7.8.4) versions |
``cmain.S`` | custom IAR non-RTOS boot sequence for mbed |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong number of ` should be one.

`svc_user.c` | Removed as its template file and should not be in our code base |
`rt_OsEventObserver.{c,h}` | Added an interface for uVisor to be notified about certain events from privileged code |

#### Other
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be on the same level as RTX: 3*#

@AnotherButler
Copy link
Contributor

@bulislaw Once y'all resolve the comments from @theotherjimmy, could you please add the missing "t" in "documentation" in the subject line? If you'd like me to, I can also make that change for you. Just let me know. Thanks so much.

@bulislaw bulislaw changed the title Add CMSIS-RTOS documenation Add CMSIS-RTOS documentation May 25, 2017
@bulislaw
Copy link
Member Author

Should be fixed now.

@AnotherButler AnotherButler changed the base branch from 5.4 to 5.5 June 12, 2017 15:18
@AnotherButler
Copy link
Contributor

@bulislaw Is it OK if I move this to the 5.5 docs branch, which I just created?

@AnotherButler
Copy link
Contributor

@theotherjimmy Is this OK to merge?

@theotherjimmy
Copy link
Contributor

yes

@AnotherButler AnotherButler merged commit 82eb986 into ARMmbed:5.5 Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants