41
CHAPTER 7
CMSIS generic functions needed for embOS with
CMSIS
function has to initialize the core clock and has to write the CPU frequency into the
global variable SystemCoreClock.
•
SystemCoreClock
: Contains the current system core clock frequency and is initialized
by the low level initialization function
SystemInit()
during startup. embOS for CMSIS
relies on the value in this variable to adjust its own timer and all time related functions.
Any other files or functions delivered with the vendor specific CMSIS library may be
used by the application, but are not required for embOS.
7.4 CMSIS generic functions needed for embOS with
CMSIS
The embOS system timer is triggered by the Cortex-M generic system timer which has
to be initialized to generate periodic interrupts in a specified interval. The configuration
function
SysTick_Config()
for the system timer relies on correct initialization of the core
clock system which is performed during startup.
•
SystemCoreClockUpdate()
: This CMSIS function has to update the
SystemCoreClock
variable according the current system timer initialization. The function is device specific
and may be called before the SystemCoreClock variable is accessed or any function
which relies on the correct setting of the system core clock variable is called. embOS
calls this function during the hardware initialization function
OS_InitHW()
before the
system timer is initialized.
•
SysTick_Config()
: This CMSIS generic function is declared an implemented in the
core_cm*.h
file. It initializes and starts the SysTick counter and enables the SysTick
interrupt. For embOS it is recommended to run the SysTick interrupt at the second
lowest preemption priority. Therefore, after calling the
SysTick_Config()
function
from
OS_InitHW()
, the priority is set to the second lowest preemption priority ba a
call of
NVIC_SetPriority()
. The embOS function
OS_InitHW()
has to be called after
initialization of embOS during main and is implemented in the
RTOSInit*.c
file.
•
SysTick_Handler()
: The embOS timer interrupt handler, called periodically by the
interrupt generated from the SysTick timer. The
SysTick_Handler
is declared weak
in the CMSIS startup code and is replaced by the embOS
Systick_Handler
function
implemented in
RTOSInit*.c
which comes with the embOS start project.
•
PendSV_Handler()
: The embOS scheduler entry function. It is declared weak in the
CMSIS startup code and is replaced by the embOS internal function contained in
the embOS library. The embOS initialization code enables the
PendSV
exception and
initializes the priority. The application
MUST NOT
change the
PendSV
priority.
7.5 Customizing the embOS CMSIS generic start
project
The embOS CMSIS generic start project should run on every ARMv7-M CPU. As the generic
device specific functions delivered with embOS do not initialize the core clock system and
the PLL, the timing is not correct, a real CPU will run very slow. To run the sample project
on a specific CPU, replace all files in the
DeviceSupport\
folder by the versions delivered
by the CPU vendor. The vendor and CPU specific files should be found in the CMSIS release
package, or are available from the core vendor. No other changes are necessary on the
start project or any other files.
To run the generic CMSIS start project on an ARMv6-M, you have to replace the embOS
libraries with libraries for ARMv6-M and have to add the specific vendor files.
7.6 Adding CMSIS to other embOS start projects
All CPU specific start projects are fully CMSIS compatible. If required or wanted in the
application, the CMSIS files for the specific CPU may be added to the project without any
modification on existing files. Note that the
OS_InitHW()
function in the RTOSInit file ini-
embOS-MPU for Cortex-M and IAR
© 2010-2020 SEGGER Microcontroller GmbH
Содержание embOS-MPU
Страница 4: ...4 embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 6: ...6 embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 21: ...Chapter 4 CPU and compiler specifics embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 44: ...Chapter 8 VFP support embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...