So in STM32F205RE flash memory spans from 0x08000000 to 0x0807FFFF. Any app will be programmed starting from the address 0x08000000. But I want to place it at the starting address of 0x08040000 and don't use the beginning of the flash at all. I'm using IAR and I changed the ROM boundaries in the Linker file to be 0x08040000-0x0807FFFF, vector table starting address also moved to 0x08040000 and finally SCB->VTOR = 0x08040000. But the program just doesn't work. It loads my app to the flash, but it doesn't work properly. For some reason it gets stuck on the first while() located in RCC (while ((RCC->BDCR & RCC_BDCR_LSERDY)==0);) and in the debugger it feels like it doesn't do anything before that (even though it shows that it does) -- step overs are done very quickly, in a instant.
So is it supposed to be not working like that and application have to be placed at the beginning of flash or am I missing something? I wanted to place a custom bootloader at the 0x08000000, but I also wanted my application to load at first, not the bootloader.