This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: Is there a way to set device info using external file?

Part Number: CC2340R5

Tool/software:

Hi,

I will generate release firmware with jenkins, and I want to give each build a special version.

For now, I write firmware version with a const string, and set it in app_dev_info.c -> DevInfo_start function as bellow,

DevInfo_setParameter(DEVINFO_FIRMWARE_REV, strlen(firm_ver), (void *)firm_ver);

My goal is use jenkins write firmware version to file version.txt, then build bluetooth firmware, read version from version.txt, and set this to bluetooth device info. 

So is there have a way to compile external file into app, then I can use the value to set firmware version?

  • Hello Xuefeng,

    Thanks for reaching out. I am thinking about using the post-build steps to modify the output binary file with a similar approach to what imgtool does. Could you please take a look at how imgtool (inside SDK: \tools\common\mcuboot) is used for OAD image creation purposes inside the OAD examples? (Inside the SDK: \examples\rtos\LP_EM_CC2340R53\ble5stack\basic_ble_oad_dual_image).

    BR,

    David.

  • Hi David,

    This can change the header of firmware, but device info firmware version not changed. Here's a picture as bellow, I need the marked service change as the header, if header change to V2, the "Firmware Version" should also be V2.

  • Hello Xuefeng,

    The header is modified as you mentioned, and this information is read by the MCUBoot. Same way your application can read the information from flash and modify the Firmware revision string.

    Let me know what you think.

    BR,

    David.

  • Hi David,

    My goal is use jenkins write firmware version to file version.txt, then build bluetooth firmware, read version from version.txt, and set this to bluetooth device info. 

    I mean I should fill header version and  firmware revision string with one modify, I will write version info in a file, and I need header and firmware revision both read version file to get the version. 

    How can I read and fill the two parts when compile with command?

    BR

  • Hi David,

    Same way your application can read the information from flash and modify the Firmware revision string.

    How can I read the header I modified?

    My project used mcuboot, persistent app and oad-on-chip app. I need read the header in oad-on-chip app.

    BR

  • Hello Xuefeng,

    Thanks for reaching out. I would suggest to take a look at an OAD example, for instance basic_ble_oad_dual_image. You can start by looking at the oad_profile.c file where the main OAD state machine (oadStateMachine) is defined. When starting a new OAD process (state is oadEventHandleStateIdle), then the program must verify the Header (using oadImgIdentifyWrite() function). The main function that runs this verification is SwUpdate_CheckImageHeader() (inside sw_update.c file), there you can see how the header value is read. In this scenario you can get the information before you are even writing to flash.

    BR,

    David.

  • Thanks David,

    I've tried follow mcuboot context_boot_go function, but got some error.

    I will try with your suggestion.

    BR