Runtime identification of BLE controller build/version/configuration

We are currently using ncs 2.9.0 on an nRF5340.  We use the BT_HCI_OP_VS_READ_VERSION_INFO to determine at runtime what version of the BLE stack is present.  This information seems to only contain the git hash for the source.  It does not seem to have anything about what configuration parameters were used to build the BLE stack.  In our case we want to know what configuration the BLE stack was build with (config parameter), so that our application can act appropriately.  Ideally, there would be a config parameter for the network firmware where we can additional specify our own version number field.  I wasn't able to find anything like that.  Does something like that exist?

Parents
  •  In our case we want to know what configuration the BLE stack was build with (config parameter), so that our application can act appropriately

    No, I do not think anything of this info is provided in that version info. 

    To keep track of exactly which SDK settings went into your network-core build, you can add your own version tag at compile time. You can drop a line like this into your child_image/.../prj.conf:

    CONFIG_FW_INFO_FIRMWARE_VERSION="your_custom_version_here"
    

    That string gets baked into the elf FW_INFO section. At runtime, your application can read this version from the image

  • We need this to work from the application firmware.

    The link you provided indicates that only works from MCUBoot, before the network firmware is started by the network boot loader?  Is that correct?

    If so, is there a way to reboot the network processor after the application starts and in that process get the network firmware version?

  • No, I do not think you need to reset your network core.

    If you include this in your net core prj.conf, then the firmware string should be built into the netcore ELF.

    CONFIG_FW_INFO=y
    CONFIG_PCD=y
    CONFIG_FW_INFO_FIRMWARE_VERSION="netcore_v2.9.0-mybuild"
    

    and in your app core prj.conf you have

    CONFIG_PCD=y
    CONFIG_PCD_APP=y
    CONFIG_PCD_READ_NETCORE_APP_VERSION=y
    CONFIG_NRF53_MULTI_IMAGE_UPDATE=y
    

    I am not 100% sure if I have covered all config dependencies but in the app core you should be able to query the string like below

    #include <fw_info.h>
    #include <pcd/pcd.h>
    
    void print_netcore_version(void)
    {
        char ver[64];
        int  len = pcd_network_core_app_version(ver, sizeof(ver));
        if (len < 0) {
            printk("Failed to read net-core version: %d\n", len);
        } else {
            ver[len] = '\0';
            printk("Running net-core version: %s\n", ver);
        }
    }
    

    I have not tested this and I know the code looks crude with hardcoded buffer sizes, so please use this as a template. I know that pcd_network_core_app_version is being used in other places in the NCS, so try to grep and understand more on how it is used. I hope this helps.

Reply
  • No, I do not think you need to reset your network core.

    If you include this in your net core prj.conf, then the firmware string should be built into the netcore ELF.

    CONFIG_FW_INFO=y
    CONFIG_PCD=y
    CONFIG_FW_INFO_FIRMWARE_VERSION="netcore_v2.9.0-mybuild"
    

    and in your app core prj.conf you have

    CONFIG_PCD=y
    CONFIG_PCD_APP=y
    CONFIG_PCD_READ_NETCORE_APP_VERSION=y
    CONFIG_NRF53_MULTI_IMAGE_UPDATE=y
    

    I am not 100% sure if I have covered all config dependencies but in the app core you should be able to query the string like below

    #include <fw_info.h>
    #include <pcd/pcd.h>
    
    void print_netcore_version(void)
    {
        char ver[64];
        int  len = pcd_network_core_app_version(ver, sizeof(ver));
        if (len < 0) {
            printk("Failed to read net-core version: %d\n", len);
        } else {
            ver[len] = '\0';
            printk("Running net-core version: %s\n", ver);
        }
    }
    

    I have not tested this and I know the code looks crude with hardcoded buffer sizes, so please use this as a template. I know that pcd_network_core_app_version is being used in other places in the NCS, so try to grep and understand more on how it is used. I hope this helps.

Children
No Data
Related