You are on page 1of 8

BEFORE STARTING WITH THE DSP LIB

CONFIGURATION OF KEIL µVISION IDE AND CYPRESS FM4 BOARD

KEIL µVISION IDE OVERVIEW

To start developing code, communicating with the Cypress FM4 board (FME-176L-S6E2CC-ETH Starter Kit) and
running programs on the microcontroller, a suitable development environment must first be installed.

Keil MDK-ARM is an Integrated Development Environment (IDE) for Cortex™-M, Cortex-R4, ARM7™ and
ARM9™processor-based devices, which allows the user to build a project easily and quickly.

The IDE includes:

 Project management
 Make facilities
 Source code editor
 Program debugger
 Simulation functions

Keil µVision integrates a number of ARM-based tools, including:

 Compiler
 Assembler
 Linker
 Format Converter
 Libraries

DOWNLOAD AND INSTALLATION

The latest version of MDK-ARM v5 is available for download at https://www.keil.com/download/product/

Follow the link, complete the form and download the latest version of the Keil software development tools.

The program comes by default with a free evaluation licence, MDK_Lite (32KB) Edition, which limits code size to 32
Kbytes. This is sufficient to run the DSP Lab-in-a-Box examples and exercises, however a full MDK-ARM licence is
included in the DSP Lab-in-a-Box.

After installing and launching the program, you can easily upgrade your licence by selecting License
Management... from the File menu and adding the appropriate code into the New License ID Code (LIC) field.
INSTALLATION

To install the program, run the executable file mdk_5xx.exe and follow the instructions. If you already have
MDK-ARM installed on your PC, be aware that this Lab-in-a-Box makes use of some features that are not available
in MDK v4 or older. You may need to upgrade to MDK v5.

Double-click mdk_5xx.exe and the installation process will start. You will be asked where to install the program and
packs. We strongly recommend installing to the default destinations as this DSP LiB refers to the default install
directory. If you change the root folder of the installation, the paths will not match.

Figure 1: Default installation folder

During installation you may be asked if you also want to install the Serial Bus Controller. It is important to install all
the prompted drivers. This ensures correct communication between the PC and the microcontroller device via
USB. If this window doesn't appear it is because you already have the correct driver installed on your computer.

Figure 2: Serial Bus drivers

After installing, run the program. A Welcome to Keil Pack Installer window may appear, in which case click OK. The
Pack Installer is a utility for installing, updating and removing software packs. If it does not open automatically,
select Manage and Pack Installer... from the Project menu.
Figure 3: Pack Installer

On the right hand side of the Pack Installer window you can select a device, and on the left hand side software
packs available for that device are displayed. You can install or update a software pack by clicking in the Action
column.

In the Device window, select Spansion (Cypress) – FM4 Series – S6E2CC – S6E2CCAJ0A. Then, install or update the
following software packs:

 ARM::CMSIS
 Keil::MDK-Middleware
 Keil::FM4_DFP

The Pack Installer window should appear as shown in figure 3, with all three software packs Up to date.

Close the Pack Installer window.

If you wish to upgrade MDK-ARM to a fully licensed product, select License Management... from the File menu
and add the appropriate code into the New License ID Code (LIC) field.
RUN A DSP LIB LAB

This section explains how to use the materials provided as part of the DSP LiB to start testing the lab example
programs or to build your own projects for the Cypress FM4 board. The process of creating a project from scratch
is explained later in this document. This process is, however, time-intensive and it’s easy to make a mistake during
the process. For this reason several ready-made projects are provided by the DSP LiB.

To start running one of the labs or testing any of the examples:

 Open the Digital Signal Processing Lab-in-a-Box Index.


 From this menu you can download all the LiB documents. Click on the Lab Code button in the first module.
 In a pop-up window you will be asked you what you want to do with file LAB_1.zip. Choose Save File.

Figure 4: Pop-up window during download of LAB_1 materials.

 Extract the contents of file LAB_1.zip to any location (e.g. your Documents folder). The contents of that
folder should then appear as shown in figure 6.

Figure 5: Extracted contents of LAB_1 project folder.


 Open the folder and open the µVision5 Project file DSP_LiB.

Figure 6: µVision Project window

 µVision 5 will open and you should see a project structure similar to that shown in figure 7. If it looks different
check you have unzip the whole content of the folder DSP_LiB without modifying the content and all the
needed packs are updated.
 Press on the top menu Project – Rebuild all target files to compile the project. You can see on the Build
Output window that it compiles without any error. In other programs, some warning can appear if the
program doesn’t make use of some of the defined variables, but this is not a problem at all.
 Finally start a Debug Session and press the run button or download the program into the microcontroller
flash memory and restart it by pushing the reset button on the board.

The program is now running.

Plug headphones into the CN5 jack socket and a microphone into the CN11 socket on the board and you should be
able to hear the audio picked up by the microphone.

To test another program you only need to replace the source file.

 Right-click the current source file and select Remove File.


 Then, right-click on src, select Add Existing File to Group ‘src’ and add the next program you want to test.
You can found all the programs inside the folder src. Don’t add more than one program at once.

To test your own program, replace the source file for a new one.

 Right-click the current source file and select Remove File.


 Then, right-click on src, select Add New Item to Group ‘src’. Chose C File and the Name and Add to the
project. You can write your own program here from scratch. Alternatively you can modify one of the
provided programs.
CREATE A NEW PROJECT

To make our own projects, we can either copy one of the examples and modify it, or create a new one.

To create a new project from scratch open, Keil µVision and select from the top menu project – New µVision
project and chose the name and location of the new project. Then you have to select your device from a list. Note
that if you haven’t installed the package of your device with the Pack Installer, your device will not appear on the
list. Select Spansion – FM4 Series – S6E2CC – S6E2CCAJ0A

Figure 7: Select device window

INCLUDE THE LIB API

Now you can see in your Project window that the Target 1 folder has been created (you can change the name of
this folder), but there is nothing inside. First we want to include all the needed auxiliary files as peripheral drivers
or headers.

Figure 8: Empty project structure


The programs in this DSP Lab-in-a-Box make use of some files included in KEIL as the CMSIS maths library which
provides optimized floating point mathematical functions, and some auxiliary files for the correct configuration of
the Core and initialization of the board, and some drivers provided with the DSP LiB to control the microcontroller
peripheral modules.

To include the KEIL files, open the Manage Run-Time Environment by pressing on the top menu Project > Manage
>Run Time Environment. In this window you can see all the available auxiliary files for your platform and they will
be automatically included in your project by selecting them. Select CORE and DSP from CMSIS and Startup from
device and press OK.

To include the drivers first add a new group into the Target. Then, right-click on it, select Add Existing File to Group
and add the ones you may need. You can find them into any LAB, inside the drivers folder.

Don’t forget to include the source files.

CONFIGURATION

Before running the program you need to configure the Target Options.

Right click on Target 1 > Options for Target ‘Taget1’ will open the configuration window for your project.

C/C++ TAB

In the C/C++ tab we need change the Code Optimization to Level 3.

Also, in the Include Paths area you need to browse and add the folder that contains the drivers header files,
needed for they correctly function. If you include other auxiliary files that make use of header files, you need to
include their path here too.

Figure 9: C/C++ Configuration window


DEBUG TAB

We need to inform the debugger that we want to use the CMSIS-DAP Debugger.

Figure 10: Debugger configuration

Then click on Setting next to the debugger list.

- In the Debug tab, select Port: JTAG and Max Clock: 1MHZ on the Debug Adapter area.
- In the Flash Download tab, add the S6E2CC Macro#0 1024KB Flaxh programming algorithm.

Figure 11: Flash Downloader configuration

Now the project is ready to be compiled and downloaded into the microcontroller. You only need to do this
configuration process once as the configuration parameters will be saved.

For further information visit http://www.keil.com/support/

You might also like