40
CHAPTER 7
The generic CMSIS start project
7.1 The generic CMSIS start project
The folder
Start\BoardSupport\CMSIS
contains a generic CMSIS start project that should
run on any ARMv7-M core. The subfolder
DeviceSupport\
contains the device specific
source and header files which have to be replaced by the device specific files of the vendor
to make the CMSIS sample start project device specific.
7.2 Device specific files needed for embOS with
CMSIS
•
Device.h
: Contains the device specific exception and interrupt numbers and
names. embOS needs the Cortex-M generic exception numbers
PendSV_IRQn
and
SysTick_IRQn
, as well as the exception names
PendSV_Handler
and
SysTick_Handler
,
which are vendor independent and common for all devices. The sample file delivered
with embOS does not contain any peripheral interrupt vector numbers and names as
those are not needed by embOS. To make the embOS CMSIS sample device specific
and allow usage of peripheral interrupts, this file has to be replaced by the one which
is delivered from the CPU vendor.
•
System_Device.h
: Declares at least the two required system timer functions which are
used to initialize the CPU clock system and one variable which allows the application
software to retrieve information about the current CPU clock speed. The names of the
clock controlling functions and variables are defined by the CMSIS standard and are
therefore identical in all vendor specific implementations.
•
System_Device.c
: Implements the core specific functions to initialize the CPU, at least
to initialize the core clock. The sample file delivered with embOS contains empty
dummy functions and has to be replaced by the vendor specific file which contains the
initialization functions for the core.
•
Startup_Device.s
: The startup file which contains the initial reset sequence and
contains exception handler and peripheral interrupt handler for all interrupts. The
handler functions are declared weak, so they can be overwritten by the application which
implements the application specific handler functionality. The sample which comes with
embOS only contains the generic exception vectors and handler and has to be replaced
by the vendor specific startup file.
Startup code requirements:
The reset handler must call the
SystemInit()
function which is delivered with the core
specific system functions. When using an ARMv7 CPU which may have a VFP floating point
unit equipped, please ensure that the reset handler activates the VFP and VFP support
is selected in the project options. When VFP support is not selected, the VFP should not
be switched on. Otherwise, the
SystemInit()
function delivered from the device vendor
should also honor the project settings and enable the VFP or keep it disabled according the
project settings. Using CMSIS compliant startup code from the chip vendors may require
modification if it enables the VFP unconditionally.
7.3 Device specific functions/variables needed for
embOS with CMSIS
The embOS system timer is triggered by the Cortex-M generic system timer. The correct
core clock and pll system is device specific and has to be initialized by a low level init function
called from the startup code. embOS calls the CMSIS function
SysTick_Config()
to set up
the system timer. The function relies on the correct core clock initialization performed by
the low level initialization function
SystemInit()
and the value of the core clock frequency
which has to be written into the
SystemCoreClock
variable during initialization or after
calling
SystemCoreClockUpdate()
.
•
SystemInit()
: The system init function is delivered by the vendor specific CMSIS library
and is normally called from the reset handler in the startup code. The system init
embOS-MPU for Cortex-M and IAR
© 2010-2020 SEGGER Microcontroller GmbH