static void
sys_reset(void)
{
  copy_initialized();
  clear_bss();
  enable_fault_exceptions();
  start_hse_clock();
  use_pll();
  main();
  while(1);
  
}
Example #2
0
void _init()
{

  #ifndef NO_INIT
  use_default_clocks();
  use_pll(0, 0, 1, 31, 1);
  uart_init(115200);

  rt_kprintf("core freq at %ld Hz\n", get_cpu_freq());

  write_csr(mtvec, &trap_entry);
  if (read_csr(misa) & (1 << ('F' - 'A'))) { // if F extension is present
    write_csr(mstatus, MSTATUS_FS); // allow FPU instructions without trapping
    write_csr(fcsr, 0); // initialize rounding mode, undefined at reset
  }
  #endif

}
Example #3
0
static void
sys_reset(void)
{
    unsigned int volatile *d;
    d = dummy;

    /* turn on the internal oscillator */
    RCC->CR |= RCC_CR_HSION;

    /* turn off the external oscillator, the clock security system, and the PLL */
    RCC->CR &= (uint32_t)0xFEF6FFFF;

    /* disable and clear any pending interrupts  */
    RCC->CIR =
        RCC_CIR_LSIRDYC |
        RCC_CIR_LSERDYC |
        RCC_CIR_HSIRDYC |
        RCC_CIR_HSERDYC |
        RCC_CIR_PLLRDYC |
        RCC_CIR_CSSC;

    /* turn on the flash pre-fetch buffer and set its wait state to 2 */
    FLASH->ACR |= FLASH_ACR_PRFTBE;
    FLASH->ACR  = (FLASH->ACR & ~FLASH_ACR_LATENCY) | FLASH_ACR_LATENCY_2;

    copy_initialized();
    clear_bss();
    enable_fault_exceptions();
    clock_config();
    start_hse_clock();
    flash_config();
    use_pll();

    main();
    while(1);

}