The third course module introduces the Arm Cortex-M4 Processor Architecture that is used for the STM32F401 processor on the development board included with the course. This course module also has the first lab and goes through installation of the required software tools and libraries.
The Cortex-M4 Processor combines high performance with low power consumption - making it ideal for IoT type applications.
Keil MDK Installation
The Keil MDK (Microcontroller Development Kit) is the design environment used to build and deploy the firmware for the development board. It includes a project manager, editor, compiler, debugger, and the required component libraries.
There is always a learning curve associated with using new programs and tools - even just the installation, so I had a few hiccups in the process.
My first problem was sort of funny. The instructions in the lab indicated "You can find all of the files associated with this lab in the Resources section of the Main Menu". Being new to using the VitalSource environment it took me a while to figure out where the Resources section was located (it's opened with the paper clip icon in the course window). Once you locate the Resource list you can download all of the associated lab material.
My next problem was with the the STLink installation that is required for USB connection to the the development board. I followed the installation instructions and downloaded and installed the driver but it would not detect the ST-Link device.
For some reason, the ST-LinkUpgrade.exe program that was included with Keil_v5 was not updating my USB driver. I had to go to the Keil website and download the STM32 ST-LINK utility, STM32 ST-LINK Utility v4.4.0 setup.exe.
This new program updated the USB driver and I was able to see the STLink port in Device Manager and connect to the board.
The board firmware was not the latest version, so I upgraded it.
The rest of the installation went without issues. I used the Pack Installer to load the libraries required for the hardware included in the course.
Lab Exercise - Compute Square Root Approximation
The lab exercise is intended to familiarize you with the with the mVision IDE. It also demonstrates integrating assembly code with C code.
The IDE is a familiar Windows GUI interface with dedicated windows for tasks like Project/File management, Code editing, Build and Error output.
I like the instructional format - a source code template is provided and the accompanying video walks you through the development and testing of the program. By use of the assembly code this lab provided insight into the operation of the device registers and the main and process stacks.
There are useful debug windows that allow you to view the registers, variables and there is a disassembly window to view the bare metal code.
Here's the view of the sqrt subroutine in the disassembly window:
In this lab the program was coded, built, and uploaded to the device. Then the debug interface was used to execute, break trap and single step while observing the variables and registers. A good start and I'm looking forward to the developing the IoT application (Weather Station).