URL
https://opencores.org/ocsvn/neorv32/neorv32/trunk
Subversion Repositories neorv32
Compare Revisions
- This comparison shows the changes necessary to convert path
/neorv32/trunk/sw/bootloader
- from Rev 33 to Rev 34
- ↔ Reverse comparison
Rev 33 → Rev 34
/bootloader.c
79,6 → 79,8
#define SPI_FLASH_CLK_PRSC (CLK_PRSC_8) |
/** SPI flash sector size in bytes (default = 64kb) */ |
#define SPI_FLASH_SECTOR_SIZE (64*1024) |
/** ASCII char to start fast executable upload process (for use with automatic upload scripts) */ |
#define FAST_UPLOAD_CMD '#' |
/**@}*/ |
|
|
154,6 → 156,7
|
// Function prototypes |
void __attribute__((__interrupt__)) bootloader_trap_handler(void); |
void fast_upload(int src); |
void print_help(void); |
void start_app(void); |
void get_exe(int src); |
250,12 → 253,15
while ((UART_DATA & (1 << UART_DATA_AVAIL)) == 0) { // wait for any key to be pressed |
|
if (neorv32_mtime_get_time() >= timeout_time) { // timeout? start auto boot sequence |
get_exe(EXE_STREAM_FLASH); // try loading from spi flash |
neorv32_uart_print("\n"); |
start_app(); |
fast_upload(EXE_STREAM_FLASH); // try booting from flash |
} |
} |
neorv32_uart_print("Aborted.\n\n"); |
|
// fast executable upload? |
if (neorv32_uart_char_received_get() == FAST_UPLOAD_CMD) { |
fast_upload(EXE_STREAM_UART); |
} |
#else |
neorv32_uart_print("\n\n"); |
#endif |
273,10 → 279,11
neorv32_uart_putc(c); // echo |
neorv32_uart_print("\n"); |
|
if (c == 'r') { // restart bootloader |
neorv32_cpu_dint(); // disable global interrupts |
if (c == FAST_UPLOAD_CMD) { // fast executable upload |
fast_upload(EXE_STREAM_UART); |
} |
else if (c == 'r') { // restart bootloader |
asm volatile ("li t0, %[input_i]; jr t0" : : [input_i] "i" (BOOTLOADER_BASE_ADDRESS)); // jump to beginning of boot ROM |
while(1); // just for the compiler |
} |
else if (c == 'h') { // help menu |
print_help(); |
306,6 → 313,20
|
|
/**********************************************************************//** |
* Get executable stream and execute it. |
* |
* @param src Source of executable stream data. See #EXE_STREAM_SOURCE. |
**************************************************************************/ |
void fast_upload(int src) { |
|
get_exe(src); |
neorv32_uart_print("\n"); |
start_app(); |
while(1); |
} |
|
|
/**********************************************************************//** |
* Print help menu. |
**************************************************************************/ |
void print_help(void) { |
378,7 → 399,7
} |
|
else { |
neorv32_uart_print("\n\nEXCEPTION ("); |
neorv32_uart_print("\n\nEXC ("); |
print_hex_word(cause); |
neorv32_uart_print(") @ 0x"); |
print_hex_word(neorv32_cpu_csr_read(CSR_MEPC)); |
561,7 → 582,6
neorv32_gpio_port_set(1 << STATUS_LED); // permanently light up status LED |
} |
|
asm volatile ("wfi"); // power-down |
while(1); // freeze |
} |
|
/makefile
59,6 → 59,9
# User flags for additional configuration (will be added to compiler flags) |
USER_FLAGS ?= |
|
# Serial port for executable upload via bootloer |
COM_PORT ?= /dev/ttyUSB0 |
|
# Relative or absolute path to the NEORV32 home folder |
NEORV32_HOME ?= ../.. |
# ***************************************************************************** |
253,6 → 256,13
|
|
# ----------------------------------------------------------------------------- |
# Upload executable via serial port to bootloader |
# ----------------------------------------------------------------------------- |
upload: $(APP_EXE) |
@sh $(NEORV32_EXG_PATH)/uart_upload.sh $(COM_PORT) $(APP_EXE) |
|
|
# ----------------------------------------------------------------------------- |
# Show configuration |
# ----------------------------------------------------------------------------- |
info: |
315,6 → 325,7
@echo " clean - clean up project" |
@echo " clean_all - clean up project, core libraries and image generator" |
@echo " bootloader - compile, generate and install VHDL BOOTROM boot image (for bootloader only!)" |
@echo " upload - upload <neorv32_exe.bin> executable via serial port <COM_PORT> to bootloader" |
|
|
# ----------------------------------------------------------------------------- |