Skip to main content

How to integrate EIV into an existing project

Integration package structure

└── sternum-eiv-integration
├── config
├── lib
├── src
│   ├── include
│   └── ports
│   ├── freertos/...
│   └── rtos
└── tools

Importing the integration package

  1. Using your IDE, please import all code files in src/ports/ and in src/ports/[your-os].
  2. Add /src/include in your project's include path.
  3. Implement the ports in the user_ports.c file. Documentation can be found in the included header files.
  4. Include sternum_ads_api.h and call STERNUM_ADS_BOOT() earliest as possible, after system initialization.
    • Please note, in FreeRTOS/SafeRTOS, STERNUM_ADS_BOOT() must be called at the beginning of the first running task
    • (the OS will not allow using OS resources outside an execution context of a task).
  5. Include the relevant static library in /lib/ to your project.
    • Please note that in Keil, all libraries must have the .lib extension.

Setting up EIV as a post-build step

Keil v4-v5

  1. Please go to Project Options->User->After Build
  2. Add the following post build command:
    ../sternum-eiv-integration/tools/EIVRunner --build_env keil --conf_dir "../sternum-eiv-integration/config/" "#P" "#L"
  3. Set Stop on Exit condition to >= 1.

Eclipse (MCUXpresso v11/Simplicity Studio 5)

  1. Please go to Project Properties->C/C++ Build->Settings->Build steps->Post-build steps
  2. Add the following post build command:
    ../sternum-eiv-integration/tools/EIVRunner --build_env eclipse --conf_dir "../sternum-eiv-integration/config/" "${ProjName}" "${BuildArtifactFileName}"

IAR 8.x

  1. Please go to Project Options->Build Actions->Post-build command line
  2. Due to IAR 8.x limited post build action information, we offer 2 post build options (Please adjust the path of sternum-eiv-integration if needed):
    1. The first will write all output to EIV.log in your project's root directory:
    cmd.exe /c ""$PROJ_DIR$\sternum-eiv-integration\tools\EIVRunner.exe" --build_env iar --conf "$PROJ_DIR$\sternum-eiv-integration\config"  "$TARGET_PATH$" "$LIST_DIR$" "$EW_DIR$" > "$PROJ_DIR$\EIV.log"" 2>&1
    1. The second will direct all output into a CMD shell. The terminal must be closed when EIV indicates success for the IAR build to complete.
    cmd.exe /c start cmd.exe /k ""$PROJ_DIR$\sternum-eiv-integration\tools\EIVRunner.exe" --build_env iar --conf "$PROJ_DIR$\sternum-eiv-integration\config" "$TARGET_PATH$" "$LIST_DIR$" "$EW_DIR$""

Troubleshooting

If you encounter with any errors in EIV, please provide the following information to Sternum:

  1. EIV terminal output
  2. eiv_post_protect.[bat/sh]
  3. eiv_protect.[bat/sh]
  4. protected_link.[bat/sh]
  5. Map files