From d9a26f48dcccd45a0b3409fc05b785036f4a7dad Mon Sep 17 00:00:00 2001 From: santiagogf89 Date: Sat, 11 Feb 2017 19:08:26 +0100 Subject: [PATCH] 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. --- src/property/src/property.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/property/src/property.c b/src/property/src/property.c index 28b2ee7..55459c3 100644 --- a/src/property/src/property.c +++ b/src/property/src/property.c @@ -138,7 +138,15 @@ 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();