2 Replies Latest reply on Jun 27, 2019 9:51 PM by WiLe_295706

    Help passing variable from bootloader to bootloadable app on PSoC 4M

    WiLe_295706

      I am looking for an example of passing a variable from the Bootloader component to the Bootloadable application on a PSoC 4200M. Even a single 16-bit value is sufficient.

       

      Basically, I need a piece of uninitialized RAM shared between the two pieces of code.

      Thanks,

      Bill

        • 1. Re: Help passing variable from bootloader to bootloadable app on PSoC 4M
          NoriakiT_91

          This solution is confirmed only in GCC tool-chain.

          There is a RAM section named ".btldr_run" declared in the linker script cm0gcc.ld as follows.

           

              .btldr_run (NOLOAD) : ALIGN(8)
              {
                  KEEP(*(.bootloaderruntype))
              }
          

           

          Originally, this section is used to pass the RUN-TYPE parameter to the Bootloadable by the Bootloader.  This section seems to be used by user.

           

          To use the section, declare your own variable specifying the section name.

           

          volatile uint8 bootParams[16] CY_SECTION(".bootloaderruntype");
          

           

          Please note that this declaration is required both bootloader and bootloadable.

           

          .btldr_run      0x200000c0       0x14
           *(.bootloaderruntype)
           .bootloaderruntype
                          0x200000c0       0x10 .\CortexM0\ARM_GCC_541\Debug\main.o
                          0x200000c0                bootParams
           .bootloaderruntype
                          0x200000d0        0x4 .\CortexM0\ARM_GCC_541\Debug\Cm0Start.o
                          0x200000d0                cyBtldrRunType
          

           

          It was found in the MAP file that the variable is located in the specified section.  In my case, the user-defined variable is located before the variable CyBtldrRunType.  The order of these variables are specified by the object file linking order.  If you want to ensure the variable order, you must modify the system-provided linker file.

           

          I added an example project.

           

          Regards,

          Noriaki

          • 2. Re: Help passing variable from bootloader to bootloadable app on PSoC 4M
            WiLe_295706

            This looks excellent! Thank you. I will test it with my app.

             

            Update: I implemented this and it worked perfectly.

            Thanks again,

            Bill