How to create a custom ESPRO BSP

From SEGGER Wiki
Revision as of 14:24, 19 August 2022 by Lucas (talk | contribs)
Jump to: navigation, search

This article contains a guide that explains how to create a custom ESPRO Board Support Package based on a CPU Support Package. In this example we will create an embOS project, later other SEGGER software can be added as well.


Setup

The following tutorial will be based on the following Hardware and Software combinations:

Tutorial

This tutorial will be explain how to create a custom embOS board support package. To make this tutorial easier, a few terms need to be defined first:


  • SolutionDir = The SolutionDir means the folder that contains the emProject file.
  • ESPRODir = The ESPRO package folder, found in Embedded Studio under File->Open Studio Folder->Packages Folder.


  1. Start Embedded Studio
  2. Install CPU support Package for your device family via Tools->Package Manager.
  3. Create new project via File->New Project->Create the project in a new solution.
  4. Select the "A C/C++ executable for..." from the corresponding package. Press Next, select your target device and keep pressing Next until your project is finished.
  5. Now activate the embOS and SEGGER library in the project options:
    • Project Settings->ES PRO Cortex-M->embOS->Add embOS = Yes.
    • Project Settings->ES PRO Cortex-M->SEGGER->Add SEGGER library = Yes.
  6. After activating the libraries open the SolutionDir.
  7. Create two folders called OS and SEGGER, after that open the OS folder.
  8. Create two more folders in it named Setup and Generic.
    ESPRO BareMetal OS Setup Generic.PNG
  9. Go back to the SolutionDir and open the SEGGER folder.
  10. Create a folder named Generic in it.
    ESPRO BareMetal SEGGER Generic.PNG
  11. Now open the ESPRODir and navigate to SEGGER->Generic.
  12. Copy the following files into SolutionDir->SEGGER->Generic:
    • SEGGER_RTT.c
    • SEGGER_SYSVIEW.c
    • SEGGER_SYSVIEW_embOS.c
    • SEGGER_RTT_ASM_ARMv7M.S
  13. Also copy SEGGER_SYSVIEW_CONF.h from ESPRODir->SEGGER->Inc to SoluionDir->SEGGER->Generic.
    ESPRO BareMetal SEGGER Generic Source.PNG
  14. Unzip the downloaded SystemView, Target Sources to any location.
  15. Open the unzipped files and navigate to Sample->embOS->Config->Cortex-M.
  16. Copy SEGGER_SYSVIEW_Config_embOS.c into SolutionDir->SEGGER->Generic
  17. Now navigate to SolutionDir->OS->Generic and copy the following files from ESPRODir->OS->Generic:
    • JLINKMEM_Process.c
    • OS_Error.c
    • OS_ThreadSafe.c
      ESPRO BareMetal OS Generic Source.PNG
  18. After that create a RTOS Init file in SolutionDir->OS->Setup, how to create a RTOS init file can be found here: https://www.segger.com/doc/UM01076_embOS_Ultra.html#Board_Support_Packages
    ESPRO BareMetal OS Setup Source.PNG
  19. Go back to Embedded Studio and open the project settings.
  20. Switch to the common build configuration and navigate to Code->Preprocessor->User Include Directories
  21. After that add the following User Include Directories:
    • $(ProjectDir)/
    • $(ProjectDir)/CMSIS_5/CMSIS/Core/Include
    • $(ProjectDir)/STM32F7xx/Device/Include
    • $(ProjectDir)/SEGGER/Generic
      ESPRO BareMetal includes.PNG
  22. Drag and Drop the SEGGER and OS Folder from your SolutionDir into the project window of Embedded studio.
  23. Activate in both folders Recurse into subdirectories via Right click on the folder->Code->Folder->Dynamic Folder Recurse->Recurse into subdirectories.
  24. Close the options window and synchronize both folder with disk via Right click->Synchronize with disk.
  25. Drag an Drop both files of the downloaded files on top of the article into your SolutionDir.
  26. Drag and Drop both files of the downloaded files on top of the article into your virtual source folder in Embedded Studio.
    • The SolutionDir should now look as follows
      ESPRO BareMetal folders.PNG
    • The ES project explorer should now look as follows:
      ESPRO BareMetal project explorer.PNG
  27. Now build the project and start the debug session.

If everything works fine, two console outputs will be printed successively.