Update property.c

Hardcode the clock and peripheral configuration of the bootloader, to avoid a corrupted user image to break the bootloader in the field.
This commit is contained in:
santiagogf89
2017-02-11 19:08:26 +01:00
committed by GitHub
parent 2e55cd6257
commit d9a26f48dc

View File

@@ -138,6 +138,14 @@ status_t bootloader_property_load_user_config(void)
memset(config, 0xff, sizeof(bootloader_configuration_data_t));
}
}
// SGF - Even if the user has uploaded an application with the wrong bootloader config, we want to avoid
// any possibility to break the bootloader, so we force the clock config and the peripheral config here.
config->tag = kPropertyStoreTag;
config->enabledPeripherals = 0x10; // [10:10] enabledPeripherals /* SGF Bit 4 corresponds to USB HID */
config->peripheralDetectionTimeoutMs = 5000;
config->clockFlags = 0x00;
config->clockDivider = 0xFF;
config->bootFlags = 0xFE;
// Update available peripherals based on specific chips
update_available_peripherals();