Skip to content

Getting started with Keil

Introduction

For programming your target device in the different codelabs, we will be using a specific setup consisting of a ARM Keil Microntroller Development Kit (MDK) and an STM F32L475VG Cortex-M4-based board

What you’ll build

In this codelab, you will get started with your first ARM Keil program through a simple example: blinking LED

What you’ll learn

  • How to set up a development environment
  • Getting familiar with the eval board and the ARM Keil MDK used in this course

What you’ll need

  • A Windows environment for installing ARM Keil MDK for developing and debugging C/C++ code snippets.
  • An internet connection and a computer with USB connectivity.
  • Some prior basic knowledge of C/C++ programming.
  • Curiosity and motivation to get things working.

Installation of required software components

  • First of all, under sharepoint state what your github username is so as to have access to the example used to ensure the environment is working correctly
  • Subsequently, head to ST page to get the up-to-date USB Driver and install it. Good practice requires you to reboot the machine after the installation.

Note

You do not need to create an ST account but you need to provide an email when you download a piece of SW/document.

  • Head to the ARM Keil MDK page to fetch the evaluation version of the programme. Make sure you:

    • Respond to the questions correctly, as indicated below
    • Once you the installer is launched, make sure you install the Core part as indicated below:

    Warning

    Really make sure Core is installed directly under C: - failing to do so will result in a non-working installation.

    • After the installation, the package manager will be started. You should ensure you install the necessary board as per pictures below
    • You are done! Move on to the next section now.

Note

In later sessions we will instruct you how to get a real license instead of a demo version.

Getting your hands dirty

If you have reached this point, it means the above dependencies are tackled. Now go ahead and:

  • Hook up the eval board (if it is not working, make sure the driver is correctly installed)
  • Clone the blinky project and open it with ARM Keil. You should see something like this:
  • Compile the project (use either F7 or the icon with 1 arrow)
  • Download the resulting application to your board (LOAD icon) - you should get a blinking green LED on your board!
  • Play with the different functions (debugging, clean, …)
  • Understand what the statements in Blinky.c do

CRITICAL: One more thing

In order to prepare future lessons, we need you to head over to sharepoint and enter:

  • your first name
  • your family name
  • your email address
  • github username
  • the MAC address of your machine where the ARM Keil SW is running
  • the SSH fingerprint of the machine where the ARM Keil SW is running - have a sensible digital hygiene
  • find a group partner (size of the group = 2) and pick a team name out of the 8 options

Attention

Failing to comply with the above instructions will impact the work during the next codelabs. Make sure you fill in the needed information.

Fixing issues

This section contains some hints about fixing certain, known issues you may encounter - it is not meant to be the full list though. Hopefully, you will not need it at all.

Issues loading the application

It may be that you do struggle with downloading the built image. Prior to flashing the firmware anew, you may want to try the following:

  • Under the Debug tab of the Options menu, click on Settings of the ST Link Debugger (see image below) ST-Link Config 1
  • Change the setting Connect from Normal to under Reset and try again ST-Link Config 2
  • If it is working, you can probably change Connect to Normal ST-Link Config 3

Updating the target - only if NEEDED!

It can be that your target is too new (or too old) and the connectivity is not working. In that case you should:

  • Download the updating SW (Board Firmware STSW-LINK007) on ST homepage.
  • Verify that the USB cable is correctly connected on the right connector
  • « Unzip » the file you just downloaded, READ THE readme.txt and start the programme.
  • You should see : ST-Link Upgrade 1
  • Click on Open in update mode
  • By default, the ST-LINK/V2 interface of your card implements a USB disk. While this may be handy, it generates a notification every time you unplug the board. As a result, you can skip this by desactivating the corresponding option by clicking onto Change Type and selecting without Mass storage : ST-Link Upgrade 1
  • Click Upgrade to finalize:
  • At the end of the procedure the program should indicate Upgrade successful and you can thus quit the SW.

Attention

It may be that certain programs do need the Mass storage option. This is mainly the case with stlink tools under Linux. Should this be the case, reactive the Mass storage option and check whether the issue is solved.