cancel
Showing results for 
Search instead for 
Did you mean: 

software Jump to Bootloader F429Z

brett23
Associate II
Posted on March 31, 2015 at 17:57

Hi I am trying to jump to the bootloader  on F429z  with using B0 B1 pins

using the code below

but when i send 0x7f on uart1 (from my remote client app) I get no response back at all

I have confirmed Buad rate 57600 8e1 with logic analyser.

The Stack Pointer is set to the Value( 0x20002d40) I see in address 0x1FFF0000. Is this correct?

Any Ideas to why i get no response?

Thanks

void (*SysMemBootJump)(void);

void BootLoaderInit(uint32_t BootLoaderStatus)

{

SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1FFF0004));

if(BootLoaderStatus ==1)

{ //Shut down any tasks running

__set_PRIMASK(1); //Disable Interupts

HAL_UART_MspDeInit(&UartHandle);

HAL_RCC_DeInit();

SysTick->CTRL = 0; //reset systic timer

SysTick->LOAD = 0;

SysTick->VAL = 0;

__set_MSP(0x20002d40); //Set the main stack pointer to its default values

SysMemBootJump();

while(1);

}

#bootloader-started-by-software #groundhog-day
12 REPLIES 12
brett23
Associate II
Posted on April 03, 2015 at 18:00

Hi Edje

 The Boards Usart is normally in use to an on board linux module.

It works fine 

When I jump to bootloader the Logic analyser sees High so pullups are active

I wonder if the Usart is still being controlled by the DMA (normal application operation) when I jump to bootloader.

even though I do HAL_UART_MspDeInit(&UartHandle);

before jumping

Thanks

 

brett23
Associate II
Posted on April 03, 2015 at 18:25

Hi Clive

I ''halted' the cpu during this freeze state

 MSP =0x20002d08

PC = 0x1fff329e

The Initial Jump locations are

MSP = 0x20002d40

PC = 0x1fff0004

what do you make out of that?

Thanks for your help

brett23
Associate II
Posted on April 04, 2015 at 18:55

Got it working

In order to get a ''close to reset'' state and run the bootloader , run the function ''BootLoaderInit()''

void BootLoaderInit(void)

{

(*(__IO uint32_t *) (BKPSRAM_BASE + 4)) = 0xDEADBEEF; // flag that will be readable after reboot

        // Reset the processor

       NVIC_SystemReset();

}

main()

{

// read backupsram flag if need to enter bootloader

 __PWR_CLK_ENABLE();

  __BKPSRAM_CLK_ENABLE();

  HAL_PWR_EnableBkUpAccess();

 uint32_t bt;

    bt = (*(__IO uint32_t *) (BKPSRAM_BASE + 4)) ;

if ( bt == 0xDEADBEEF ) {

        (*(__IO uint32_t *) (BKPSRAM_BASE + 4)) =  0xCAFEFEED; // Reset our trigger

         void (*SysMemBootJump)(void);

  __SYSCFG_CLK_ENABLE();

SYSCFG->MEMRMP |= SYSCFG_MEMRMP_MEM_MODE_0 ;

  uint32_t p =  (*((uint32_t *) 0x1fff0000));   /// debug p returns 0x20002d40  0x1fff0000 is the bootloader rom start address

  __set_MSP(p); //Set the main stack pointer to its defualt values                                                 

      SysMemBootJump = (void (*)(void)) (*((uint32_t *) 0x1FFF0004)); // Point the PC to the System Memory reset vector (+4)

 SysMemBootJump();

          while (1);

}

//continue to normal main init and application

Thanks all for your help