
TestApp
Revision 1:49ec3704c354, committed 2018-10-20
- Comitter:
- riaancillie
- Date:
- Sat Oct 20 21:48:04 2018 +0000
- Parent:
- 0:3b55022dc9d3
- Commit message:
- two
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3b55022dc9d3 -r 49ec3704c354 main.cpp --- a/main.cpp Sat Oct 20 21:35:36 2018 +0000 +++ b/main.cpp Sat Oct 20 21:48:04 2018 +0000 @@ -7,10 +7,21 @@ Serial pc(SERIAL_TX, SERIAL_RX); -DigitalOut myled(LED1); +DigitalOut myled(PC_13); int main() { + __disable_irq(); //Should still be disabled from when you jumped out of the bootloader, but disable again for safety. + uint32_t *old_vectors = (uint32_t *)(0x08010000U); //Or wherever you placed your main application + uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS; + for (int i = 0; i < NVIC_NUM_VECTORS; i++) { + vectors[i] = old_vectors[i]; + } + SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS; + __enable_irq(); //Re-enable IRQ. In theory your vector table should now be copied and interrupt *should* work. + + + pc.baud(115200); int i = 1; pc.printf("Hello World !\n"); while(1) {