NEORV32 bootloader.
More...
#include <stdint.h>
#include <neorv32.h>
#include <config.h>
#include <spi_flash.h>
#include <twi_flash.h>
#include <uart.h>
|
#define | EXE_STREAM_UART 0 |
|
#define | EXE_STREAM_SPI 1 |
|
#define | EXE_STREAM_TWI 2 |
|
#define | EXE_OFFSET_SIGNATURE (0) |
|
#define | EXE_OFFSET_SIZE (4) |
|
#define | EXE_OFFSET_CHECKSUM (8) |
|
#define | EXE_OFFSET_DATA (12) |
|
#define | EXE_SIGNATURE 0x4788CAFEU |
|
#define | xstr(a) |
|
#define | str(a) |
|
|
uint32_t | exe_available = 0 |
|
◆ str
◆ xstr
◆ bootloader_trap_handler()
void bootloader_trap_handler |
( |
void | | ) |
|
Bare-metal Bootloader trap handler. Used for the CLINT timer tick and to capture any other traps.
◆ get_exe_word()
int get_exe_word |
( |
int | src, |
|
|
uint32_t | addr, |
|
|
uint32_t * | rdata ) |
Get word from executable stream.
- Parameters
-
| src | Source of executable stream data. See #EXE_STREAM_SOURCE_enum. |
| addr | Address when accessing SPI flash or TWI Device. |
[in,out] | rdata | Pointer for returned data (uint32_t). |
- Returns
- 0 if success, != 0 if error.
◆ load_exe()
Get executable stream.
- Parameters
-
src | Source of executable stream data. See #EXE_STREAM_SOURCE_enum. |
- Returns
- 0 if success, != 0 if error.
◆ main()
◆ print_help()
◆ put_exe_word()
int put_exe_word |
( |
int | dst, |
|
|
uint32_t | addr, |
|
|
uint32_t | wdata ) |
Put word to executable stream.
- Parameters
-
| dst | Source of executable stream data. See #EXE_STREAM_SOURCE_enum. |
| addr | Address when accessing SPI flash or TWI Device. |
[in] | wdata | Write data word (uint32_t). |
- Returns
- 0 if success, != 0 if error.
◆ save_exe()
Copy memory content as executable to flash.
- Parameters
-
dst | Destination of executable. See #EXE_STREAM_SOURCE_enum. |
◆ start_app()
Start application program.