int main(void) { __stack_chk_guard = random32(); setup(); memory_protect(); oledInit(); // at least one button is unpressed uint16_t state = gpio_port_read(BTN_PORT); if ((state & BTN_PIN_YES) == BTN_PIN_YES || (state & BTN_PIN_NO) == BTN_PIN_NO) { check_firmware_sanity(); oledClear(); oledDrawBitmap(40, 0, &bmp_logo64_empty); oledRefresh(); uint8_t hash[32]; if (!signatures_ok(hash)) { show_unofficial_warning(hash); } load_app(); } bootloader_loop(); return 0; }
int main(void) { #ifndef APPVER setup(); #endif __stack_chk_guard = random32(); // this supports compiler provided unpredictable stack protection checks #ifndef APPVER memory_protect(); oledInit(); #endif #ifndef APPVER // at least one button is unpressed uint16_t state = gpio_port_read(BTN_PORT); int unpressed = ((state & BTN_PIN_YES) == BTN_PIN_YES || (state & BTN_PIN_NO) == BTN_PIN_NO); if (firmware_present() && unpressed) { oledClear(); oledDrawBitmap(40, 0, &bmp_logo64_empty); oledRefresh(); uint8_t hash[32]; int signed_firmware = signatures_ok(hash); if (SIG_OK != signed_firmware) { show_unofficial_warning(hash); timer_init(); } load_app(signed_firmware); } #endif bootloader_loop(); return 0; }