Skip to content

Commit df0cb07

Browse files
authored
Update documentation: rework examples section (#98)
* Update documentation: rework examples section - examples are now in csolution format - section for Cortex-A example is removed (#70)
1 parent 92f4016 commit df0cb07

9 files changed

Lines changed: 136 additions & 47 deletions

DoxyGen/src/cmsis_freertos.txt

Lines changed: 136 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ expose proprietary source code, and has
1515
<a target="_blank" href="https://www.freertos.org/differences-between-officially-supported-and-contributed-FreeRTOS-code.html">no IP infringement</a>
1616
risk.
1717

18-
<a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/index.html"><b>CMSIS-RTOS v2</b></a> is a common API for real-time
18+
<a href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/index.html"><b>CMSIS-RTOS v2</b></a> is a common API for real-time
1919
operating systems (RTOS). It provides a standardized programming interface that is portable to many RTOS and enables software
2020
components that can work across multiple RTOS systems. It supports the Armv8-M architecture, dynamic object creation, for
2121
multi-core systems, and has a binary compatible interface across ABI compliant compilers.
2222

2323
Using this software pack, users can choose between a native FreeRTOS implementation or one that is adhering to the
2424
CMSIS-RTOS2 API and using FreeRTOS under the hood. The CMSIS-RTOS2 API enables programmers to create portable application
2525
code to be used with different RTOS kernels (for example
26-
<a class="el" href="https://www2.keil.com/mdk5/cmsis/rtx/">Keil RTX5</a>).
26+
<a class="el" href="https://developer.arm.com/Tools%20and%20Software/Keil%20MDK/RTX5%20RTOS/">Keil RTX5</a>).
2727

2828
This documentation shows you:
2929
- how to \ref cre_freertos_proj "create a new microcontroller project" using FreeRTOS from scratch.
@@ -369,7 +369,7 @@ Definitions configEVR_LEVEL_x set the recording level bitmask for events generat
369369

370370
\section dbg_cmsisfreertos Debug a CMSIS-FreeRTOS project
371371

372-
\note The following only applies when used with <a href="https://www2.keil.com/mdk5" target="_blank">Arm Keil MDK</a>. If
372+
\note The following only applies when used with <a href="https://developer.arm.com/Tools%20and%20Software/Keil%20MDK" target="_blank">Arm Keil MDK</a>. If
373373
you are using a different toolchain, please consult its user's manual.
374374

375375
Apart from the debug capabilities that \ref cmsis_freertos_evr_config "Event Recorder" offers, Keil MDK also supports thread
@@ -385,8 +385,8 @@ BS \\Blinky\Blinky.c\FuncN1\179, 1, "break = (CURR_TID == tid_phaseA || CURR_TID
385385

386386
\note
387387
- For more information on conditional breakpoints in Keil MDK, consult the
388-
<a href="https://www.keil.com/support/man/docs/uv4/uv4_db_dbg_breakpnts.htm" target="_blank">user's manual</a>.
389-
- Enabling <a href="https://www.keil.com/support/man/docs/uv4/uv4_ui_view.htm" target="_blank">Periodic Window Update</a> is
388+
<a href="https://developer.arm.com/documentation/101407/latest/Debugging/Debug-Windows-and-Dialogs/Breakpoints-Window" target="_blank">user's manual</a>.
389+
- Enabling <a href="https://developer.arm.com/documentation/101407/latest/User-Interface/View-Menu" target="_blank">Periodic Window Update</a> is
390390
required to capture register values for active running threads while executing. When turned off, only the current FreeRTOS
391391
thread can be unwound after execution has been stopped.
392392

@@ -403,7 +403,7 @@ BS \\Blinky\Blinky.c\FuncN1\179, 1, "break = (CURR_TID == tid_phaseA || CURR_TID
403403
\endcode
404404

405405
- If you don't want to use
406-
<a href="https://www.keil.com/support/man/docs/uv4/uv4_ui_view.htm" target="_blank">Periodic Window Update</a>, obtain the
406+
<a href="https://developer.arm.com/documentation/101407/latest/User-Interface/View-Menu" target="_blank">Periodic Window Update</a>, obtain the
407407
thread and unwind information by adding a function that gets called from each thread of interest:
408408
\code
409409
_attribute_((noinline)) int FuncN1 (int n1) {
@@ -427,7 +427,7 @@ _attribute_((noinline)) int FuncN1 (int n1) {
427427
This helps to make thread aware breakpoints far less dependent on the compiler optimization level.
428428

429429
- Thread aware breakpoints should be setup using a
430-
<a href="https://www.keil.com/support/man/docs/uv4/uv4_db_scripting.htm" target="_blank">debug script</a>. Reason being
430+
<a href="https://developer.arm.com/documentation/101407/latest/Debugging/Debug-Scripting" target="_blank">debug script</a>. Reason being
431431
that thread aware breakpoints are of a 'hybrid' type, that is a combined address and condition expression that works best
432432
when run from a debug script.
433433
*/
@@ -438,69 +438,158 @@ when run from a debug script.
438438
\page examples Example projects
439439

440440
This pack contains two example projects:
441-
- \ref examples_native
442-
- \ref examples_cmsis
441+
- \ref example_hello
442+
- \ref example_trustzone
443443

444-
The first example shows how to use FreeRTOS standalone, whereas the second example shows how to use the CMSIS-RTOS2 API with
445-
an underlying FreeRTOS.
444+
The first example shows how to configure a simple application using FreeRTOS with CMSIS-RTOS2, whereas the second example
445+
shows how to use the FreeRTOS with CMSIS-RTOS2 in an application that utilizes TrustZone secure/non-secure execution.
446446

447-
The examples simulate a step-motor driver. Four phase variables are simulating the activation of the four output driver
448-
stages. The state changes are shown in the Watch window variable \c g_phases. All four phases are displayed in the Logic
449-
Analyzer:
447+
Provided examples use the
448+
[CMSIS Solution Project File Format](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/YML-Input-Format.md)
449+
and can be build for multiple Cortex-M targets
450+
- using [CMSIS Toolbox](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/README.md#cmsis-toolbox)
451+
either from the command line or
452+
- from Visual Studio Code by using
453+
[Arm Keil Studio Cloud extensions](https://developer.arm.com/documentation/108029/0000/?lang=en).
450454

451-
\image html blinky_example_simu.png
455+
The \b Examples solution defines projects and build information for each project.
452456

453457

454-
\section examples_native Blinky example using FreeRTOS natively
458+
\section build_run Build and Run
455459

456-
This example shows how to use FreeRTOS natively in a µVision project. This makes your code portable and you can
457-
choose to use a different RTOS kernel anytime during development (even only for evaluation purposes).
460+
The \b Examples solution supports only "Debug" Build-Type which is optimized for debugging. It disables
461+
compiler optimization and retains all debug related information. By default, Arm Compiler 6 is used to
462+
build the projects.
458463

459-
To open the example, go to Pack Installer, select \b ARM in the \b Devices tab, and click on \b Copy next to the
460-
<b>Native FreeRTOS Blinky (uVision Simulator)</b> project on the \b Examples tab. Select the location on your hard drive
461-
where you want to copy the project to and press OK. µVision opens.
464+
\subsection build_target_types Targets
462465

466+
Each example can be built for multiple target processors. The below table lists supported target processors
467+
together with the corresponding context target-types and model executable that shall be used for running
468+
the application image.
463469

464-
\section examples_cmsis Blinky example using CMSIS-FreeRTOS
470+
| Target processor | Target-Type | Model Executable |
471+
|:-----------------|:------------|:-----------------------|
472+
| Cortex-M0 | CM0 | FVP_MPS2_Cortex-M0 |
473+
| Cortex-M0+ | CM0plus | FVP_MPS2_Cortex-M0plus |
474+
| Cortex-M3 | CM3 | FVP_MPS2_Cortex-M3 |
475+
| Cortex-M4 | CM4 | FVP_MPS2_Cortex-M4 |
476+
| Cortex-M7 | CM7 | FVP_MPS2_Cortex-M7 |
477+
| Cortex-M23 | CM23 | FVP_MPS2_Cortex-M23 |
478+
| Cortex-M23 | CM23_noTZ | FVP_MPS2_Cortex-M23 |
479+
| Cortex-M33 | CM33 | FVP_MPS2_Cortex-M33 |
480+
| Cortex-M33 | CM33_noTZ | FVP_MPS2_Cortex-M33 |
481+
| Cortex-M55 | CM55 | FVP_Corstone_SSE-300 |
482+
| Cortex-M55 | CM55_noTZ | FVP_Corstone_SSE-300 |
483+
| Cortex-M85 | CM85 | FVP_Corstone_SSE-310 |
484+
| Cortex-M85 | CM85_noTZ | FVP_Corstone_SSE-310 |
465485

466-
This example shows how to use the CMSIS-RTOS2 API with an underlying FreeRTOS. This makes your code portable and you can
467-
choose to use a different RTOS kernel anytime during development (even only for evaluation purposes).
486+
\subsection build_vscode Build in VS Code using Arm Keil Studio Pack extensions
468487

469-
To open the example, go to Pack Installer, select \b ARM in the \b Devices tab, and click on \b Copy next to the
470-
<b>CMSIS-RTOS2 FreeRTOS Blinky (uVision Simulator)</b> project on the \b Examples tab. Select the location on your hard drive
471-
where you want to copy the project to and press OK. µVision opens.
488+
- See [Arm Keil Studio Visual Studio Code Extensions User Guide](https://developer.arm.com/documentation/108029/0000/?lang=en)
489+
for more information about using the Keil Studio extensions.
490+
- Search for [Arm Keil Studio Pack](https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack)
491+
in the Visual Studio Marketplace to download the extensions.
472492

493+
To build a project using Keil Studio extensions open CMSIS view, open "Manage CMSIS Solution" view and select
494+
"Active Context" and "Active Projects". Build Type is automatically selected since there is only
495+
one option.
473496

474-
\section examples_cmsis_a9 Blinky example using CMSIS-FreeRTOS running on Arm Cortex-A9
497+
Once the context and projects are selected one can build them by selecting "Build" in CMSIS view.
475498

476-
This example shows how to use the CMSIS-RTOS2 API with an underlying FreeRTOS running on an NXP i.MX6 equipped with an Arm
477-
Cortex-A9 code. This example only works in <a href="https://www.keil.com/mdk5/ds-mdk">DS-MDK</a>, the Eclipse-based
478-
development environment from Arm. For information on setting up the target connection, please refer to
479-
<a href="https://www2.keil.com/mdk5/ds-mdk/imx6sxsabrereference">NXP i.MX 6SoloX SABRE Reference</a>.
499+
\subsection build_cmdline Build via command line
480500

481-
\note you need to have the i.MX6 device family pack installed to see the example in the \b Examples tab of Pack Installer.
501+
- See [CMSIS-Toolbox documentation](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/README.md)
502+
to learn more about CMSIS Solution project build and management tools.
482503

483-
To open the example, open the Pack Installer perspective, select \b NXP in the \b Devices tab, and click on \b Copy next to
484-
the <b>CMSIS-RTOS2 FreeRTOS Blinky CA9 (MCIMX6SX-SABRE)</b> project on the \b Examples tab.
504+
To build the project via command line one can use the following command syntax:
485505

486-
\image html copy_a9_example.png
506+
\code{.sh}
507+
cbuild Examples.csolution.yml --context <project-name>.<build-type>+<target-type>
508+
\endcode
487509

488-
Confirm the default location in the Eclipse Workspace by pressing Copy.
510+
To list the available contexts execute the following command:
489511

490-
\image html copy_a9_example_ws.png
512+
\code{.sh}
513+
cbuild list contexts Examples.csolution.yml
514+
\endcode
491515

492-
Right-click on the project and select \b Build \b Project. Then, right-click on the project and select \b Debug \b As and
493-
then \b Debug \b Configurations. The Debug Configurations dialog opens:
516+
\subsection example_exec Execute on Virtual Hardware Target
494517

495-
\image html dbg_conf.png
518+
[Arm Virtual Hardware Target](https://www.arm.com/products/development-tools/simulation/virtual-hardware)
519+
simulation models are used to execute the example application images.
496520

497-
The project is already set up for running from the SDRAM of the i.MX6 SABRE board. Press \b Debug. DS-MDK will switch to the
498-
debug perspective. After a successful connection to the target, press \b F8 to run the application. In the \b App \b Console
499-
you will see the output of the phases:
521+
To execute application image (axf or elf) on an simulation model use the following command syntax:
522+
\code{.sh}
523+
<model-executable> -f ./Target/<target_type>/fvp_config.txt -a ./out/<project>/<project>.axf
524+
\endcode
500525

501-
\image html dbg_output.png
502-
*/
503526

527+
\section example_hello Hello World
528+
529+
The <b>Hello World</b> application can be used as a starting point when developing new application. Using it, one can verify
530+
initial system setup and configuration.
531+
532+
The application is simple and shows how to use CMSIS-RTOS2:
533+
- how to initialize and start the RTOS kernel
534+
- how to create a new thread
535+
- how to retarget stdout
536+
537+
<b>Build via command line</b>
538+
539+
The following cbuild command may be used to build Hello World example project for Cortex-M3:
540+
\code{.sh}
541+
cbuild Examples.csolution.yml --context Hello.Debug+CM3 --update-rte
542+
\endcode
543+
544+
<b>Execute via command line</b>
545+
546+
To execute simulation model and run Hello World project executable for Cortex-M3 use the following command:
547+
\code{.sh}
548+
FVP_MPS2_Cortex-M3 -f ./Target/CM3/fvp_config.txt -a ./out/Hello/Hello.axf
549+
\endcode
550+
551+
When executed, application outputs the following to the serial terminal:
552+
553+
\image html hello_out.png
554+
(Press Ctrl + C to stop the simulation model.)
555+
556+
557+
\section example_trustzone TrustZone
558+
559+
The <b>TrustZone</b> application explains how to setup projects for booting and execution from TrustZone secure to non-secure
560+
domain and vice versa.
561+
562+
The application shows:
563+
- how to boot from the secure domain and switch the execution to the non-secure domain
564+
- how to create the interface functions between secure and non-secure domain
565+
- how to use the secure/non-secure interface functions
566+
567+
<b>Build via command line</b>
568+
569+
TrustZone example must always be build in two steps:
570+
571+
1. Build secure side project for Cortex-M55
572+
\code{.sh}
573+
cbuild Examples.csolution.yml --context TZ_Secure.Debug+CM55 --update-rte
574+
\endcode
575+
576+
2. Build non-secure side project for Cortex-M55
577+
\code{.sh}
578+
cbuild Examples.csolution.yml --context TZ_NonSecure.Debug+CM55 --update-rte
579+
\endcode
580+
581+
<b>Execute via command line</b>
582+
583+
To execute simulation model and run TrustZone project executable for Cortex-M55 use the following command:
584+
\code{.sh}
585+
FVP_Corstone_SSE-300 -f ./Target/CM55/fvp_config.txt -a ./out/TZ_NonSecure/TZ_NonSecure.axf -a ./out/TZ_Secure/TZ_Secure.axf
586+
\endcode
587+
588+
When executed, application outputs the following to the serial terminal:
589+
590+
\image html trustzone_out.png
591+
(Press Ctrl + C to stop the simulation model.)
592+
*/
504593

505594
/*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
506595
/**
@@ -539,7 +628,7 @@ The following list briefly describes the limitations and unsupported features of
539628
\section td_validation Validation suite results
540629

541630
CMSIS provides a
542-
<a target="_blank" href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/html/rtosValidation.html">CMSIS-RTOS2 validation suite</a> that can
631+
<a target="_blank" href="https://arm-software.github.io/CMSIS_6/latest/RTOS2/rtosValidation.html">CMSIS-RTOS2 validation suite</a> that can
543632
be used to test a real-time operating system for compliance to the standard. The test suite has been executed successfully on the
544633
CMSIS-FreeRTOS implementation (<a href="cmsis_rtos2_validation.txt">see results</a>).
545634

DoxyGen/src/images/a9_ws.png

-73.9 KB
Binary file not shown.
-75.1 KB
Binary file not shown.
-100 KB
Binary file not shown.
-7.97 KB
Binary file not shown.

DoxyGen/src/images/dbg_conf.png

-47.7 KB
Binary file not shown.

DoxyGen/src/images/dbg_output.png

-99 KB
Binary file not shown.

DoxyGen/src/images/hello_out.png

14.4 KB
Loading
21.3 KB
Loading

0 commit comments

Comments
 (0)