3 Replies Latest reply on Aug 30, 2018 11:08 PM by ShipingW_81

    Read Version of Bootloadable from within Bootloader

      For our software we want to present the current installed bootloadable version while the bootloader is active over BLE.

      The version string is automatically generated by our continuous integration system.


      We are using Map A outline (Chapter 4.1) described in http://www.cypress.com/file/385706/download


      We weren't able to find a fitting documentation how to share information between the bootloader and the bootloadable.

      What would be the best approach to implement such a feature with the current PSoC 6 SDK?

        • 1. Re: Read Version of Bootloadable from within Bootloader

          Please find the attached demo code for sharing variables between the (uart)bootloader and bootloadable.

          In that project, ram_share.c/h file is added to both app0/app1, and define the shared variables in section ".ram_shared".

          • 2. Re: Read Version of Bootloadable from within Bootloader

            Thank you ShipingW_81 for the provided example and the quick reply.


            We want to display the version info of the currently installed Bootloadable (App1) to the user in our MobileApp while the device is in Bootloader mode (App0).


            Our software version is stored in a compile-time constant in App1 like so (pseudocode):

            CY_SECTION(".flash_shared") const char* VersionInfo = "1.0.0-feature-x";

            This string is automatically generated during our pre-compile step.


            App0 should be able to read this string without otherwise interfering with App1 (not executing any code of App1; App1 might be damaged after all). This version info will of course change with the flashing of App1 and therefore has to reside in a known location in the bootloaded flash section (Application section, no user or meta section).

            Is this the recommended way to do this or did we miss any feature already providing this functionality in the Bootloader SDK?


            The questions we have regarding the example you gave us:

            1. We don't see how ram shared variables would help us in this situation since the variables cannot be filled by App1 without executing it.


            2. Even though the example was a good pointer in the right direction, we were unable to figure out how the sections ".ram_shared" and ".ram_shared2" would be mapped to a specific location in memory. Looking at the linker script, we were unable to find those. We tried using your file without any changes in our project and were quite surprised to find that it compiled just fine (we expected at least a warning that the specified sections were not declared or something along those lines). Is this some kind of wildcard behavior? Could you point us to some documentation on the linker scripts, so we can better understand how this automatism is working and at which memory location those sections will end up eventually?

            • 3. Re: Read Version of Bootloadable from within Bootloader

              Maybe you can either define a const data array for app version info using eeprom or metadata space.

              For eeprom, you can define custom const data array in default allocated section .cy_em_eeprom for both  app1 and app0, just like below:

              CY_SECTION(".cy_em_eeprom") CY_ALIGN(CY_FLASH_SIZEOF_ROW)

              const uint8_t Em_EEPROM_1_em_EepromStorage_1[Em_EEPROM_1_ACTUAL_SIZE] = {0u};

              Once the bootloading of app1 is done, the content of this section will be changed even though execution is changed back to app0.

              For metadata space, it is located outside of memory for both app0/app1, you can define custom data in section .cy_boot_metadata. For more details, please refer to content related to Appendix D in AN213924