-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #510 from ArmDeveloperEcosystem/main
Merge to production
- Loading branch information
Showing
22 changed files
with
1,044 additions
and
14 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
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
36 changes: 36 additions & 0 deletions
36
content/learning-paths/microcontrollers/context-switch-cortex-m/_index.md
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: Learn about context switching on Arm Cortex-M processors | ||
|
||
minutes_to_complete: 15 | ||
|
||
who_is_this_for: This is an introductory topic for software developers who would like to learn about context switching operations on Cortex-M processors in a bare-metal environment. | ||
|
||
learning_objectives: | ||
- Understand the basics of context switching | ||
- Learn how to program the Memory Protection Unit (MPU) | ||
- Learn how to use the SysTick exception with context switching operations | ||
- Build and run an example project with Arm Development Studio (Arm DS) | ||
|
||
prerequisites: | ||
- Basic knowledge and familiarity with Cortex-M processors. | ||
|
||
author_primary: Uma Ramalingam | ||
|
||
### Tags | ||
skilllevels: Introductory | ||
subjects: Performance and Architecture | ||
armips: | ||
- Cortex-M | ||
operatingsystems: | ||
- Baremetal | ||
tools_software_languages: | ||
- CMSIS | ||
- Coding | ||
- Arm Development Studio | ||
|
||
### FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
weight: 1 # _index.md always has weight of 1 to order correctly | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. | ||
--- |
36 changes: 36 additions & 0 deletions
36
content/learning-paths/microcontrollers/context-switch-cortex-m/_next-steps.md
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
# ================================================================================ | ||
# Edit | ||
# ================================================================================ | ||
|
||
next_step_guidance: > | ||
You can continue learning about other example projects available as a part of learn the architecture (M-Profile) user guides that will give more insights about Armv8-M architecture and its feature usage. | ||
# 1-3 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended. | ||
|
||
recommended_path: "/learning-paths/microcontrollers/tfm/" | ||
# Link to the next learning path being recommended. | ||
|
||
|
||
# further_reading links to references related to this path. Can be: | ||
# Manuals for a tool / software mentioned (type: documentation) | ||
# Blog about related topics (type: blog) | ||
# General online references (type: website) | ||
|
||
further_reading: | ||
- resource: | ||
title: Learn the Architecture - M-profile | ||
link: https://www.arm.com/architecture/learn-the-architecture/m-profile | ||
type: documentation | ||
- resource: | ||
title: Learn the Architecture - M-profile - Open source examples | ||
link: https://github.com/ARM-software/m-profile-user-guide-examples | ||
type: Open-source example projects | ||
|
||
# ================================================================================ | ||
# FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
weight: 21 # set to always be larger than the content in this path, and one more than 'review' | ||
title: "Next Steps" # Always the same | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
--- |
41 changes: 41 additions & 0 deletions
41
content/learning-paths/microcontrollers/context-switch-cortex-m/_review.md
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
# ================================================================================ | ||
# Edit | ||
# ================================================================================ | ||
|
||
# Always 3 questions. Should try to test the reader's knowledge, and reinforce the key points you want them to remember. | ||
# question: A one sentence question | ||
# answers: The correct answers (from 2-4 answer options only). Should be surrounded by quotes. | ||
# correct_answer: An integer indicating what answer is correct (index starts from 0) | ||
# explanation: A short (1-3 sentence) explanation of why the correct answer is correct. Can add additional context if desired | ||
|
||
|
||
review: | ||
- questions: | ||
question: > | ||
A SysTick timer is a 32-bit down counter. | ||
answers: | ||
- "True" | ||
- "False" | ||
correct_answer: 2 | ||
explanation: > | ||
SysTick timer is a 24-bit down counter in-built within Cortex-M processors. | ||
- questions: | ||
question: > | ||
The MPU regions of Cortex-M processors based of Armv8-M architecture can be programmed in: | ||
answers: | ||
- Privileged state only | ||
- Unprivileged state only | ||
- Both privileged and unprivileged states | ||
correct_answer: 1 | ||
explanation: > | ||
MPU registers can be programmed only in privileged state. | ||
# ================================================================================ | ||
# FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
title: "Review" # Always the same title | ||
weight: 20 # Set to always be larger than the content in this path | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
--- |
66 changes: 66 additions & 0 deletions
66
content/learning-paths/microcontrollers/context-switch-cortex-m/example.md
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
# User change | ||
title: Example Arm DS project for demonstrate context switching operations | ||
|
||
weight: 2 # 1 is first, 2 is second, etc. | ||
|
||
# Do not modify these elements | ||
layout: "learningpathall" | ||
--- | ||
There are a set of open source example projects that made available alongside the [Armv8-M Memory Model and MPU User Guide](https://developer.arm.com/documentation/107565/latest/). The source code for these example projects is available in the [GitHub repository](https://github.com/ARM-software/m-profile-user-guide-examples/tree/main/Memory_model/rtos_context_switch). | ||
|
||
This example demonstrates simple real-time kernel context switching operations between two threads using MPU regions that are available in Arm Cortex-M processors. | ||
You can build and run the example project using the versions of tools and software listed below: | ||
- [Arm Development Studio 2022.1](/install-guides/armds/) | ||
- [Arm Compiler for Embedded 6.18](/install-guides/armclang/) | ||
- [Fast Models Fixed Virtual Platforms (FVP) 11.18](/install-guides/fm_fvp/fvp/) | ||
- CMSIS 5.8.0 | ||
|
||
## Overview of the example code | ||
|
||
With this example you can create a very simple RTOS (Real Time Operating System) capable of dealing with context switching and thread isolation. For simplicity, only two threads, thread A and thread B, are created. | ||
|
||
Basic context switching and thread isolation requirements considered for this example are listed below: | ||
- Two isolated threads called thread A and thread B are created | ||
- Both thread A and thread B are executed in unprivileged mode. | ||
- Each thread has its own dedicated process stack. | ||
- The MPU regions are set up in a way such that the data and code corresponding to Thread A is not accessible to Thread B and vice versa. | ||
- A System Tick Timer (SysTick) generates regular SysTick exception as an interruption to switch between threads. | ||
- The SysTick handler acts as real-time kernel code and is responsible for context switching. The Systick handler is also responsible for MPU reprogramming which is needed for thread isolation. | ||
- The MPU regions for SysTick handler are set up in a way so that both threads cannot access the memory used by kernel code (i.e.) SysTick handler. | ||
More details about the algorithm and structure used in this example can be found in [Chapter: Use-Case-Examples of Armv8-M Memory Model and MPU User Guide](https://developer.arm.com/documentation/107565/0101/Use-case-examples/rtos-context-switch). | ||
|
||
## Build the example project | ||
|
||
You can build the example project with Arm Compiler for Embedded version 6.18 using the supplied Eclipse project. | ||
To import this project, follow the guidelines in the section [Import an existing Eclipse project in the Arm Development Studio Getting Started Guide](https://developer.arm.com/documentation/101469/2022-0/Projects-and-examples-in-Arm-Development-Studio/Importing-and-exporting-projects/Import-an-existing-Eclipse-project). | ||
|
||
To build the project within the Arm DS IDE: | ||
1. In the Project Explorer view, select the project you want to build. | ||
2. Select Project -> Build Project. | ||
|
||
## Run the example project | ||
|
||
The built executable from previous step can run on an Armv8-M FVP model supplied with Arm Development Studio. A ready to use launch configuration file `rtos_context_switch.launch` is provided with the example project. | ||
|
||
Follow the steps below to run the executable using this configuration: | ||
1. Select Run - Debug Configurations.... | ||
2. Select `rtos_context_switch` from the list of Generic Arm C/C++ Application configurations. | ||
3. Click on Debug to start debugging. The executable image will be downloaded to the target Armv8-M FVP model and the program counter is set to main. | ||
4. Run the executable (press F8). Text output appears in the target console view. | ||
|
||
## Output in target console | ||
|
||
You should see the following output in the target console view when you run this example: | ||
|
||
```output | ||
Pentagonal number: 2262 | ||
Pentagonal number: 2380 | ||
Pentagonal number: 2501 | ||
... | ||
Fibonacci number: 0 | ||
Fibonacci number: 1 | ||
Fibonacci number: 2 | ||
Fibonacci number: 3 | ||
``` | ||
You have now successfully run a bare-metal context switching application on an Arm Cortex-M target. |
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
37 changes: 37 additions & 0 deletions
37
content/learning-paths/servers-and-cloud-computing/arm_pmu/_index.md
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Learn how to access hardware counters using the Performance Monitoring Unit (PMU) | ||
|
||
minutes_to_complete: 90 | ||
|
||
who_is_this_for: This is an advanced topic for software developers who want to instrument hardware event counters in software applications. | ||
|
||
learning_objectives: | ||
- Understand different options for accessing event counters from user space | ||
- Use PAPI to instrument event counters in code | ||
- Call the Linux perf_event_open system call to instrument event counters in code | ||
- Write Arm assembly instructions to instrument event counters in code | ||
|
||
prerequisites: | ||
- An Arm computer running Linux. A bare metal or cloud metal instance is best because they expose more counters. A virtual machine (VM) can be used, but fewer counters may be available. | ||
|
||
author_primary: Julio Suarez | ||
|
||
### Tags | ||
skilllevels: Advanced | ||
subjects: Performance and Architecture | ||
armips: | ||
- Neoverse | ||
tools_software_languages: | ||
- PAPI | ||
- perf | ||
- Assembly | ||
- GCC | ||
operatingsystems: | ||
- Linux | ||
|
||
### FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
weight: 1 # _index.md always has weight of 1 to order correctly | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. | ||
--- |
39 changes: 39 additions & 0 deletions
39
content/learning-paths/servers-and-cloud-computing/arm_pmu/_next-steps.md
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
# ================================================================================ | ||
# Edit | ||
# ================================================================================ | ||
|
||
next_step_guidance: > | ||
Learn about migrating applications to Arm | ||
# 1-3 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended. | ||
|
||
recommended_path: "/learning-paths/servers-and-cloud-computing/migration/" | ||
# Link to the next learning path being recommended. | ||
|
||
|
||
# further_reading links to references related to this path. Can be: | ||
# Manuals for a tool / software mentioned (type: documentation) | ||
# Blog about related topics (type: blog) | ||
# General online references (type: website) | ||
|
||
further_reading: | ||
- resource: | ||
title: Linux perf_events documentation | ||
link: https://www.man7.org/linux/man-pages/man2/perf_event_open.2.html | ||
type: documentation | ||
- resource: | ||
title: PAPI documentation | ||
link: https://github.com/icl-utk-edu/papi/wiki | ||
type: documentation | ||
- resource: | ||
title: Perf | ||
link: https://en.wikipedia.org/wiki/Perf_%28Linux%29 | ||
type: documentation | ||
|
||
# ================================================================================ | ||
# FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
weight: 21 # set to always be larger than the content in this path, and one more than 'review' | ||
title: "Next Steps" # Always the same | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
--- |
55 changes: 55 additions & 0 deletions
55
content/learning-paths/servers-and-cloud-computing/arm_pmu/_review.md
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
# ================================================================================ | ||
# Edit | ||
# ================================================================================ | ||
|
||
# Always 3 questions. Should try to test the reader's knowledge, and reinforce the key points you want them to remember. | ||
# question: A one sentence question | ||
# answers: The correct answers (from 2-4 answer options only). Should be surrounded by quotes. | ||
# correct_answer: An integer indicating what answer is correct (index starts from 0) | ||
# explanation: A short (1-3 sentence) explanation of why the correct answer is correct. Can add additional context if desired | ||
|
||
|
||
review: | ||
- questions: | ||
question: > | ||
The performance monitoring unit (PMU) can be accessed from user space by default. | ||
answers: | ||
- "True" | ||
- "False" | ||
correct_answer: 2 | ||
explanation: > | ||
The register pmuserenr_el0 must be written to by EL1 (kernel) software before user space can access all the PMU system registers for configuring event counting. | ||
- questions: | ||
question: > | ||
Which of the following is not an option for accessing HW counters | ||
answers: | ||
- "PAPI" | ||
- "Assembly" | ||
- "Linux perf_events" | ||
- "top" | ||
correct_answer: 4 | ||
explanation: > | ||
Top is a tool that reports CPU utilization at the process level. | ||
- questions: | ||
question: > | ||
CPUs typically support a limited number of event counters. | ||
answers: | ||
- "True" | ||
- "False" | ||
correct_answer: 1 | ||
explanation: > | ||
Because counters take up area on a die, the number of counters supported is usually limited to 4-8. | ||
# ================================================================================ | ||
# FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
title: "Review" # Always the same title | ||
weight: 20 # Set to always be larger than the content in this path | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
--- |
Oops, something went wrong.