Skip to content
Snippets Groups Projects
Commit 97a9d8e1 authored by C-Glick's avatar C-Glick
Browse files

Remap memory before jumping

Still not working
parent 8e5c6675
No related branches found
No related tags found
1 merge request!69Streamlined USB flashing
{
"files.associations": {
"controller.h": "c",
"typeinfo": "c"
"typeinfo": "c",
"attitude_controller.h": "c"
}
}
\ No newline at end of file
......@@ -182,13 +182,23 @@ static uint8_t usbd_cf_Setup(void *pdev , USB_SETUP_REQ *req)
} else if(command == 0x02){
//transition to DFU bootloader mode
// arm-none-eabi-gcc 4.9.0 does not correctly inline this
// // // MSP function, so we write it out explicitly here.
//shutdown any tasks running
RCC_DeInit();
SysTick->CTRL = 0; //reset the Systick timer
SysTick->LOAD = 0;
SysTick->VAL = 0;
__set_PRIMASK(1); //disable interrupts
SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SystemFlash);
//set main stack pointer to its default value
__set_MSP(*((uint32_t*) 0x00000000));
//__ASM volatile ("movs r3, #0\nldr r3, [r3, #0]\nMSR msp, r3\n" : : : "r3", "sp");
//jump to boot loader (start of system memory plus 4)
((void (*)(void)) *((uint32_t*) 0x00000004))();
while(1);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment