Segger embOS-MPU Manuale utente

2
Disclaimer
Specifications written in this document are believed to be accurate, but are not guaranteed to
be entirely free of error. The information in this manual is subject to change for functional or
performance improvements without notice. Please make sure your manual is the latest edition.
While the information herein is assumed to be accurate, SEGGER Microcontroller GmbH (SEG-
GER) assumes no responsibility for any errors or omissions. SEGGER makes and you receive no
warranties or conditions, express, implied, statutory or in any communication with you. SEGGER
specifically disclaims any implied warranty of merchantability or fitness for a particular purpose.
Copyright notice
You may not extract portions of this manual or modify the PDF file in any way without the prior
written permission of SEGGER. The software described in this document is furnished under a
license and may only be used or copied in accordance with the terms of such a license.
© 2010-2020 SEGGER Microcontroller GmbH, Monheim am Rhein / Germany
Trademarks
Names mentioned in this manual may be trademarks of their respective companies.
Brand and product names are trademarks or registered trademarks of their respective holders.
Contact address
SEGGER Microcontroller GmbH
Ecolab-Allee 5
D-40789 Monheim am Rhein
Germany
Tel. +49 2173-99312-0
Fax. +49 2173-99312-28
E-mail: [email protected]
Internet: www.segger.com
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

3
Manual versions
This manual describes the current software version. If you find an error in the manual or a
problem in the software, please inform us and we will try to assist you as soon as possible.
Contact us for further information on topics or functions that are not yet documented.
Print date: February 3, 2020
Software Revision Date By Description
5.8.2.1 0 200203 TS New software version.
5.8.2.0 0 200106 TS Chapter “MPU support” updated.
5.8.0.0 0 191030 TS Chapter “MPU support” updated.
5.02 0 180629 MC New software version.
4.30 0 161202 TS New software version.
4.26.1 0 160928 MC New software version.
4.26 0 160908 MC First version.
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

4
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

5
About this document
Assumptions
This document assumes that you already have a solid knowledge of the following:
• The software tools used for building your application (assembler, linker, C compiler).
• The C programming language.
• The target processor.
• DOS command line.
If you feel that your knowledge of C is not sufficient, we recommend The C Programming Lan-
guage by Kernighan and Richie (ISBN 0--13--1103628), which describes the standard in C pro-
gramming and, in newer editions, also covers the ANSI C standard.
How to use this manual
This manual explains all the functions and macros that the product offers. It assumes you have
a working knowledge of the C language. Knowledge of assembly programming is not required.
Typographic conventions for syntax
This manual uses the following typographic conventions:
Style Used for
Body Body text.
Keyword Text that you enter at the command prompt or that appears on
the display (that is system functions, file- or pathnames).
Parameter Parameters in API functions.
Sample Sample code in program examples.
Sample comment Comments in program examples.
Reference Reference to chapters, sections, tables and figures or other doc-
uments.
GUIElement Buttons, dialog boxes, menu names, menu commands.
Emphasis Very important sections.
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

6
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

7
Table of contents
1 Using embOS ................................................................................................................9
1.1 Installation .................................................................................................. 10
1.2 First Steps .................................................................................................. 11
1.3 The example application OS_StartLEDBlink.c ................................................... 12
1.4 Stepping through the sample application .........................................................13
2 Build your own application ..........................................................................................17
2.1 Introduction .................................................................................................18
2.2 Required files for an embOS ..........................................................................18
2.3 Change library mode .................................................................................... 18
2.4 Select another CPU ...................................................................................... 18
3 Libraries .......................................................................................................................19
3.1 Naming conventions for prebuilt libraries ........................................................ 20
4 CPU and compiler specifics ........................................................................................21
4.1 Standard system libraries ..............................................................................22
4.2 Thread-safe system libraries ..........................................................................22
4.3 Thread-Local Storage TLS ............................................................................. 24
4.4 ARM erratum 837070 ................................................................................... 26
5 Stacks ......................................................................................................................... 27
5.1 Task stack for Cortex-M ................................................................................ 28
5.2 System stack for Cortex-M ............................................................................28
5.3 Interrupt stack for Cortex-M ..........................................................................28
6 Interrupts .....................................................................................................................29
6.1 What happens when an interrupt occurs? ........................................................30
6.2 Defining interrupt handlers in C ..................................................................... 30
6.3 Interrupt vector table ................................................................................... 30
6.4 Interrupt-stack switching .............................................................................. 31
6.5 Zero latency interrupts ................................................................................. 31
6.6 Interrupt priorities ........................................................................................31
6.7 Interrupt nesting ..........................................................................................32
6.8 Interrupt handling API .................................................................................. 34
7 CMSIS .........................................................................................................................39
7.1 The generic CMSIS start project .................................................................... 40
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

8
7.2 Device specific files needed for embOS with CMSIS .......................................... 40
7.3 Device specific functions/variables needed for embOS with CMSIS ...................... 40
7.4 CMSIS generic functions needed for embOS with CMSIS ................................... 41
7.5 Customizing the embOS CMSIS generic start project ........................................ 41
7.6 Adding CMSIS to other embOS start projects .................................................. 41
7.7 Interrupt and exception handling with CMSIS .................................................. 43
7.7.1 Enable and disable interrupts ............................................................. 43
7.7.2 Setting the Interrupt priority .............................................................. 43
8 VFP support ................................................................................................................44
8.1 Vector Floating Point support ......................................................................... 45
9 MPU support ...............................................................................................................46
9.1 Introduction .................................................................................................47
9.2 Supervisor call .............................................................................................47
9.3 Fault exceptions ........................................................................................... 47
9.4 Alignment ....................................................................................................47
9.5 Memory Attributes ........................................................................................48
9.5.1 Modifying memory attributes of default task regions .............................. 49
9.6 Cache maintenance ...................................................................................... 49
9.7 Changing memory attributes for privileged tasks ..............................................49
9.8 OS_MPU_ExtendTaskContext() ....................................................................... 50
9.9 MPU types ...................................................................................................50
9.10 Buffer for MPU sanity check .........................................................................50
9.11 Cortex-M XN bit (Execute Never) ................................................................. 51
9.12 Further information .................................................................................... 51
10 RTT and SystemView ...............................................................................................52
10.1 SEGGER Real Time Transfer .........................................................................53
10.2 SEGGER SystemView .................................................................................. 54
11 Technical data ...........................................................................................................55
11.1 Memory requirements ................................................................................. 56
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

Chapter 1
Using embOS
This chapter describes how to start with and use embOS. You should follow these steps to
become familiar with embOS.
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH

10 CHAPTER 1 Installation
1.1 Installation
embOS is shipped as a zip-file in electronic form.
To install it, proceed as follows:
Extract the zip-file to any folder of your choice, preserving the directory structure of this
file. Keep all files in their respective sub directories. Make sure the files are not read only
after copying.
Assuming that you are using an IDE to develop your application, no further installation
steps are required. You will find many prepared sample start projects, which you should
use and modify to write your application. So follow the instructions of section First Steps
on page 11.
You should do this even if you do not intend to use the IDE for your application development
to become familiar with embOS.
If you do not or do not want to work with the IDE, you should: Copy either all or only the
library-file that you need to your work-directory. The advantage is that when switching to
an updated version of embOS later in a project, you do not affect older projects that use
embOS, too. embOS does in no way rely on an IDE, it may be used without the IDE using
batch files or a make utility without any problem.
embOS-MPU for Cortex-M and IAR © 2010-2020 SEGGER Microcontroller GmbH
Indice


















