QEMU-emulated ARM Cortex-M3 on MPS2 (AN385)
by FreeRTOS
FreeRTOS team has created a Quick Connect demo using a QEMU-emulated ARM Cortex-M3 on MPS2 (AN385). This demo uses AWS services to take care of the AWS account creation and AWS IoT configuration required to connect your emulated device to AWS IoT. Once connected, messages containing data collected from sensors are sent from the device, allowing you to simulate AWS IoT applications.
To begin the Quick Connect demo:
Windows prerequisite: All steps here must be run in Windows Subsystem for Linux. Follow the official Microsoft instructions to install WSL. After you have installed WSL, make sure you are completing all steps below in a WSL shell. The easiest way to open an WSL shell, if you followed the official Microsoft instructions, is to search for the "Ubuntu" application on your desktop. Opening up this application will automatically open a WSL/Ubuntu shell.
Step 1: Download QEMU and include the qemu-system-arm
emulator in your shell's path (i.e., which qemu-system-arm
produces a valid path).
Linux: depending on your Linux distro, you maybe able to get QEMU through your system's package manager. If you are on Ubuntu, do sudo apt install qemu-system
.
Mac: You are able to get QEMU through Homebrew. Install Homebrew (or if you have it installed already), then do brew install qemu
.
Windows: In a WSL/Ubuntu shell, run sudo apt install qemu-system
.
Step 2: Download the Quick Connect setup package for the computer you will use to set up the QEMU emulated board.
Download Quick_Connect_QEMU-windows.x64.zip for Windows
Download Quick_Connect_QEMU-macos.x64.zip for Mac
Download Quick_Connect_QEMU-linux.x64.zip for Linux
Step 3: Unzip the Quick Connect archive, and run the file Start_Quick_Connect by directly invoking it through a terminal, i.e., running ./Start-Quick-Connect
inside the created folder after decompressing the archive.
Windows: This must be done through the WSL shell as well. To access the location where you downloaded the binary within the WSL shell, run cd /mnt/<drive letter>/<binary path>
, where <drive letter>
is the drive where your binary is, and <binary path>
is the path of the binary within that drive, but with forward slashes ("\") replaced by back slashes ("/").
Note: You may receive warnings while trying to run the application. If so, see the troubleshooting section below.
Step 4: Follow & complete all of the prompts in the command line interface.
Step 5: When Start_Quick_Connect is complete, a file called CLICK-ME.html will be created in the same directory. Double-click CLICK-ME.html to open a custom URL where you can visualize data from the sensors on your emulated ARM CM3 board.
Note: Please ignore the "Add a sensor graph" section in the URL that you open, and use the instructions below.
To update the Quick Connect demo:
Windows prerequisite: All steps here must be run in Windows Subsystem for Linux. Follow the official Microsoft instructions to install WSL. After you have installed WSL, make sure you are completing all steps below in a WSL shell. The easiest way to open an WSL shell, if you followed the official Microsoft instructions, is to search for the "Ubuntu" application on your desktop. Opening up this application will automatically open a WSL/Ubuntu shell.
Step 1: Download QEMU and include the qemu-system-arm
emulator in your shell's path (i.e., which qemu-system-arm
produces a valid path).
Note: follow the instructions in Step 1 of the previous section to get QEMU on your system.
Step 2: Download ARM GNU embedded toolchain and include the ARM compiler arm-none-eabi-gcc
in your shell's path (i.e., which arm-none-eabi-gcc
produces a valid path).
Note: This step is the most difficult as the most up-to-date version of the ARM GNU embedded toolchain is currently not in any package management system. What you will need to do in your system is download the embedded toolchain, extract the archive to a directory of your choice, and adding that directory to your system's path. On Windows (WSL)/MacOS/Linux, this means adding export PATH=$PATH:<>
to the profile of your shell (usually this is ~/.bashrc
or ~/.zshrc
but it depends on your own system customization), and then running source <>
.
Step 3: Download the source code. The source archive contain the binary source (device code).
Step 4: Clone the FreeRTOS repository, following the cloning instructions in the README.md in the repository. Move the downloaded source archive (from the previous step) into the FreeRTOS-Plus/Demo folder, and extract the archive.
Step 5: Go into the extracted folder, follow the README.md in there to customize the demo. After you are done customizing, rebuild the demo as well using the instructions in the README.md.
Step 6: Copy the generated executable from the build into the original folder to which you extracted the Quick Connect demo binary, and replace the device binary in the Demo subfolder.
Step 7: Rerun the file Start_Quick_Connect by directly invoking it through a terminal to see your changes.
Specifications
QEMU is a generic and open source machine emulator and virtualizer. This demo uses QEMU to emulate an ARM Cortex-M3 MPU on a MPS2 using AN385.
Hardware Architecture
ARM (Cortex-M3)
Network Connectivity
Ethernet only
Mounting / Form Factor
Emulated
Operating System
FreeRTOS
Programming Language
C/C++
Troubleshooting:
Permission issues while running the application:
Mac:
After double-clicking the Quick Connect executable, depending on your security settings, you may see a pop up window that says "Start_Quick_Connect cannot be opened because it is from an unidentified developer". Right click on the Start_Quick_Connect file in the Finder app and select the "Open" option. Then click on the "Open" button in the popup that shows up.
Antivirus issues:
You might run into issues where your antivirus software thinks the Start_Quick_Connect
executable is malware. This may be because the demo writes to a configuration file in the Demo
folder; if your demo is quarantined because of your antivirus software, please mark the demo as trusted or disable antivirus for the duration of the demo.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.