Coder Social home page Coder Social logo

nrf5-segger-embedded-studio-example's Introduction

nRF5 SDK Segger Embedded Studio Memfault Example

This is an example project for Segger Embedded Studio and the nRF5 SDK, targeting the nRF52480-DK ("pca10056") dev board.

Building

Prerequisites

Make sure the SDK_ROOT macro is set up in Segger Embedded Studio:

Setup Steps

  1. Download and unpack the nRF5 SDK. This example was tested with v15.2.0, which can be downloaded here.

  2. In the nRF5 SDK, disable the nRF5 SDK app_error.h file by renaming it:

    mv components/libraries/util/app_error.h{,.overriden}
  3. Clone this repo somewhere:

    git clone --recursive \
       https://github.com/memfault/nrf5-segger-embedded-studio-example.git
  4. Open segger embedded studio and open the solution from <path_to_this_repo>/pca10056/blank/ses/cli_pca10056.emProject

  5. Build and flash to the nRF52480-DK

  6. Use the built-in RTT terminal to execute the Memfault Demo CLI commands

Details on Memfault integration

The overall strategy to integrating Memfault to a Segger Embedded Studio project is as follows:

1. Add the memfault source files

  1. Add the memfault sdk as a git submodule (only if the project is already using git, otherwise just clone the Memfault SDK instead):

    ❯ git submodule add https://github.com/memfault/memfault-firmware-sdk.git third_party/memfault-firmware-sdk
  2. Add the source files; for example, as a virtual folder with the following exclusions (example below is the content in the .emProject file itself; can be added from within Segger Embedded Studio or by manually editing the file in a text editor):

    <folder
    Name="third_party/memfault-firmware-sdk"
    exclude="cmake;components/http;examples;scripts;tests;atmel;cypress;dialog;emlib;esp8266_sdk;esp_idf;freertos;lwip;mbedtls;mynewt;nxp;particle;qp;s32sdk;stm32cube;templates;zephyr;nrf5_coredump_storage.c"
    filter="*.c"
    path="../../../third_party/memfault-firmware-sdk"
    recurse="Yes" />

3. Add the necessary search paths to the Preprocessor configuration

../../../third_party/memfault-firmware-sdk/examples/nrf5/apps/memfault_demo_app/third_party/memfault/sdk_overrides
../../../third_party/memfault-firmware-sdk/components/include
../../../memfault_port
../../../third_party/memfault-firmware-sdk/ports/include

4. Modify the linker XML

This is usually the flash_placement.xml file. It needs to include the following section for the Build ID:

<ProgramSection alignment="4" load="Yes" name=".text" />
<!-- placing it right after the .text section -->
 <ProgramSection alignment="4" keep="Yes" load="Yes" name=".note.gnu.build-id" inputsections="*(.note.gnu.build-id)" address_symbol="__start_gnu_build_id_start" end_symbol="__stop_gnu_build_id_stop" />

5. Add the linker option for build id

Under project Options -> Code -> Linker -> Additional Linker Options, add --build-id on its own line. Example here for the .emProject file:

<solution Name="MyProject" target="8" version="2">
  <project Name="MyProject">
    <configuration
      ...
      linker_additional_options="--build-id"

6. Add the necessary memfault port files

In this example, they're added in thememfault_port folder as a virtual folder, which can be added through the UI, or by directly modifying the .emProject XML:

<folder
   Name="memfault_port"
   exclude=""
   filter="*.c"
   path="../../../memfault_port"
   recurse="Yes" />

Note that the memfault_port/memfault_platform_log_config.h and memfault_port/memfault_platform_config.h files contained required settings for successfully building the project, be sure to copy them as-in into the target project (or review the settings and make sure the necessary ones are included).

nrf5-segger-embedded-studio-example's People

Contributors

ejohnso49 avatar noahp avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.