<commit_before>#ifdef STM32F4
  #define PANDA
  #include "stm32f4xx.h"
#else
  #include "stm32f2xx.h"
#endif

#include "early.h"
#include "libc.h"

#include "crypto/rsa.h"
#include "crypto/sha.h"

#include "obj/cert.h"

void lock_bootloader() {
  if (FLASH->OPTCR & FLASH_OPTCR_nWRP_0) {
    FLASH->OPTKEYR = 0x08192A3B;
    FLASH->OPTKEYR = 0x4C5D6E7F;

    // write protect the bootloader
    FLASH->OPTCR &= ~FLASH_OPTCR_nWRP_0;

    // OPT program
    FLASH->OPTCR |= FLASH_OPTCR_OPTSTRT;
    while (FLASH->SR & FLASH_SR_BSY);

    // relock it
    FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK;

    // reset
    NVIC_SystemReset();
  }
}

void __initialize_hardware_early() {
  lock_bootloader();
  early();
}

void fail() {<commit_msg>disable bootloader locking for now<commit_after>#ifdef STM32F4
  #define PANDA
  #include "stm32f4xx.h"
#else
  #include "stm32f2xx.h"
#endif

#include "early.h"
#include "libc.h"

#include "crypto/rsa.h"
#include "crypto/sha.h"

#include "obj/cert.h"

void lock_bootloader() {
  if (FLASH->OPTCR & FLASH_OPTCR_nWRP_0) {
    FLASH->OPTKEYR = 0x08192A3B;
    FLASH->OPTKEYR = 0x4C5D6E7F;

    // write protect the bootloader
    FLASH->OPTCR &= ~FLASH_OPTCR_nWRP_0;

    // OPT program
    FLASH->OPTCR |= FLASH_OPTCR_OPTSTRT;
    while (FLASH->SR & FLASH_SR_BSY);

    // relock it
    FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK;

    // reset
    NVIC_SystemReset();
  }
}

void __initialize_hardware_early() {
  //lock_bootloader();
  early();
}

void fail() {
{'fraction_non_alphanumeric': 0.1398789509078682, 'fraction_numerical': 0.03093476798924008, 'mean_word_length': 3.4417910447761195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6110111', 'n_tokens_mistral': 668, 'n_tokens_neox': 634, 'n_words': 112}