Bootloader now accessible with left OR right trim inwards

This commit is contained in:
Andre Bernet
2014-06-04 10:47:55 +02:00
parent b593d871a6
commit 54447a45a0
+19 -21
View File
@@ -100,30 +100,28 @@ void _bootStart()
bwdt_reset(); bwdt_reset();
} }
if ((GPIOE->IDR & 0x00000008) == 0) { if (((GPIOC->IDR & 0x00000002) == 0) || ((GPIOE->IDR & 0x00000008) == 0)) {
if ((GPIOC->IDR & 0x00000002) == 0) { // Bootloader needed
// Bootloader needed const uint8_t *src;
const uint8_t *src; uint8_t *dest;
uint8_t *dest; uint32_t size;
uint32_t size;
bwdt_reset(); bwdt_reset();
size = sizeof(BootCode); size = sizeof(BootCode);
src = BootCode; src = BootCode;
dest = (uint8_t *) 0x20000000; dest = (uint8_t *) 0x20000000;
for (; size; size -= 1) {
*dest++ = *src++;
}
// Could check for a valid copy to RAM here
// Go execute bootloader
bwdt_reset();
uint32_t address = *(uint32_t *) 0x20000004;
((void (*)(void)) (address))(); // Go execute the loaded application
for (; size; size -= 1) {
*dest++ = *src++;
} }
// Could check for a valid copy to RAM here
// Go execute bootloader
bwdt_reset();
uint32_t address = *(uint32_t *) 0x20000004;
((void (*)(void)) (address))(); // Go execute the loaded application
} }
// run_application() ; // run_application() ;