Switch between App

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

cross mob
LuFa_1556081
Level 2
Level 2
First solution authored First reply posted First question asked

I managed to have two Apps (each with 2 cores) in the Psoc6 flash memory, How can I start the second App from the first one (I'm trying from the main() of the M0+)?

the first App start at 0x10000000

the second start at 0x100f0000

I tried SwitchToApp(0x08002000, 0x100f0000);  from the cy_dfu.c but it triggers a HardFault

static void SwitchToApp(uint32_t stackPointer, uint32_t address )
{
__asm volatile(" MSR msp, %[sp]\n"
" BX %[address] \n" : : [sp]"r"(stackPointer), [address]"r"(address) : "sp", "memory");
}

I tested also a call to the address of the main() of the second App from the main() of the first App but it triggers a HardFault too

uint32 * p = (uint32 *)0x100f02b1;
void (*fun_ptr)();
fun_ptr= (void *)p;
fun_ptr();

this is form the map file 

.text.startup.main
0x100f02b0 0x2a4 .\CortexM0p\ARM_GCC_541\Release\main_cm0p.o
0x100f02b0 main

the component is CY8C6347

0 Likes
1 Solution
LuFa_1556081
Level 2
Level 2
First solution authored First reply posted First question asked

I found that enabling the DFU_SDK (core and App Type) in the Build settings -> Peripheral Driver Library add new linker script and some very useful .c files than I defined a new Reset interrupt service routine in the main()

void Cy_OnResetUser(void){
Cy_DFU_OnResetApp0();
}

and called the second App like this:

do{
    Cy_SysLib_ClearResetReason();
}while(Cy_SysLib_GetResetReason() != 0);
Cy_DFU_ExecuteApp(1);

 

In the second App I enabled only the DFU_SDK core  

 

Hoping this can be helpful to someone else

View solution in original post

0 Likes
1 Reply
LuFa_1556081
Level 2
Level 2
First solution authored First reply posted First question asked

I found that enabling the DFU_SDK (core and App Type) in the Build settings -> Peripheral Driver Library add new linker script and some very useful .c files than I defined a new Reset interrupt service routine in the main()

void Cy_OnResetUser(void){
Cy_DFU_OnResetApp0();
}

and called the second App like this:

do{
    Cy_SysLib_ClearResetReason();
}while(Cy_SysLib_GetResetReason() != 0);
Cy_DFU_ExecuteApp(1);

 

In the second App I enabled only the DFU_SDK core  

 

Hoping this can be helpful to someone else

0 Likes