Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

IN PROGRESS

SimplePublish for ARM mbed

A SimplePublish example has been created on the mbed OS developer siteQSL SimplePublish. This is a free, online code editor and compiler that allows you to write code for the mbed OS. This makes it very easy to port code to the different supported platforms.

The example code is written and tested on the NUCLEO-L053R8, but you should be able to compile it for any mbed supported platform that has an avalilable UART by defining the correct UART RX/TX pins in dn_uart.cpp.

Prepare Your Platform

Log into your mbed account (or signup for one if you haven't already) and get started by selecting your platform on the mbed developer page: https://developer.mbed.org/platforms/.

Add Platform to Compiler

Click the big yellow button on the right side of the platform page to add it to your list of platforms in the online Compiler:

Setup for mbed

The page for your platform should include instructions on how to set it up and install any necessary drivers.
For our example, the page for NUCLEO-L058R8 informs us that we need to:

The ST-LINK/V2 driver is included with installer for the System Workbench for STM32.

Connect to Mote

For the Nucleo boards you can follow the instructions on the SMT32 example page for the NUCLEO-L053R8.

Otherwise you should refer to the general instructions and the pinout of your platform.

Compile and Run the Program

Import to Your Compiler Workspace

  1. Head to the Code page for the SimplePublish program and press the big yellow button:
  2. This should open the Import Program window in the Compiler online IDE:
    Source URL: http://developer.mbed.org/users/jhbr/code/QSL_SimplePublish/
    Import As: Select Program
    Import Name: Rename the program if you want to
    Update: Check to update the libraries that the program depends on (only the main mbed library)
  3. Press Import.
  4. You should now see the program listed under My Programs.

Select Platform

  1. Select the program in the Program Workspace window on the left side.
  2. Click the platform selection option in the top right corner:
  3. The platform you added to the Compiler earlier should appear in the window that pops up. Click on it and press Select Platform

Make Necessary Adaptations

The program mainly uses code that is universal to all mbed supported platforms, but if you use another platform than the NUCLEO-L053R8 you might have to make a few changes:

  • dn_uart.cpp: Change the UART_MOTE_TX and UART_MOTE_RX defines to the correct pins for your platform.
  • main.cpp: Change the LED define passed to DigitalOut myled() to the correct one for your platform.
  • dn_endianness.c: These functions are implemented for a little-endian platform, hence you need to change them if your platform is big-endian.

You can find the names of relevant pins for your platform on its mbed platform page.

Build

To only build the program, select it in the Program Workspace window and press Compile > Build Only (Ctrl+B).
This will build the program for the platform you selected, and any errors/warnings should appear in the bottom Compile Output window. You will probably get some warnings about some depreciated declarations in the sm_clib (which you can safely ignore), but if you get any errors you should consult the previous section.

Compile and Flash

Again, with the program selected, press Compile > Compile (Ctrl+D).
This will build the program and compile it to a binary that is downloaded via your browser. To flash the binary to your platform, simply save it directly to the device. You can also save it somewhere on your computer and simply copy/drag it to your device.

For the Nucleo boards, the big LD1 LED will flash green/red alternately during the transfer, ending in solid green upon completion.

For some devices, you might have to press the reset button when the transfer completes (consult its mbed platform page).
  • No labels