The MDK-Middleware examples are implemented as CMSIS-Toolbox Reference Applications that use CMSIS-Driver interfaces. These Reference Applications are hardware agnostic and need to be extended with a compatible board layer to run on a specific hardware target.
Several Board Support Packs (BSP) contain board layers that support the MDK-Middleware components. Refer to the Overview page of the pack to check the Provided connection API Interface of the layers. When such a board layer is not available, it is possible to create a compatible board layer.
The examples are provided as part of the MDK-Middleware pack and maintained as part of its GitHub repository, see Access to MDK-Middleware.
For detailed list of available examples and their detailed description, see the Examples section in the component documentation.
This chapter gives a generic overview on how to access, configure and build an MDK-Middleware example project for your target hardware.
This section explains how to use MDK-Middleware with the Arm CMSIS Solution for VS Code. This extension is for example part of Keil Studio.
An MDK-Middleware reference example can be selected in the Create a new solution dialog for boards with layers in the BSP.
Once the csolution project is loaded the VS Code IDE presents you with a dialog that lets you select a compatible software layer and a compiler toolchain that is available on your computer.
Notes:
- The Add Software Layer dialog only appears when the BSP contains a board layer with compatible API Interfaces (see next section).
- ST board layers are configured for the Arm Compiler (AC6) using CubeMX. However it is easy to reconfigure for different compilers. The steps are provided in the BSP overview.
The MDK Middleware reference applications are hardware agnostic but require API Interfaces that are expressed using the csolution project connections: node. The various reference applications consume the following API Interfaces. These interfaces should be provided by the board layer that is part of the Board Support Pack (BSP).
Consumed API Interface | Description |
---|---|
File System | . |
CMSIS_MCI | CMSIS-Driver MCI Interface to memory. |
STDIN, STDOUT | Standard I/O for user input/output via UART. |
Network | . |
CMSIS_Ethernet | CMSIS-Driver Ethernet MAC/PHY Interface. |
CMSIS_VIO | CMSIS-Driver VIO connected to LEDs and button |
STDOUT | Standard I/O connected for printf messages. |
USB Device | . |
CMSIS_USB_Device | CMSIS-Driver USB Device Interface. |
CMSIS_VIO | CMSIS-Driver VIO connected to LEDs and button |
CMSIS_USART | CMSIS-Driver USART for VirtualCOM project. |
USB Host | . |
CMSIS_USB_Host | CMSIS-Driver USB Host Interface. |
The MDK-Middleware Reference Applications are typically bundles of several similar projects. Use the command CMSIS:Manage Solution Settings
to choose a one project that you want to explore.
The steps to add a custom hardware configuration are:
Open the *.csolution.yml
file and add a new target-type
.
Note:
- You may copy an existing board layer as starting point. But typically these board layers support a range of reference applications and contain driver API interfaces that may be removed.
The uVision Debugger offers advanced debug features such as Event Recorder and Component Viewer to analyze the MDK-Middleware.
To call uVision with the csolution project that you are using in VS Code, add to the file .vscode\tasks.json
the following task. The command:
is the path to the uVision executable on your computer.
Use the VS Code menu command Terminal - Run Task... to Start uVision. uVision can directly load csolution projects. After you have configured the debugger for your target system you may use the Debug Windows and Dialogs to validate your application.
Refer to Application Note 320: Using Event Recorder for debugging a network performance issue for an tutorial on how to analyze MDK Middleware issues.
The uVision v5.41 IDE or higher allows to directly work with csolution projects. Source code can be modified, build commands can be executed, and after configuration the uVision Debugger can be used. Adding files or software components is possible by modifying the csolution project yml files. It is not directly supported with a user interface.
As uVision IDE is easy-to-use and powerful many developers want to use this IDE for productive software development. Once configured with a compatible board layer, the Reference Applications can be recreated as clean, native uVision project using these steps.
cproject.yml
and clayer.yml
using the uVision dialogs.These steps are described in more detail below.
Once the new project is created, it may be expanded with additional software components or modified to custom hardware as shown in the picture below. Note that uVision projects have no dependency on specify hardware boards.
Reference Applications contain typically a collection of projects. In a bespoke uVision project, most likely only a subset is required. Choose the example that to want to start from, then create a new folder and copy the source files from the Reference Application. Below this is exemplified on USB Device HID.
csolution project | copy to new uVision project folder | Notes |
---|---|---|
./HID | <MyFolder>/HID | Only copy content from root. |
./Board/<board> | <MyFolder>/Board/<board> | Only copy source files (*.c and *.h ). |
From the uVision menu use Project - New uVision Project... dialog to select the device that you are using.
The cproject.yml
and clayer.yml
contains a list of source files and components that should be added to the new uVision project.
Note:
- Do not start a generator such as CubeMX as the configuration is copied in the next step.
The RTE configuration files and generator files (for CubeMX or MCUXpresso Config) are fully compatible with uVision. However the folder structure is different.
csolution project | copy to new uVision project folder | Notes |
---|---|---|
./HID/RTE | <MyFolder>/RTE | Only copy component folders; exclude folders that start with _ . |
./Board/RTE | <MyFolder>/RTE | Only copy component folders; exclude folders that start with _ . |
./Board/<board> | <MyFolder>/STM32CubeMX/<target> | Rename the *.cgen.yml file. |
Note:
- The
*.cgen.yml
file has a different name that is derived from your project name, i.e.<MyProject>.cgen.yml
.
The settings of the csolution project are in the *.yml
files. Adjust these settings in uVision using the tabs of the Options dialog:
Software Model: TrustZone Off
.-O1
(for Debug), -O3
(for Release), Warnings: AC5-like
, Language C: C11
.CMSIS_target_header
in the Board.clayer.yml
that also requires an include path..\tmp\1\ac6_linker_script.sct
to <MyFolder>/Board/<board>
.cdefault.yml
there may be some linker controls that should be reflected in this dialog, for example --diag_suppress=L6314W
.