![]() |
NEORV32 - Software Framework Documentation
|
Demo for the the execute in place (XIP) module. More...
#include <neorv32.h>
Macros | |
User configuration | |
#define | BAUD_RATE 19200 |
#define | XIP_PAGE_BASE_ADDR 0x40000000 |
#define | FLASH_BASE 0x00400000 |
#define | FLASH_ABYTES 3 |
#define | XIP_CLK_PRSC CLK_PRSC_128 |
Enumerations | |
enum | SPI_FLASH_CMD { SPI_FLASH_CMD_WRITE = 0x02 , SPI_FLASH_CMD_READ = 0x03 , SPI_FLASH_CMD_READ_STATUS = 0x05 , SPI_FLASH_CMD_WRITE_ENABLE = 0x06 , SPI_FLASH_CMD_SECTOR_ERASE = 0xD8 } |
Functions | |
Prototypes | |
int | erase_sector_xip_flash (uint32_t base_addr) |
int | program_xip_flash (uint32_t *src, uint32_t base_addr, uint32_t size) |
Simple demo program to be stored to the XIP flash. | |
| |
const uint32_t | xip_program [] |
int | main () |
Demo for the the execute in place (XIP) module.
#define BAUD_RATE 19200 |
UART BAUD rate
#define FLASH_ABYTES 3 |
Flash address bytes
#define FLASH_BASE 0x00400000 |
Flash base address (32-bit)
#define XIP_CLK_PRSC CLK_PRSC_128 |
XIP SPI clock prescaler select
#define XIP_PAGE_BASE_ADDR 0x40000000 |
XIP page base address (32-bit)
enum SPI_FLASH_CMD |
int erase_sector_xip_flash | ( | uint32_t | base_addr | ) |
Erase sector starting at base address.
[in] | base_addr | Base address of sector to erase. |
int main | ( | void | ) |
Main function: configure the XIP module, program a small program to the attached flash and run that program from there. The program shows an incrementing counter at the lowest 8-bits of the GPIO output port. This demo is meant for a SPI flash/EEPROM with 16-bit addresses.
int program_xip_flash | ( | uint32_t * | src, |
uint32_t | base_addr, | ||
uint32_t | size | ||
) |
Helper function to program the XIP flash via the direct SPI feature of the XIP module.
[in] | src | Pointer to data that will be copied to flash (32-bit). |
[in] | base_addr | Image base address (in flash). |
[in] | size | Image size in bytes. |
const uint32_t xip_program[] |
Main function: configure the XIP module, program a small program to the attached flash and run that program from there. The program shows an incrementing counter at the lowest 8-bits of the GPIO output port. This demo is meant for a SPI flash/EEPROM with 16-bit addresses.