Building EdgeApp

Building for the CTEC Target

  1. Extract the SDK contents.
    Linux: tar -xvf CTEA_SDK-.tar.gz
    Windows: Use Windows tools to unzip CTEA_SDK-.zip

  2. Change directories to the SDK root.
    cd CTEA

  3. Create a build directory.
    mkdir debug

  4. Move to the build directory.
    cd debug

  5. Create the build environment.
    Linux: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Toolchain-arm-oe-linux-gnueabi.cmake ..
    Windows: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../Toolchain-armv7m-none-eabi.cmake ..

  6. Customize EdgeApp.
    make menuconfig

642
  1. Select the LMU build target by pressing Space Bar or Enter when “LMU build target” is selected. Use the arrow keys to select the appropriate device and press Enter to select the build target and return. Note that LMU3040 and LMU3240 will not build in a Windows environment and LMU3040m will not build in a Linux environment.
644
  1. Use the arrow keys to highlight “EdgeApp version…” and press Enter. Type an appropriate version up to seven characters and press Enter.
642
  1. Use the arrow keys to highlight “EdgeApp name…” and press Enter. Enter an appropriate EdgeApp name up to 15 characters.
643
  1. Use the arrow keys to highlight “CalAmp Components”. Press Enter twice to select this group and display available CalAmp components. Select or deselect desired components.
642
  1. Press Esc to exit the CalAmp Components menu. Note that if the C-Script or HA translator components are selected, additional menus become available in the main menu.
642
  1. Use the arrow keys to highlight “Example Components”. Press Enter twice to select this group and view the available components. Select or deselect components as needed.
642
  1. Press Esc to exit the Example Components menu.

  2. Use the arrow keys to highlight “Customer Components”. Press Enter twice to select this group and view the available components. Note that by default there are no customer components created and group won’t open. Once a customer component is created, this menu will open.

642
  1. Press Esc to exit the Customer Components menu.

  2. If the C-Script CalAmp component was selected, use the arrow keys to highlight “C-Scripts”. Press enter once to display the currently selected C-Script.

642
  1. Press enter a second time to display all available scripts. Use the arrow keys to select the appropriate script and press Enter. Note that only one script may be selected.
642
  1. Press Esc to return to exit the C-Scripts menu.

  2. If the HA Translator CalAmp component was selected, use the arrow keys to select “HA-Apps”. Press enter once to display the currently selected HA App.

642
  1. Press ‘q' to quit and, when prompted, 'Y’ to save configuration.

  2. Compile the EdgeApp.
    make

  3. Generate the final binary image.
    make image

Creating a New Component

  1. Move to the template directory.
    cd source/components/src/cust_comp/template

  2. Create a new component from the template.
    Linux: ./create_new_comp.sh <some_cmp>
    Windows: create_new_comp.sh <some_cmp>

  3. Change directories to the new component root.
    cd ../src/cust_comp/<some_cmp>

  4. Get a license file from Customer Support.

  5. Put the license file in the include directory of the new component.

  6. Edit the Kconfig file and update the full, default name in the second line, if desired.
    vi ./Kconfig

  7. Refer to “Building for the CTEC Target” for steps on building in the new component.

Creating a New C-Script

  1. Move to the template directory.
    cd source/externals/src/csript/cust_cscript/template

  2. Create a new C-Script from the template.
    ./create_new_cscript.sh <new_name>

  3. Move to the debug directory.
    cd ../../../../../../debug

  4. Start menuconfig.
    make menuconfig

  5. Use the arrow keys to select CalAmp Components and press Enter twice.

644
  1. Use the arrow keys to select the CalAmp C-Script Component and press Enter.
645
  1. Press Esc to exit the CalAmp Components menu.

  2. Use the arrow keys to select C-Scripts and press Enter twice.

644
  1. Use the arrow keys to select the new C-Script and press Enter. In this example, the “new” script is called myscript.
644
  1. Press ‘q' to quit and, when prompted, 'Y’ to save configuration.

  2. Compile the EdgeApp.
    make

Adding a 32-bit Hosted App

  1. Move to the ha32_app directory.
    cd source/externals/src/ha32_app

  2. Copy the 32-bit Hosted App folder into the ha32_app.

  3. Run the integrate_ha script using the folder name of the 32-bit Hosted App that was just copied.
    ./integrate_ha <folder_name>

  4. Move to the debug directory.
    cd ../../../../debug

  5. Start menuconfig.
    make menuconfig

644
  1. Use the arrow keys to select the CalAmp HA Translator.
644
  1. Press Esc to exit the CalAmp Components menu.

  2. Use the arrow keys to select HA-apps and press Enter twice.

644
  1. Use the arrow keys to select the new Hosted app and press Enter. In this example, the “new” Hosted App is called myHa.
645
  1. Press ‘q' to quit and, when prompted, 'Y’ to save configuration.

  2. Compile the EdgeApp.
    make

Running Clang Static Analyzer (Linux only)

  1. Change directories to the SDK root.
    cd CTEA

  2. Create a debug directory.
    mkdir debug

  3. Move to the debug directory.
    cd debug

  4. Create the build environment
    cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Toolchain-arm-oe-linux-gnueabi.cmake ..

  5. Select components for static analysis.
    make menuconfig

  6. Move to SDK root directory.
    cd ..

  7. Create a static build directory.
    mkdir static_debug

  8. Copy component selections.
    cp debug/.config static_debug/

  9. Move to the build directory.
    cd static_debug

  10. Create the build environment.
    scan-build-6.0 cmake -DRUN_CLANG_STATIC_ANALYZER=1 -DAPP_ID=1001 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Toolchain-arm-oe-linux-gnueabi.cmake ..

  11. Run the static analyzer.
    scan-build-6.0 -o scanbuild -enable-checker alpha -disable-checker alpha.clone.CloneChecker --keep-going --use-cc=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc --use-c++=/usr/local/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++ make

Formatting the Source Code with Astyle

  1. Change directories to the debug directory
    cd debug

  2. Format the source code
    make astyle

Creating Documentation with Doxygen

  1. Change directories to the debug directory
    cd debug

  2. Generate documentation for custom components
    make doc

Sideload EdgeApp to Linux Target

  1. Change directories to the debug directory
    cd debug

  2. Deploy image to target and install
    make deploy

  3. When prompted (twice), enter the password
    welcome123

Sideload EdgeApp to RTOS Target

  1. Open a TeraTerm (or other terminal program) session to the USB Serial Port for the LMU3040m.

  2. If required, enter the device password.
    at$pw <device_password>

  3. Enter the download command.
    at$app fdnldser

  4. From the TeraTerm File menu, select Transfer, YMODEM, then Send…

  5. Browse to select the EdgeApp image.

  6. After the download is complete, program the image.
    at$app frog 3 0

  7. To start the EdgeApp, reset the device.
    atreset