This repo contains an application that pulls together all the bits of the u-blox integration of the new mbed 5 release and builds something runnable.
To fetch and build the code in this repository you need first to install the mbed CLI tools and their prerequisites.
The repo structure is quite confusing; it goes like this:
- What you see here is the top level. It contains only the test application.
- Look for the vital little file
mbed-os.lib
. It really is vital. - Because github can't do references to repos from within repos (like good 'ole SVN did), ARM have invented these
.lib
files. The name is very confusing as all the file contains is a link to another repo (lnk
would have been a better file extension to choose). When you use the mbed command line tools or the mbed on-line IDE it understands these.lib
files. So the effect ofmbed-os.lib
is to tell the mbed tools to go get the github URL inside thembed-os.lib
file and put it in the sub-directorymbed-os
. In the on-line IDE this is called a library, hence the confusing name. - So, you MUST use the mbed command line tools to sort everything out for you. For instance, to create a new mbed-os application for yourself, let's call it
my-app
, create themy-app
directory,cd
to it and then (assuming you have the mbed CLI tools installed) entermbed new .
. This will go and get all of the latest mbed-os release and put it into the correct sub-directories. All you need to do then is add your application file(s) to the top-level of directory and you have a code tree which should compile and run 'on' mbed-os. - However, we're in mid port and our stuff hasn't yet made it into the main mbed-os release, so you need to do a little shimmy before you can begin. All of the mbed platform stuff, which is now aligned with the mbed 2 codebase, is in a sub-directory of it's own off the
mbed-os
directory calledcore
. As above, the URL of the repo containingcore
(which is actually the latest mbed 2 release) is referred to by a filecore.lib
and the mbed tools sort it all out for you. So, rather than getting the current release ofcore
you need instead to get the branch of it with all our stuff in. To do this,cd
to thembed-os
sub-directory. In there entermbed update workshop-ublox
. This will switch the code base away from thembed-os
master to a branch where we have integrated u-blox-ness. All that has actually been done in that branch is to modify the single filecore.lib
to point to a fork of the mbed 2 platform code where the integration has been done (which is over in the repo https://github.com/ARMmbed/mbed-ublox). Nowcd
to thecore
sub-directory and in there entergit checkout master
. This will switch you to using the master branch of our fork. Finally, entermbed update
once more to actually update the code on your disk to master.
Once you have cloned this repo, cd
to the repo directory and enter the following:
mbed update
This will fetch the latest mbed-os release (from the URL in the mbed-os.lib
file, recursing as necessary).
Then, switch to the u-blox integration version of the mbed-os by entering the following:
cd mbed-os
mbed update workshop-ublox
cd core
git checkout master
mbed update
Having done that, cd
your way back to the top-level repo directory once more.
You need to set the target and the toolchain that you want to use. The target and toolchain we'd like to use this application on is SARA_NBIOT_EVK
and the toolchain is GCC_ARM
. Of course, in future we will support the u-blox targets on other toolchains (e.g. ARM, microVision, IAR) and, equally, if there's another target you happen to have then exactly the same application code can be used on that target. To get a list of supported targets and their toolchains enter mbed compile -S
.
You can set the target and toolchain for this application once by entering the following two commands (while in the top-level directory of the repo):
mbed target SARA_NBIOT_EVK
mbed toolchain GCC_ARM
Once this is done, build the code with:
mbed compile
You will find the output files in the sub-directory .build\SARA_NBIOT_EVK\GCC_ARM\
.
-
As a result of the little shimmy above to use our integration fork of the mbed-os release, you will have a modified
core.lib
file in yourmbed-os
sub-directory. Don't check that in (you probably can't anyway). -
There is a file
mbed-settings.py
in the top-level repo directory. This is where you make local changes to how you want the code built. The only non-default setting in this particular file is to change:BUILD_OPTIONS = []
to
BUILD_OPTIONS = ["debug-info"]
...which will get debug output into the
.elf
file and switch optimisation off so that you can use a debugger. -
Eclipse project files are included but you can also build from the command-line as above.