## Flash Driver

This is a simple flash driver which build flash driver bin that can downloadt o SRAM.
- Using Position-Independent Code (PIC) to makes download location more flexible.
- Just include one header file("fls_drv_bin.h"), flash api calls are almost identical to sdk.


## Build

* Pre-install the necessary tools: cmake, ninja, gcc-arm-none-eabi (which contains in YCT).
* Build the target chip which you need.


## Usage

### Just for demo test

1. Copy the "fls_drv_bin_data.h" which is convert by bin file and located in build/CHIP folder.
2. Copy the "fls_drv_bin.h" located in project folder.

### Download to SRAM to run

1. Copy the "fls_drv_bin.h" located in project folder.
2. Remove the macro define of "TEST_BY_ARRAY" in "fls_drv_table.h".
3. Redefine "FLS_DRV_BASE_ADDR" in "fls_drv_table.h" to the SRAM address where the "FlashDriver.bin" file is downloaded.
4. Download the "FlashDriver.bin" file which located in build/CHIP folder to SRAM.


### Notes
1. Disable global interrupts before calling the erase/write API; if cache is enabled, also disable the cache.