PSOC5LP Dual-application Bootloader For production

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

cross mob
Rile_3376121
Level 1
Level 1
First like received First like given

Hi Forums,

I have followed the https://www.cypress.com/documentation/application-notes/an73854-psoc-introduction-bootloaders

and created a "dual-application bootloadable" project which generates 5 files as show in the next image :

image_01.png

I would appreciate if somebody can help me out with next questions :

1) How "Hello_1.cyacd" and "Hello_2.cyacd" can be flashed to the target mcu ?

    - Do they have to be merged into a single HEX first ?

    - Or maybe if I flash "Hello_1.cyacd" the image is copy twice into the mcu flash memory?

   - AN73854 explains how to generate a dual-application bootloadable project .cyacd files but

     does not explain How to get them into the target mcu.

2) When Once "Hello_1.cyacd" and "Hello_2.cyacd" are in the mcu flash memory. I assume "Hello_1" execute by default.

     Once in the field if I want to upgrade the firmware with another update version let's say  "Hello_3.cyacd" and "Hello_4.cyacd" . How do I proceed?

     I assume I will only have to flash "Hello_3.cyacd" and this will replace "Hello_1.cyacd"?

     In the case of the new "Hello_3.cyacd" fails or its invalid the bootloader will run "Hello_2.cyacd" as a safe fallback?

3)  How to properly test a "dual-application bootloable" project ?

Thank you in advance

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hi,

If you want both Application_1 and Application_2 both as single application (say Application_1) you have to do the following steps:

1. Program the Bootloader.hex in to your board. In the Bootloader application you have to call the Bootloader_Start().

2. Now in bootloader host use Application_1_1.cyacd and Application_1_2.cyacd one by one and bootload those applications into flash. Please note that after bootloading Application_1_1.cyacd, you have to comeback to Bootloader project and then call the API either Bootloader_Start() or Bootloader_Exit(Bootloader_EXIT_TO_BTLDR) to bootload Application_1_2.cyacd

3. After botloading both the .cyacd files, from the bootloader application you have to call either Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_1); or Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_2); to switch between Application 1 or application_2. (In your case both applications are same).

4. From Application_1 or Application_2, you need to call Bootloadable_Load() to come back to Bootloader and start the selection process. Please check the attached project which implements the above steps.

Thanks

Ganesh

View solution in original post

5 Replies
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Suppose if you are developing a dual application bootloader, let us say you have 3 projects:

1.  DUAL_APP_BOOTLOADER

2. APPLICATION_1

3. APPLICATION_2

The DUAL_APP_BOOTLOADER is the application that contains bootloader component and communication component and that bootloads APPLICATION_1 and APPLICATION_2.

The Bootloadable component of the projects APPLICATION_1 and APPLICATION_2 are referenced to bootloader component of DUAL_APP_BOOTLOADER.

When you build the three projects you will see the following files:(path: .cydsn\CortexM0\ARM_GCC_541\Debug)

DUAL_APP_BOOTLOADER:             DUAL_APP_BOOTLOADER.hex

APPLICATION_1:                               APPLICATION_1_1.hex, APPLICATION_1_1.cyacd, APPLICATION_1_2.hex, APPLICATION_1_2.cyacd

APPLICATION_2:                               APPLICATION_2_1.hex, APPLICATION_2_1.cyacd, APPLICATION_2_2.hex, APPLICATION_2_2.cyacd

You can do any one of the following steps to fill your flash with 3 applications:

1. Pogram the DUAL_APP_BOOTLOADER.hex. After programming DUAL_APP_BOOTLOADER, you can bootload APPLICATION_1_1.cyacd and APPLICATION_2_2.cyacd.

You can also bootload APPLICATION_1_2.cyacd and APPLICATION_2_1.cyacd.

2. Program APLICATION_1_1.hex  and then bootload APPLICATION_2_2.cyacd

Or, Program APPLICATION_1_2.hex  and then bootload APPLICATION_2_1.cyacd

3. Program APLICATION_2_1.hex  and then bootload APPLICATION_1_2.cyacd

Or, Program APPLICATION_2_2.hex  and then bootload APPLICATION_1_1.cyacd

Hope the above explanations answers to your questions 1 and 2.

>>"3)  How to properly test a "dual-application bootloable" project ?"

--> Using Bootloader_Exit() API from the DUAL_APP_BOOTLOADER project, you can switch between APPLICATION_1 and APPLICATION_2 during boot process.

I am attaching a project for your reference. Kindly let us know if you have any queries:

Thanks

Ganesh

0 Likes

Thank you for your feedback GaneshD_41​. Much appreciated.

In the AN73854- PSOC Introcuction to Bootloaders (https://www.cypress.com/documentation/application-notes/an73854-psoc-introduction-bootloaders) page 23 says : "For a high-reliability application, you can place two copies of the same bootloadable project into flash".

How to accomplish this case in which the 2 apps are the same?

How to tell the bootloader what application should start or be marked as active?

My guess the in the bootloader code something else besides calling  "Bootloader_Start()" is needed but I could not find any examples in the case when App1 = App2 .

dual_boot_question.png

In a classic dual-app bootloader 3 hex files ( Hello.exe, Hello_1.exe, Hello_2.exe ) and 2 cyacd files are generated .

Is the Hello.exe generated for production purposes. ( In order to flash the bootloader + the 2 apps) using one single hex file?

Thank you.

0 Likes

Hi Forum,

Can anyone please help with these questions?

Thank you.

0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

If you want both Application_1 and Application_2 both as single application (say Application_1) you have to do the following steps:

1. Program the Bootloader.hex in to your board. In the Bootloader application you have to call the Bootloader_Start().

2. Now in bootloader host use Application_1_1.cyacd and Application_1_2.cyacd one by one and bootload those applications into flash. Please note that after bootloading Application_1_1.cyacd, you have to comeback to Bootloader project and then call the API either Bootloader_Start() or Bootloader_Exit(Bootloader_EXIT_TO_BTLDR) to bootload Application_1_2.cyacd

3. After botloading both the .cyacd files, from the bootloader application you have to call either Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_1); or Bootloader_Exit(Bootloader_EXIT_TO_BTLDB_2); to switch between Application 1 or application_2. (In your case both applications are same).

4. From Application_1 or Application_2, you need to call Bootloadable_Load() to come back to Bootloader and start the selection process. Please check the attached project which implements the above steps.

Thanks

Ganesh

GaneshD_41

Thank you very much for help

0 Likes