Fixed my own problem, was running the wrong command to wipe the pages.
Got a new problem now, branching to the code results in a crash.
Here's the code snippet I use for this. As far as I understand, this should set the stack pointer to whatever's at the start of the code, then branch the code to my reset ISR.
#define APP_START_ADDR (0x00001000UL)
SCB->VTOR = ( uint32_t )APP_START_ADDR ;
/* Load main stack pointer with application stack pointer initial value,
stored at first location of application area */
asm volatile("ldr r0, =0x1000");
asm volatile("ldr r0, [r0]");
asm volatile("mov sp, r0");
/* Load program counter with application reset vector address, located at
second word of application area. */
asm volatile("ldr r0, =0x1004");
asm volatile("ldr r0, [r0]");
asm volatile("mov pc, r0");
Here's my memory map for the main code in case this is wrong:
MEMORY
{
/* Define each memory region */
MFlash256 (rx) : ORIGIN = 0x1000, LENGTH = 0x39000 /* 252K bytes (alias Flash) (4k by bootloader) */
Ram0_32 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x7FE0 /* 32K bytes (alias RAM) less 32 bytes for IAP */
Ram1_2 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x800 /* 2K bytes (alias RAM2) */
Ram2USB_2 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800 /* 2K bytes (alias RAM3) */
}
/* Define a symbol for the top of each memory region */
__base_MFlash256 = 0x1000 ; /* MFlash256 */
__base_Flash = 0x1000 ; /* Flash */
__top_MFlash256 = 0x1000 + 0x39000 ; /* 256K bytes */
__top_Flash = 0x1000 + 0x39000 ; /* 256K bytes */
__base_Ram0_32 = 0x10000000 ; /* Ram0_32 */
__base_RAM = 0x10000000 ; /* RAM */
__top_Ram0_32 = 0x10000000 + 0x7FE0 ; /* 32K bytes */
__top_RAM = 0x10000000 + 0x7FE0 ; /* 32K bytes */
__base_Ram1_2 = 0x20000000 ; /* Ram1_2 */
__base_RAM2 = 0x20000000 ; /* RAM2 */
__top_Ram1_2 = 0x20000000 + 0x800 ; /* 2K bytes */
__top_RAM2 = 0x20000000 + 0x800 ; /* 2K bytes */
__base_Ram2USB_2 = 0x20004000 ; /* Ram2USB_2 */
__base_RAM3 = 0x20004000 ; /* RAM3 */
__top_Ram2USB_2 = 0x20004000 + 0x800 ; /* 2K bytes */
__top_RAM3 = 0x20004000 + 0x800 ; /* 2K bytes */