cancel
Showing results for 
Search instead for 
Did you mean: 

Flash loader demo

hajianik
Associate II
Posted on September 01, 2015 at 21:21

Hi,

I'm trying to use the Flash Loader demo Tool to down load my hex file.

I need to bypass the hard wiring of the boot pins to 0 and 1 and just jump to where the boot loader reset handler resides.

I searched the forum and I found the following piece of code which is executed right off the reset. You can say it is my reset handler .

Reset_Handler    PROC

                 EXPORT  Reset_Handler             [WEAK]

               LDR     R0, =0x40023844 ; RCC_APB2ENR

                LDR     R1, =0x00004000 ; ENABLE SYSCFG CLOCK

                STR     R1, [R0, #0]

                LDR     R0, =0x40013800 ; SYSCFG_MEMRMP

                LDR     R1, =0x00000001 ; MAP ROM AT ZERO

                STR     R1, [R0, #0]

                LDR     R0, =0x1FFF0000 ; ROM BASE

                LDR     SP,[R0, #0]     ; SP @ +0

                LDR     R0,[R0, #4]     ; PC @ +4

                BX      R0

                                 ENDP

I can see that it is jumping to the system memory region both by single stepping and letting it run however when firing the demo Tool ,I keep getting error messages and no response, don't know if anyone has the same issue or know the solutions.

any help is much appreciated.

 

Koorosh
3 REPLIES 3
Posted on September 01, 2015 at 22:09

And you're using what part exactly? ST makes hundreds of STM32 variants, and some of them are quite different to each other.

The code was designed to be electively called at reset depending if you wanted your primary code to run, or the System Loader.

What errors do you get, be specific, it's very hard to trouble shoot issues with this level of detail.

How are you connecting to your STM32 part? Are you using a USB-to-CMOS Serial adapter, or RS232 level converters? Are you using Even Parity when specifying serial connectivity?

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

Hi,

Thanks for the response, Actually The issue was the wrong Com port which is fixed however when I open the select device tab all I see are STM8 parts. My device is STM32F427ZIT.  in the read me or version file that came with the package , It is said that it supports the stm32f4 series. The demo version that I down loaded is 2.5. Do you know where would I  download the version that supports my target. eventually however I would like to jump to the system boot loader not from reset but from anywhere within my application . in that case I know in addition to mapping the system boot ldr to address 0 , I need to switch to HSE and may be reset PLL, DISABLE IRQ , ANYTHING ELSE NEEDS TO BE DONE BEFORE I JUMP TO SYSTEM FLASH LOADER?

I realize I need to be as close as possible to reset condition. Please if you're aware of anything else let me know

Thanks,

KOOROSH
hajianik
Associate II
Posted on September 02, 2015 at 00:44

I believe I've downloaded v2.8 from:

http://www.st.com/web/en/catalog/tools/PF257525

#

I am not certain if it is temp or permanent, but it is working for me. I just hope it is not a temp license

As the other part of the question about jumping to the boot from anywhere in application, I did this from main() and It seems to be working however needs to be tested a bit more thoroughly:

 

__disable_irq();

 __HAL_RCC_SYSCFG_CLK_ENABLE();

 //SET BOOT MODE TO 01 IN SYSCFG->MEMRM

 SYSCFG->MEMRMP=1;

 //RCC->CR |= (uint32_t)0x00000001;

  NVIC->ICER[0] = (uint32_t)~0ul;

  NVIC->ICER[1] = (uint32_t)~0ul;

  NVIC->ICER[2] = (uint32_t)~0ul;

  NVIC->ICPR[0] = (uint32_t)~0ul;

  NVIC->ICPR[1] = (uint32_t)~0ul;

  NVIC->ICPR[2] = (uint32_t)~0ul;

  SysTick->CTRL = 0;

  /* Reset the RCC clock configuration to the default reset state ------------*/

  /* Set HSION bit */

  RCC->CR |= (uint32_t)0x00000001;

  /* Reset CFGR register */

  RCC->CFGR = 0x00000000;

  /* Reset HSEON, CSSON and PLLON bits */

  RCC->CR &= (uint32_t)0xFEF6FFFF;

  /* Reset PLLCFGR register */

 RCC->PLLCFGR = 0x24003010;

  /* Reset HSEBYP bit */

  RCC->CR &= (uint32_t)0xFFFBFFFF;

  /* Disable all interrupts */

  RCC->CIR = 0x00000000;

  FLASH->ACR = 0;

  __ISB();

  __DSB();

JumpAddress = *(__IO uint32_t*) (ApplicationAddress );

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

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

pFunction(); If you see anything wrong or misplaced please let me know.

Thanks,

Koorosh