cancel
Showing results for 
Search instead for 
Did you mean: 

Jumping from boot code to the application code

MANISH
Associate II
Posted on June 23, 2018 at 08:53

Hai, we want to jump from one code located at 0x8000000 to another code located at 0x8040000 . that jump condition is depending on the GPIO line .To jump we used the following code .

void APP_JumpToApplication(void)

{

pFunction Jump = (pFunction)(*(uint32_t*)(ADDR_FLASH_SECTOR_5+4));

HAL_RCC_DeInit();

HAL_DeInit();

NVIC->ICER[ 0 ] = 0xFFFFFFFF ; // clearing all the pending interrupt request

NVIC->ICER[ 1 ] = 0xFFFFFFFF ;

NVIC->ICER[ 2 ] = 0xFFFFFFFF ;

NVIC->ICER[ 3 ] = 0xFFFFFFFF ;

NVIC->ICER[ 4 ] = 0xFFFFFFFF ;

NVIC->ICER[ 5 ] = 0xFFFFFFFF ;

NVIC->ICER[ 6 ] = 0xFFFFFFFF ;

NVIC->ICER[ 7 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 0 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 1 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 2 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 3 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 4 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 5 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 6 ] = 0xFFFFFFFF ;

NVIC->ICPR[ 7 ] = 0xFFFFFFFF ;

SysTick->CTRL = 0; // disable the system ticks

SysTick->LOAD = 0;

SysTick->VAL = 0;

SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk ; //

if( CONTROL_SPSEL_Msk & __get_CONTROL( ) )

{ /* MSP is not active */

__set_CONTROL( __get_CONTROL( ) & ~CONTROL_SPSEL_Msk ) ;

}

SCB->SHCSR &= ~( SCB_SHCSR_USGFAULTENA_Msk |

SCB_SHCSR_BUSFAULTENA_Msk |

SCB_SHCSR_MEMFAULTENA_Msk ) ;

&sharpif (SET_VECTOR_TABLE)

SCB->VTOR = ADDR_FLASH_SECTOR_5; // setting the vector ta ble address

&sharpendif

__set_MSP(*(__IO uint32_t*)ADDR_FLASH_SECTOR_5);

Jump(); // the loction to which the application is present.

}

it jumps fine when the code is located at 0x8000000 is only a small gpio initialization(code size is 4kbytes) when in the same if we initialized ethernet Jump will not takes place(code size is 40kbytes) . can you please help in this regards .

best regards 

 maheshwar

#jump #boot #stm32f7
6 REPLIES 6
Ben K
Senior III
Posted on June 23, 2018 at 10:24

And you are calling this function from a thread, and not from an interrupt context, right?

Posted on June 23, 2018 at 10:29

Yaaaa it's not interrupt.....By polling methods we are doing...

Posted on June 23, 2018 at 17:50

>>can you please help in this regards

Use a debugger. Step the code and follow where it goes. These tools are provided so you can understand what is happening rather than that it 'doesn't work'.

Make sure you have an application image loaded at 0x08040000, and that the vector table content matches what you've created with the linker. Check the .MAP, check the Reset_Handler entry point, and walk through the transition until it gets to your main() function.

If it doesn't get there, provide some analysis about what does actually occur, how far it gets, and where it stops functioning or gets stuck.

Have proper Hard Fault Handlers in both Loader and App so they can report fault information should you end up there.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 24, 2018 at 08:29

Thank you for the reply . The vector table is relocated .and the application is placed at the 0x08040000, but the code is not jumping when we initialized the ethernet (when i call this function netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, &ethernetif_init, &ethernet_input); in side the MX_LWIP_Init(); function ) .

Posted on June 24, 2018 at 15:47

Do you have Error_Handler and HardFault_Handler instrumented, does it end up in those?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 25, 2018 at 06:38

I am unable to find where the code is is ending.till to this function (

Jump(); // the location to which the application is present.

) this function code is running and after that i am not having the control. But in place of the 0x8000000 if i place a code with out ethernet initialization (LWIP) then it is jumping properly. if i initialize the ethernet (LWIP) then it is the problem . Code size is not the problem . i tried by increasing the code with out ethernet initialization.When i initialize the ethernet then it is giving the problem.

Best regards

Maheshwar