I'm developing an embedded application using Keil MicroVision 4 & STM32F103RE I've splited Flash memory of device into two areas (IROM1 & IROM2) using IDE target options panel (Target tab, Read only memory areas section) & also setted IROM2 as default & startup, but seems the program does NOT run from specified address. Should I do anything more than told configurations to start running program from an address rather than FLASH_BASE (0x08000000 in my case)?
1 Answer
In system_device.c (where device is stm32f1xx in your case) you have to change SCB->VTOR to IROM2 Base Address in SystemInit() function definition. You can also change it in the top of the system_device.c file by uncommenting "#define USER_VECT_TAB_ADDRESS" and changing "VECT_TAB_BASE_ADDRESS" to the desired address by using the exact address or predefined FLASH_BANK2_BASE. The last thing is, The MCU must start from that address. You can change the boot address by writing in flash option bytes in programmer app or in the runtime. Or if you don't want to change the option bytes, you can write a bootloader in the default address and jump to the IROM2 in runtime.