2011-07-26 09:15 AM
Hi everyone,
I am new to the ARM Chips and am trying to implement a bootloader using the example code from AN2557.
I am using IAR workbench for ARM 6.2 and a segger Jlink educational JTAG.
In IAR I have 2 separate projects. One for the bootloader and another for the user application.
I have set the bootloader to be programmed at address 0x8000000 and the user app at 0x8003000
when I get to this part in the code:
if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x2000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
Jump_To_Application = (pFunction) JumpAddress;
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x3000);
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) ApplicationAddress);
Jump_To_Application();
}
}
it does not execute the If statement. I dont know if I understand exactly whats going on.
Thank you for your help
#stm32-bootloader2011-07-26 09:21 AM
if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x2000000)
It's confirming the stack is in RAM, and the comparative address should be 0x20000000 (Seven Zeros, Not Six)2011-07-26 10:01 AM
Clive1,
Thank you for your reply.
I forgot to mention my application address in code is defined:
#define ApplicationAddress 0x08003000
shouldn't this work then?
Mike
2011-07-26 10:47 AM
shouldn't this work then?
It should work if your comparison used 0x20000000 (SEVEN TRAILING ZEROS) and not 0x02000000 (SIX TRAILING ZEROS) And that you RAM address is correctly defined in your Linker Script, Scatter File, or GUI interface.2016-01-26 01:01 AM
I found following and did not understand why __set_MSP(0x20002000) , why main stack pointer hold 0x20002000 ; why not 0x20000000 (sram start address) for stm32f429.
When I debug and look in 0x1FFF0000 , I saw 0x20002318?
Should I use __set_MSP(0x20002318) ?
void jump_to_BootLoader(void) {
void (*SysMemBootJump)(void) = (void (*)(void)) (*((uint32_t *) 0x1FFF0004));
__set_PRIMASK(1);
RCC_DeInit();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);
__set_MSP(0x20002000);
SysMemBootJump();
}
2016-01-26 06:50 AM
why not 0x20000000
Because the stack descends? And you want to mount it to the ceiling, not the floor.