Professional Documents
Culture Documents
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.
Project management
Make facilities
Source code editor
Program debugger
Simulation functions
Compiler
Assembler
Linker
Format Converter
Libraries
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.
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.
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.
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.
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.
µ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.
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.
To test your own program, replace the source file for a new one.
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
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.
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.
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
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.
We need to inform the debugger that we want to use the CMSIS-DAP Debugger.
- 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.
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.