In this exercise, you will execute assembly code using the Keil MDK, and examine its execution at the processor level.

This exercise is adapted from the Efficient Embedded Systems Education Kit .

Please make sure to read and go through the Getting Started with MDK documentation or Learning Path if you are unfamiliar with its usage.

The example can run on any supported development platform. Instructions are provided for the Nucleo-F401RE development board from ST Microelectronics as well as the Cortex-M3 Virtual Hardware Target (VHT) supplied with MDK Professional Edition.

Set up project for Nucleo-F401RE

CMSIS Packs

Open the CMSIS Pack Installer and install/update the necessary CMSIS Packs for the STM32F401 and Nucleo boards.

Image Alt Text:CMSIS-Pack

Close the Pack installer and return to the uVision IDE.

Create project

Go to Project > New uVision Project, and create a project.

Image Alt Text:New Project

A window will show up requesting you to select the target device for the project. select STM32F401RE, as shown in this image:

Image Alt Text:TargetBoard

Configure project

Next, you will be required to select software components/packages that you wish to include in your project.

Add CMSIS > Core, and Device > Startup.

Image Alt Text:SoftwareComponents

Your project should now look like this:

Image Alt Text:ProjectExplorer

Next you need to configure some options for the target. Select the Options for target icon shown below.

Image Alt Text:TargetOptions

Then under the C/C++ tab set the Language C option to c99 and the Optimization level to -O1.

Image Alt Text:TargetOptions

Also, under the Debug tab, set the debugger to ST-Link Debugger.

Image Alt Text:TargetOptions

You are ready to start writing the program.

Set up project for Cortex-M3 VHT

CMSIS Packs

Open the CMSIS Pack Installer and install/update the necessary CMSIS Packs for the ARM > Cortex-M3 > CMSDK_CM3_VHT target.

Close the Pack installer and return to the uVision IDE.

Create project

Go to Project > New uVision Project, and create a project.

A window will show up requesting you to select the target device for the project. select ARM > Cortex-M3 > CMSDK_CM3_VHT. Click OK.

Configure project

Next, you will be required to select software components/packages that you wish to include in your project.

Add CMSIS > Core, and Device > Startup. Click OK to save.

Select the Options for target icon.

Under the C/C++ tab set the Language C option to c99 and the Optimization level to -O1.

Under the Debug tab, set the debugger to Models Cortex-M Debugger.

Click the Settings button, and the Command > ... button. Browse to the ARM/VHT folder of your Keil MDK installation, and select VHT_MPS2_Cortex-M3.exe.

Click OK to save, and again to close the Options view.

You are ready to start writing the program.

Back
Next