The sixth course module examines using software libraries and application programming interfaces (APIs) to increase program development efficiency. Libraries also allow modular programming and improve hardware portability. This module looks specifically at the mbed Platform and CMSIS Library for use with the Cortex-M processors.
The mbed platform provides both open software libraries and open hardware designs to aid prototyping and development of applications and systems based on Arm Cortex-M microcontrollers. The mbed SDK provides a standards based C/C++ SDK along with an online IDE and compiler. The mbed SDK is built on the low-level ARM CMSIS APIs which allow precise program control of the hardware.
Lab4 Exercise - Programming Using mbed API
This exercise requires that you have an account with mbed.org so that you can use their online tools. Once you create an account and login, you then have access to the mbed IDE. You need to register the specific device that you are using.
Then you have access to a number of sample programs. We are using the Blinky LED template for this lab.
Here is the finished code in the IDE showing the higher level constructs versus the register level code that we used previously in the Keil MDK. If the compile is successful a binary file is downloaded to your computer and you can then just drag and drop it to the F401RE mass storage device and the flashing occurs automatically.
The second part of the lab has you export the code to a Keil MDK project. This allows you to use the mbed libraries with the Keil IDE. The lab exercise is to create an Interrupt version of the Blinky program. Again, the code shows the higher level constructs relative to the previous register level version.
I did have a couple of issues with the project exported from the mbed IDE. The Scatter File for the linker had an incorrect path and the Flash memory size was not set, but once I fixed those issues I successfully compiled and executed the program. I must admit that using the libraries saves a lot of time not having to search through the Reference Manual.