- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The attached project is not loading AppB. It looks like it not updating the metadata for AppA and AppB correctly.
I've incorporated https://community.cypress.com/docs/DOC-15385 in the build process by running
"C:\Program Files (x86)\Cypress\PSoC Creator\4.2\PSoC Creator\bin\cyelftool.exe" -M AppA.cydsn\CortexM3\ARM_GCC_541\Debug\AppA_1.elf AppB.cydsn\CortexM3\ARM_GCC_541\Debug\AppB_2.elf DualBoot.hex --flash_size 131072 --flash_row_size 256
And added https://community.cypress.com/message/35229#35229 suggestion of using CySetTemp() to get Bootloadable_1_SetActiveApplication(1) to return CYRET_SUCCESS.
The way this works is I short button1 and it is suppose to switch between AppA and AppB or visa versa. Right now it just goes back to AppA.
Any help would be much appreciated.
App A
// App A
#include "project.h"
#define PRESSED (1u)
#define WAITING (0u)
volatile uint8_t button1_pressed = WAITING;
CY_ISR(button1ISR)
{
button1_pressed = PRESSED;
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
isr_button1_StartEx(button1ISR);
CySpcStart();
for(;;)
{
LED1_Write(0xffu);
CyDelay(100);
LED1_Write(0u);
CyDelay(100);
if (button1_pressed == PRESSED)
{
CySetTemp();
cystatus status = Bootloadable_1_SetActiveApplication(1);
if (CYRET_SUCCESS == status )
{
CyDelay(3000);
Bootloadable_1_Load();
}
button1_pressed = WAITING;
}
}
}
Bootloader
#include "project.h"
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
CySpcStart();
uint32_t status_AppA = Bootloader_1_GetMetadata(Bootloader_1_GET_BTLDB_STATUS, 0);
uint32_t status_AppB = Bootloader_1_GetMetadata(Bootloader_1_GET_BTLDB_STATUS, 1);
LED1_Write(0x00);
cystatus temp_status = CySetTemp();
if (temp_status != CYRET_SUCCESS)
Bootloader_1_Start();
if (status_AppA == 1 && status_AppB == 1)
Bootloader_1_Exit(Bootloader_1_EXIT_TO_BTLDB_1);
if (status_AppB == 1u)
Bootloader_1_Exit(Bootloader_1_EXIT_TO_BTLDB_2);
if (status_AppA == 1u)
Bootloader_1_Start();
Bootloader_1_Exit(Bootloader_1_EXIT_TO_BTLDB_1);
/*
for(;;)
{
}
*/
}
AppB
// App B
#include "project.h"
#define PRESSED (1u)
#define WAITING (0u)
volatile uint8_t button1_pressed = WAITING;
CY_ISR(button1ISR)
{
button1_pressed = PRESSED;
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
isr_button1_StartEx(button1ISR);
CySpcStart();
for(;;)
{
LED1_Write(0xffu);
CyDelay(1000);
LED1_Write(0u);
CyDelay(1000);
if (button1_pressed == PRESSED)
{
CySetTemp();
if (CYRET_SUCCESS == Bootloadable_1_SetActiveApplication(0))
{
CyDelay(3000);
Bootloadable_1_Load();
}
button1_pressed = WAITING;
}
}
}
Solved! Go to Solution.
- Tags:
- dual-application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please refer to attached reference example for Application Image switching.
volatile uint32_t testresult =0xFF;
int main()
{
uint8 runningApp;
CyGlobalIntEnable; /* Enable global interrupts. */
/* Initialize the in app bootloader */
Loader_Initialize();
/* store current active image in order to switch images later */
runningApp = Loader_GetRunningAppStatus();
for(;;)
{
/* Ping bootloader interface for in app updates */
Loader_HostLink(1u);
/* Check for a switch press, if the switch is pressed, switch the active image and reset */
if (SW_0_Read() == 0u)
{
if (App_MD_BTLDB_ACTIVE_0 == runningApp)
{
testresult = App_SetActiveApplication(App_MD_BTLDB_ACTIVE_1);
if(CYRET_SUCCESS == testresult)
{
CySoftwareReset();
}
}
else if (App_MD_BTLDB_ACTIVE_1 == runningApp)
{
testresult = App_SetActiveApplication(App_MD_BTLDB_ACTIVE_0);
if(CYRET_SUCCESS == testresult)
{
CySoftwareReset();
}
}
else
{
}
CySoftwareReset();
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please refer to attached reference example for Application Image switching.
volatile uint32_t testresult =0xFF;
int main()
{
uint8 runningApp;
CyGlobalIntEnable; /* Enable global interrupts. */
/* Initialize the in app bootloader */
Loader_Initialize();
/* store current active image in order to switch images later */
runningApp = Loader_GetRunningAppStatus();
for(;;)
{
/* Ping bootloader interface for in app updates */
Loader_HostLink(1u);
/* Check for a switch press, if the switch is pressed, switch the active image and reset */
if (SW_0_Read() == 0u)
{
if (App_MD_BTLDB_ACTIVE_0 == runningApp)
{
testresult = App_SetActiveApplication(App_MD_BTLDB_ACTIVE_1);
if(CYRET_SUCCESS == testresult)
{
CySoftwareReset();
}
}
else if (App_MD_BTLDB_ACTIVE_1 == runningApp)
{
testresult = App_SetActiveApplication(App_MD_BTLDB_ACTIVE_0);
if(CYRET_SUCCESS == testresult)
{
CySoftwareReset();
}
}
else
{
}
CySoftwareReset();
}
}
}