Line 4... |
Line 4... |
// # In order to run the bootloader on any CPU configuration, the bootloader should be compiled #
|
// # In order to run the bootloader on any CPU configuration, the bootloader should be compiled #
|
// # unsing the base ISA (rv32i/rv32e) only. #
|
// # unsing the base ISA (rv32i/rv32e) only. #
|
// # ********************************************************************************************* #
|
// # ********************************************************************************************* #
|
// # Boot from (internal) instruction memory, UART or SPI Flash. #
|
// # Boot from (internal) instruction memory, UART or SPI Flash. #
|
// # #
|
// # #
|
// # UART configuration: 8 data bits, no parity bit, 1 stop bit, 19200 baud #
|
// # UART configuration: 8 data bits, NO parity bit, 1 stop bit, 19200 baud (19200-8N1) #
|
// # Boot Flash: 8-bit SPI, 24-bit addresses (like Micron N25Q032A) @ neorv32.spi_csn_o(0) #
|
// # Boot Flash: 8-bit SPI, 24-bit addresses (like Micron N25Q032A) @ neorv32.spi_csn_o(0) #
|
// # neorv32.gpio_o(0) is used as high-active status LED (can be disabled via #STATUS_LED_EN). #
|
// # neorv32.gpio_o(0) is used as high-active status LED (can be disabled via #STATUS_LED_EN). #
|
// # #
|
// # #
|
// # Auto boot sequence (can be disabled via #AUTOBOOT_EN) after timeout (via #AUTOBOOT_TIMEOUT): #
|
// # Auto boot sequence (can be disabled via #AUTOBOOT_EN) after timeout (via #AUTOBOOT_TIMEOUT): #
|
// # -> Try booting from SPI flash at spi_csn_o(0). #
|
// # -> Try booting from SPI flash at spi_csn_o(0). #
|
Line 218... |
Line 218... |
if (STATUS_LED_EN == 1) {
|
if (STATUS_LED_EN == 1) {
|
// activate status LED, clear all others
|
// activate status LED, clear all others
|
neorv32_gpio_port_set(1 << STATUS_LED);
|
neorv32_gpio_port_set(1 << STATUS_LED);
|
}
|
}
|
|
|
// init UART (no interrupts)
|
// init UART (no parity bit, no interrupts)
|
neorv32_uart_setup(BAUD_RATE, 0, 0);
|
neorv32_uart_setup(BAUD_RATE, 0, 0, 0);
|
|
|
// Configure machine system timer interrupt for ~2Hz
|
// Configure machine system timer interrupt for ~2Hz
|
neorv32_mtime_set_timecmp(neorv32_mtime_get_time() + (clock_speed/4));
|
neorv32_mtime_set_timecmp(neorv32_mtime_get_time() + (clock_speed/4));
|
|
|
neorv32_cpu_csr_write(CSR_MIE, 1 << CPU_MIE_MTIE); // activate MTIME IRQ source
|
neorv32_cpu_csr_write(CSR_MIE, 1 << CSR_MIE_MTIE); // activate MTIME IRQ source
|
neorv32_cpu_eint(); // enable global interrupts
|
neorv32_cpu_eint(); // enable global interrupts
|
|
|
|
|
// ------------------------------------------------
|
// ------------------------------------------------
|
// Fast boot mode: Direct SPI boot
|
// Fast boot mode: Direct SPI boot
|