You will primarily use Keil MDK through this Learning Path. If you are using Arm Development Studio refer to the appropriate comments.
This Learning Path is written for the supplied (Cortex-M4) Fixed Virtual Platform (FVP), however it could be run on any of the 9000+ devices supported by CMSIS-Pack .
If you are using the FVP, there is no need to install an additional CMSIS-Pack.
If using a different platform, click on Pack Installer
icon, browse for your device, and install any suggested Device Specific pack.
Add required CMSIS-Packs
via the CMSIS Pack Manager
perspective.
In the MDK menu, navigate to Project
> New uVision Project
, and create a new project (recommend to locate in a new folder).
When creating the project navigate to File
> New
> Project...
> C/C++
> C Project
.
Then select CMSIS C/C++ Project
, using Arm Compiler for Embedded 6
.
You will then be prompted to Select Device
for your project. A list of all devices with their CMSIS-Packs installed will be shown.
For this example, select Arm
> Arm Cortex-M4
> ARMCM4
.
You will first be presented with the Manage Run-Time Environment
dialog, which allows you to specify the CMSIS software components that will be used in the project.
Under CMSIS
, select CORE
, as well as RTOS2 (API)
> Keil RTX5
, in Library
form.
Under Device
, select Startup
(C Startup
).
These are the minimal components needed for such an application. Click OK
.
Run-time environment is managed by the .rteconfig
file within the project.
A project can contain many targets, which refer to the platform that a particular build will run on. The default name is Target 1
. To give a meaningful name, click Manage Project Items
, and rename the target (for example, to FVP
), as well as optionally the Source Group 1
(to Source
) that will contain the source code. Arranging code in these folders allows for easy sharing across different target builds.
Default Configuration
names are Debug
and Release
.
Name and other settings (see below) are managed in Project Properties
(Alt+Enter
), under C/C++ Build
> Settings
.
Click Options for Target
, to open that dialog. This is where build and other settings can be made.
Navigate to the Debug
tab, and select Models Cortex-M Debugger
from the Use
pull-down list. Click Settings
, then the Command
browse (...
) button, to locate the Cortex-M4 FVP
within your Keil MDK installation (ARM\FVP\MPS2_Cortex-M
folder). Click OK
.
Ignore this step for now. Debug configuration will be set up later.
Navigate to C/C++ (AC6)
tab, and (optionally) change optimization level to -O2
for high performance code.
You may also wish to disable Warnings, change language options, or other settings.
Use scatter-loading to define the memory map to the linker.
The memory map for the FVP is given in the documentation .
Navigate to the Linker
tab, and de-select Use Memory Layout from Target Dialog
(as you shall create your own).
Click the browse (...
) button and create a text file in the same folder as the project. Click Edit
to open the file in the IDE. The following is a typical scatter file for the FVP.
LOAD 0x0 0x400000 {
ROOT 0x0 0x400000 {
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO) }
RAM 0x20000000 0x40000 {
.ANY (+RW +ZI) }
ARM_LIB_HEAP 0x20040000 EMPTY 0x10000 {}
ARM_LIB_STACK 0x20050000 EMPTY 0x10000 {}
}
The IDE recognizes .sct
files as scatter files, and provides a graphical representation of the layout in a Memory Map
tab.