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
Posted on March 31, 2015 at 19:11

Ok, so why not load the value for the stack pointer from the ROM, rather than assume it's a fixed value?

Also you'd want to consider what memory is mapped at ZERO. Covered this in a bunch of threads.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
brett23
Associate II
Posted on April 01, 2015 at 14:08

Thanks Clive

I changed  to below

But It still have  no response from the Uart when I send 0x7f

I am new to STM32 and obviously missing something 

Ideas?

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;

SYSCFG->MEMRMP = SYSCFG_MEMRMP_MEM_MODE_0 ;  ///debug SYSCFG_MEMRMP_MEM_MODE_0 = remap 001 = system

uint32_t p =  (*((uint32_t *) 0x1fff0000));   /// debug p returns 0x20002d40

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

SysMemBootJump();

while(1);

}

}

Posted on April 01, 2015 at 14:36

The boot loader expects to be started with close to reset conditions. Odds are you're very far away from doing that, and consequently it fails.

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/jumping%20to%20the%20bootloader%20via%20software%20does%20not%20permit%20dfu%20mode&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Uwe Bonnes
Principal III
Posted on April 01, 2015 at 16:31

Another option is to set the desired reset source in SYSCFG_MEMRMP and than to do a Vector reset via SCB_AIRCR_VECTRESET. This will reset the core and all interrupts, but leave the device registers and so the reset mapping as set.

brett23
Associate II
Posted on April 02, 2015 at 05:02

Hi Bonnes

 I did 

uint32_t r = SYSCFG->MEMRMP;

r = r &  ~SYSCFG_MEMRMP_MEM_MODE ;

SYSCFG->MEMRMP = r | SYSCFG_MEMRMP_MEM_MODE_0 ;  

                SCB->AIRCR  = (SCB->AIRCR | (1UL << SCB_AIRCR_VECTRESET_Pos))

 

 I have confirmed that My Option register is default  single Boot Mode as well.

 But it does Not jump to the bootloader?

Thanks

Uwe Bonnes
Principal III
Posted on April 02, 2015 at 14:14

libopencm3 defines

void scb_reset_system(void)

{

        SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ;

        while (1);

}

This is used in the blackmagic debug probe and works for me.

brett23
Associate II
Posted on April 03, 2015 at 14:31

I tried your code 

It jumps to Bootloader But I am still having the same Problem. NO Uart response.

I tried a NEW PCB and same issue.

?

Posted on April 03, 2015 at 15:45

So can you use a debugger and step into the ROM. When it's not responding via the USART can you stop it and see where it is?

Try jumping to the boot loader immediately, does that work?

; In startup_stm32f4xx.s
; ...
Reset_Handler:
; Add this code up first
LDR R0, =0x40023844 ; RCC_APB2ENR
LDR R1, =0x00004000 ; enable SYSCFG clock
STR R1, [R0, #0]
LDR R0, =0x40013800 ; SYSCFG_MEMRMP
LDR R1, =0x00000001 ; remap ROM at zero
STR R1, [R0, #0]
LDR R0, =0x1FFF0000 ; load ROM base
LDR SP,[R0, #0] ; assign main stack pointer
LDR R0,[R0, #4] ; load bootloader address
BX R0
; ...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
stm32forum
Associate II
Posted on April 03, 2015 at 16:54

And what about the hardware?

Does the uart works in ''normal'' mode?

Did you add pull ups to the rx/tx line?

http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf