Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
WiLe_295706
Level 1
Level 1

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

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

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

View solution in original post

0 Likes
2 Replies
lock attach
Attachments are accessible only for community members.
NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

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

0 Likes

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

Update: I implemented this and it worked perfectly.

Thanks again,

Bill

0 Likes