Skip to main content
MANISH
Associate III
June 23, 2018
Question

Jumping from boot code to the application code

  • June 23, 2018
  • 2 replies
  • 1789 views
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
This topic has been closed for replies.

2 replies

Ben K
Senior III
June 23, 2018
Posted on June 23, 2018 at 10:24

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

MANISH
MANISHAuthor
Associate III
June 23, 2018
Posted on June 23, 2018 at 10:29

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

Tesla DeLorean
Guru
June 23, 2018
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 VenmoUp vote any posts that you find helpful, it shows what's working..
MANISH
MANISHAuthor
Associate III
June 24, 2018
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 ) .

Tesla DeLorean
Guru
June 24, 2018
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 VenmoUp vote any posts that you find helpful, it shows what's working..