Using the mbed SDK for Dragonfly develop
Introduction¶
Instead of using the mbed online compiler for development, users can also use the mbed SDK to develop their applications offline. This wiki page will outline the steps required to get an offline development environment for the MultiTech Dragonfly up and running.
Prerequisites¶
To use the mbed SDK to build applications offline, a number of prerequisites must be taken care of:
- install Git
- install the GCC ARM Embedded toolchain from here if running Windows or here if running Linux (this wiki assumes Ubuntu)
- install python 2.7, setup tools, and pip
If running Ubuntu, python setup tools can be installed using apt-get from the command line:
sudo apt-get install python-setuptools
Setting Up¶
The mbed SDK can be cloned from the mbed GitHub page now that the prerequisites are out of the way:
git clone https://github.com/mbedmicro/mbed.git cd mbed python setup.py install
Depending on the operating system, the setup script may need to be run with root privileges:
sudo python setup.py install
Attempting to build without setting up workspace tools will definitely generate a warning and can potentially cause the build to fail, depending on which operating system and toolchain is being used. Workspace tools should be configured as described here before any builds are attempted.
Building mbed Libraries¶
After workspace tools are configured, it should be possible to build the mbed libraries.
python workspace_tools/build.py -m MTS_DRAGONFLY_F411RE -t GCC_ARM -c -j 0
The following table explains the different command line options used in this command.
Option | Description |
---|---|
-m <platform> | the platform to compile the mbed libraries for |
-t <toolchain> | the toolchain to use |
-c | do a clean build (from scratch) |
-j <jobs> | the number of jobs to use (0 uses all CPUs for fastest build) |
The build script will display all possible command line options when run with the help option:
python workspace_tools/build.py -h
Downloading the MTSAS library¶
Now that the mbed libraries are built, application development can begin. If you wish to develop an application that uses the cellular radio, you should include the MTSAS library in your project. The library can be cloned directly from mbed using Mercurial (hg).
The MTSAS library contains multiple sub libraries, each of which must be cloned independently:
cd <path to source directory> hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/mtsas/ cd mtsas/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/MTS-Cellular/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/MTS-Utils/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/MTS-Serial/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/MTS-Test/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/MTS-Socket/ cd MTS-Socket/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/HTTPClient-SSL/ cd HTTPClient-SSL/ hg clone https://<your mbed username>@developer.mbed.org/teams/MultiTech/code/CyaSSL/
Building Applications¶
After application source has been written, the make.py script is used to build the application:
python workspace_tools/make.py -m MTS_DRAGONFLY_F411RE -t GCC_ARM -c -j 0 --source=<source dir> --build=<build dir>
The following table explains the different command line options used in this command.
Option | Description |
---|---|
-m <platform> | the platform to compile the mbed libraries for |
-t <toolchain> | the toolchain to use |
-c | do a clean build (from scratch) |
-j <jobs> | the number of jobs to use (0 uses all CPUs for fastest build) |
--source=<source dir> | absolute path to application source directory |
--build=<build dir> | absolute path to application build directory |
The make script will display all possible command line options when run with the help option:
python workspace_tools/make.py -h
Note
The source and build directories should be separate directories. The build directory should not be under the source directory or vice versa.
Note
Using the -c option with the make.py script rebuilds the application from scratch, but does not rebuild the mbed libraries! The build.py script must be invoked separately to rebuild the mbed libraries.
Much of this guide was derived from the mbed SDK getting started guide located in docs/BUILDING.md in the mbed SDK or here. It can be used as a general reference for topics that this page doesn't cover as well as a general troubleshooting guide for issues encountered using the mbed SDK.