find_bsp

Loads a Board Support Package (BSP) into the project so that executables and libraries can reference it.

Syntax

find_bsp(
    ID <BSP ID>
    VERSION <version>
    MCU <device ID>
    ALIAS <alias>
    CONFIGURATION <BSP configuration>
    FRAMEWORKS <list of frameworks>
    FWCONFIGURATION <framework configuration>

    SOURCE <in-place BSP location>
    HWREGISTER_LIST_FILE <file.xml>
    C_STANDARD <C standard>
    CXX_STANDARD <C++ standard>
    SOURCE_PROJECT <relative path>

    [NO_GC_SECTIONS]
    [ENABLE_EXCEPTIONS]
    [ENABLE_RTTI]
    [DUMP_STACK_USAGE]
)

Overview

The find_bsp command loads a specific BSP (Board Support Package) and adds it into the project as a CMake library (with a few auxiliary libraries).

Use the add_bsp_based_executable and add_bsp_based_library commands to define executables and libraries using the referenced BSP.

A single Advanced CMake project can contain multiple targets using different BSPs. Use the ALIAS parameter in the find_bsp command along with the BSP_ALIAS parameter in other commands to explicitly reference a specific BSP instance.

The find_bsp command can also be used to load an in-place BSP (that is a part of a stand-alone project). In-place BSPs do not have ID/VERSION parameters and must specify the SOURCE parameter instead.

Parameters

ID
Specifies the ID of the loaded BSP. VisualGDB will automatically locate it under the %LOCALAPPDATA% directory, or download it if missing.

VERSION
Specifies the version of the loaded BSP.

MCU
Specifies the device that will be targeted by the referenced BSP.

ALIAS
Optional. Specifies the internal short name of this specific BSP instance. This parameter is useful when loading multiple BSPs within the same project and otherwise defaults to "BSP".

CONFIGURATION
Optional. Specifies a list of <key>=<value> pairs separated by spaces. The keys and values are specific to each specific BSP. Use the Embedded Project page of VisualGDB Project Properties to edit the BSP configuration in a meaningful way.

FRAMEWORKS
Optional. Specifies a list of embedded frameworks referenced together with the BSP, separated by spaces. Every executable and library created via add_bsp_based_executable or add_bsp_based_library command, that references this BSP instance, will automatically reference these frameworks. Use the Embedded Frameworks page of VisualGDB Project Properties to manage referenced frameworks in a meaningful way.

FWCONFIGURATION
Optional. Specifies a list of configuration parameters used by embedded frameworks. Use the Embedded Frameworks page of VisualGDB Project Properties to configure referenced frameworks in a meaningful way.

SOURCE
Only valid for the in-place BSPs. Specifies the relative path to the directory containing the in-place BSP. The actual list of files, and build options will be loaded from the bsp.cmake file inside the source directory.

HWREGISTER_LIST_FILE
Optional. Specifies the file listing the hardware registers for the currently selected device. This parameter is used by VisualGDB during debugging and does not affect building.

C_STANDARD
Optional. Specifies the C language standard applied to the BSP and all targets referencing this BSP instance. Supported values: 90, 99 and 11.

CXX_STANDARD
Optional. Specifies the C+ language standard applied to the BSP and all targets referencing this BSP instance. Supported values: 98, 11 and 14.

SOURCE_PROJECT
Only valid for BSPs generated from the STM32CubeMX projects. Specifies the relative path to the .ioc file.

NO_GC_SECTIONS
Optional. If specified, all targets using this BSP (including the BSP itself) will be built without the -ffunction-sections, -fdata-sections and -gc-sections flags, or their equivalents for IAR/Keil compilers. This will greatly increase the memory footprint of the applications.

ENABLE_EXCEPTIONS
Optional. If specified, all targets using this BSP (including the BSP itself) will be built with support for C++ exceptions. This may considerably increase the memory footprint and may not work with some devices.

ENABLE_RTTI
Optional. If specified, all targets using this BSP (including the BSP itself) will be built with support for C++ RTTI. This may considerably increase the memory footprint and may not work with some devices.

DUMP_STACK_USAGE
Optional. If specified, all targets using this BSP (including the BSP itself) will dump the stack usage into the .su files. VisualGDB can use the stack usage information when running the dynamic stack verification.

Remarks

You can configure most of the find_bsp parameters by opening the Properties window for the BSP node in Solution Explorer. In most cases there is no need to edit them manually.

Examples

The following example references the STM32 BSP version 2020.10 and selects the STM32F407VG device using the default 'BSP' alias:

find_bsp(ID com.sysprogs.arm.stm32
         VERSION 2020.10
         MCU STM32F407VG)

The syntax below references another instance of the STM32 BSP, targeting the STM32F746NG device. The same project can contain multiple BSPs, as long as they have different aliases. All BSP-related statements support the BSP_ALIAS parameter that selects a specific BSP instance:

find_bsp(ID com.sysprogs.arm.stm32
         VERSION 2020.10
         MCU STM32F746NG
         ALIAS AuxiliaryBSP)

add_bsp_based_executable(NAME Application2
                         SOURCES Application2.cpp
                         BSP_ALIAS AuxiliaryBSP)

The example below creates an in-place BSP using the default 'BSP' alias. The contents of the BSP are stored in the BSP folder and described in the BSP\bsp.cmake file:

find_bsp(SOURCE BSP)

See also

BSP-Related Statements, bsp_compile_definitions, bsp_compile_flags, bsp_include_directories, bsp_linker_flags,