5: Prepare Your mangOH Red For Development

In this chapter, you will build the mangOH Distribution (mangOH Platform and Legato Application Framework) on your computer, and install the mangOH Platform applications on your mangOH Red.

The mangOH Platform includes a suite of applications customized for the mangOH hardware platform, and a set of Linux kernel modules. The platform is built using features of the Legato Application Framework, which includes its own set of applications and Linux kernel modules.

5.1 Build / Install mangOH Distribution

Now that your dev machine has its development environment set up, you will build the mangOH Distribution and install it on the CF3 module in your mangOH Red:

1.Get the Legato Application Framework (AF):

a.Go to http://legato.io/legato-docs/latest/aboutReleaseInfo.html to get the version number of the most recent release.

41112261_PrepMangoh00070.jpg

 

b.Get the source files for the Legato AF:

i.Create the legato_framework directory to hold the Legato AF:

$ cd ~ 

$ mkdir legato_framework 

ii.Download the framework files into the work directory  Replace the release number in the ’repo’ command with the most recent release (this example downloads version 18.03.0):

$ cd legato_framework 

$ repo init -u git://github.com/legatoproject/manifest -m \
legato/releases/18.03.0/legato.xml
 

$ repo sync 

example_text_2.png

 

Note:   This may take several minutes to run.

2.Get the source files for the mangOH platform:

$ cd ~ 

$ git clone --recursive git://github.com/mangOH/mangOH 

example_text_3.png

 

3.To work with the Legato AF in a terminal window, you must configure required environment variables and a command alias:

·LEGATO_ROOT  Indicates the root directory of the Legato AF

·device-specific SYSROOT variables  Indicates the root directory of device-specific toolchains (the pathname used includes the symlink(s) created earlier). Only the devices you support need to have a SYSROOT variable defined.

·cfglegato  an alias to run a command sequence that makes the Legato AF tools available.

a.Edit ~/.bashrc and add the following lines at the end of the file (include only the device-specific SYSROOTs that you are developing for):

$ export LEGATO_ROOT=~/legato_framework/legato 

$ export \
WP750X_SYSROOT=/opt/swi/y17-ext-wp750x/sysroots/armv7a-vfp-neon-poky-linux-gnueabi
 

$ export \
WP76XX_SYSROOT=/opt/swi/y22-ext-wp76xx/sysroots/armv7a-neon-poky-linux-gnueabi
 

$ export \
WP77XX_SYSROOT=/opt/swi/y22-ext-wp77xx/sysroots/armv7a-neon-poky-linux-gnueabi
 

$ export \ 
WP85_SYSROOT=/opt/swi/y17-ext-wp85/sysroots/armv7a-vfp-neon-poky-linux-gnueabi 

$ alias cfglegato=\
"pushd . && cd ~/legato_framework/legato && source ./bin/configlegatoenv ; popd"
 

41112261_PrepMangoh00077.jpg

 

b.Save and close the file.

c.Exit the window:

$ exit 

d.Open a new terminal window  This automatically executes the .bashrc script, which makes the cfglegato shortcut available for use.

4.Build the Legato AF and mangOH platforms for the CF3 module in your mangOH Red (replace <module_series> with your CF3 module series; see the list of supported values below the example):

$ cd ~/mangOH 

$ git pull && git submodule update --init 

Note:   The "git pull && git submodule update --init" command gets any changes that have been made to the mangOH distribution source files on your system. This command can be run at any time to ensure your builds are up to date.

$ make <module_series>     (Or use "make" with no parameters to build all plat­forms.)

(For example, "make red_wp76xx".)

example_text_4.png

 

Note:   
   • This may take several minutes to run.
   •  The number of packages listed will vary (newer platform releases will have different numbers of files)

Note:   The make command uses optional parameters to limit the deliverables being built.
Full command format: [LEGATO=<enable>] make <module_series>
Where:
   LEGATO=<enable>
      0 — Legato AF is not built
      1 — Legato AF is built (Default)
   <module_series>  Build only the specified mangOH platform (additional platforms will be added as new products become available):
      • green_wp85
      • green_wp750x
      • red_wp85
      • red_wp750x
      • red_wp76xx
      • red_wp77x

Tip:   Optionally, before using the make command to build the AF / mangOH platform, you can use "make clean" to clear out any build artifacts that are generated and stored by the make command.

41112261_PrepMangoh00082.jpg

 

5.Verify that the update files were created for the mangOH platforms you built by checking their time stamps:

$ ls -al build/update_files/* 

example_text_5.png

 

6.Configure the terminal window to work with the Legato AF’s tools:

$ cfglegato     # Set up the environment

Important:   You must enter the ’cfglegato’ command in any terminal window that you open on the dev machine, if you want to use the framework’s tools in that window.

mangoh_important.png

 

Important:   You MUST do the following step! The Legato AF that you just installed, and the mangOH Red platform apps that you are going to install, both require you to have the correct (latest) firmware installed on your CF3 module. The distribution applications may not install if you do not have the correct firmware.

7.Update the CF3 module’s firmware to the latest available version (which you downloaded earlier along with the Legato toolchain):

a.Disconnect power from the mangOH Red (remove the jumper from the power header, or unplug the micro-USB cable that is providing power).

b.The firmware update is loaded using the "swiflash" tool, available from source.sierrawireless.com/resources/airprime/software/swiflash command  Follow the Ubuntu/Debian Distributions instructions in the Installation section.

c.Reconnect the power (plug in the micro-USB cable or insert the jumper on the power header on the same pins it was removed from in step a. The Power LED will light immediately.

d.Install the firmware (replace <module_series> with your CF3 module’s series: WP85XX, WP750X, or WP76XX):

i.Open a terminal window.

ii.Change directory to the Downloads folder:

$ cd ~/Downloads 

iii.Check the name of the firmware file that you downloaded earlier:

$ ls -al *.spk 

41112261_PrepMangoh00087.jpg

 

Note:   The downloaded file will be an ".spk" file. If the file is not listed, repeat Step 7 on page 15 up to step Step d. Make sure to click the link in the Instructions for Legato CLI Users (Linux) row (do not click the link in the Instruc­tions with one-click tool (Windows) row.

iv.Install the new firmware (replace <module_series> with your CF3 module’s series: WP85XX, WP750X, or WP76XX, and replace <file> with the name of the file that you downloaded):

$ swiflash -m <module_series> -i <file> 

(e.g. "swiflash -m WP76XX -i WP76xx_release8_RC4_GENERIC_SPK.spk"

41112261_PrepMangoh00090.jpg

 

Note:   This will take several minutes to run. If the download fails, repeat the swiflash command. If you still have difficulties, refer to source.sierrawireless.com/resources/airprime/software/swiflash for additional usage sugges­tions.

e.Wait (1–2 minutes) while the module reboots with the new firmware.

Tip:   Ping the mangOH Red  when replies appear, the module has rebooted and you can continue.
   $ ping 192.168.2.2     (Press CTRL-C to cancel)

f.Verify that the firmware updated:

i.Connect to the mangOH Red:

$ ssh root@192.168.2.2 

ii.Display information about the CF3 module and confirm that the Firmware version shown is the one that you downloaded:

# cm info 

example_text_6.png

 

iii.Disconnect from the mangOH Red:

# exit 

8.Install the mangOH Red platform:

a.Install the mangOH Red platform specific to the CF3 module on your mangOH board:

$ update ~/mangOH/build/update_files/red/<updatefile> 192.168.2.2 

For example, if the CF3 module in your mangOH Red is a WP7603, use:

$ update ~/mangOH/build/update_files/red/mangOH.wp76xx.update 192.168.2.2

Tip:   For detailed information about the build process, view the Readme file in /home/mangoh/mangOH.

If the applications install successfully, the last message shown will be "SUCCESS      Done".

vb_instlegato.png

 

Note:   If the CF3 module has any problems starting the mangOH Red platform applications, it automatically reboots and restores to its original state (prior to the instsys command). If this happens, the CF3 module will not be reachable while it is rebooting.

9.Verify the mangOH platform apps installed correctly:

a.Connect to the mangOH Red:

$ ssh root@192.168.2.2 

b.Show the list of installed apps to confirm the build and install succeeded:

# app status 

The Legato system distributed as part of the WP firmware image does not include the redSensorToCloud app. If redSensorToCloud appears in the list, then the update has been applied:

41112261_PrepMangoh00097.jpg

 

c.Disconnect from the mangOH Red:

# exit 

happy_mangoh_canstockphoto11432497_3.jpgNow that the mangOH Red platform is installed, you will learn how to Register On Mobile Network.