2015-09-01 12:21 PM
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 R0ENDP
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. Koorosh2015-09-01 01:09 PM
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?2015-09-01 02:31 PM
2015-09-01 03:44 PM
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