Skip to content

Commit

Permalink
Squashed 'applications/' changes from 529d667..e2a7298
Browse files Browse the repository at this point in the history
e2a7298 Merged bootloaders source code version 2.1.102.
9b9dc2f Squashed 'bootloaders/' changes from 8c8d325..90a7460

git-subtree-dir: applications
git-subtree-split: e2a7298b2568585cbd29a83bab3271c151ffc7ab
  • Loading branch information
Rohitkumar Girase authored and Rohitkumar Girase committed May 15, 2023
1 parent 11bfa5d commit 4f72353
Show file tree
Hide file tree
Showing 65 changed files with 10,704 additions and 2,095 deletions.
52 changes: 37 additions & 15 deletions bootloaders/miv-rv32-bootloader/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

# Mi-V Bootloader firmware

This project allows you to write application executable into the SPI flash or
the I2C EEPROM.
The executable is expected to be preloaded in the LSRAM memory using the Libero
memory client configurator.
This project provides the capability to download an executable to the LSRAM and run a new application from there.
Additionally, you can write the application executable into the SPI flash or I2C EEPROM.
Note that the default executable is usually preloaded in the LSRAM memory using the Libero memory client configurator

Writing to the SPI flash is tested on PolarFire Eval Kit on-board SPI flash.
Writing to the EEPROM is tested on PolarFire Avalanche kit with MikroBus Dual
Expand All @@ -21,7 +20,7 @@ HyperTerminal or PuTTY configured as follows:
- no parity
- no flow control

This program displays a self explainatory menu which can be used to perform
This program displays a self-explanatory menu which can be used to perform
different actions.

### Build configurations
Expand All @@ -32,11 +31,13 @@ The following build configurations are provided with this project
| Bootloader-Debug | Run Bootloader in step-debug mode. RV32 IMC extensions. Links to default TCM base address 0x40000000. Not Optimized (-O0). |
| Bootstrap | Used to generate the elf file used by the DGC designs. Links to default TCM base address 0x40000000. Not Optimized (-O0). </br> For general usage, the *Bootloader-Debug* configuration is recommended|

The Bootloader-Debug configuration provides additional YMODEM functionality to
download a hex file over UART terminal to the LSRAM at address 0x80000000. It can
then be copied into either the SPI flash or the LSRAM.
The Bootloader-Debug configuration provides additional YMODEM functionality to
download a raw binary file over UART terminal to the LSRAM at address 0x80000000. Once the new executable is downloaded to the LSRAM,
you can choose to do the following two actions using UART menu options.
- Jump to LSRAM start address and execute the newly downloaded executable
- Copy the executable into either the SPI flash or the I2C EEPROM (For bootstrap functionality)

The Bootstrap configuration assumes that the LSRAM is preloaded with the hex
The Bootstrap configuration assumes that the LSRAM is preloaded with the raw binary
file as a memory client in the Libero design flow as explained in the design guide. If you are using this flow, you may not need the YMODEM functionality.

## Target hardware
Expand All @@ -46,24 +47,45 @@ The Libero designs that are compatible with the use cases provided by this examp
| ----------- | ---------------------- | -------------------------- | -------------------------- |
| Copy to SPI flash | DGC1 | SPI Flash Bootstrap | [PolarFire® Evaluation Kit](https://github.com/Mi-V-Soft-RISC-V/PolarFire-Eval-Kit) |
| Copy to EEPROM | DGC2 | I2C Flash Bootstrap | [PolarFire® Avalanche board](https://github.com/Mi-V-Soft-RISC-V/Future-Avalanche-Board) |
| Download hex file to LSRAM | DGC1 and DGC2 can be used | Download hex file to LSRAM. </br> Both DGC1 and DGC2 designs boot with a default hex file attached to the LSRAM as a client. </br> Use this menu to overwrite the LSRAM with a new hex file.| See above |
| Download raw binary file to LSRAM | DGC1 and DGC2 can be used | Download raw binary file to LSRAM. </br> Both DGC1 and DGC2 designs boot with a default raw binary file attached to the LSRAM as a client. </br> Use this menu to overwrite the LSRAM with a new raw binary file.| See above |

Notes:
- MikroBus Dual EE Click board is available from https://www.mikroe.com/dual-ee-click

All the design specific definitions such as peripheral base addresses, system
clock frequency etc. are included in fpga_design_config.h.

To ensure that a 10ms timer is provided, the Systick handler must be set based on the system clock frequency. Additionally, sufficient packet time
must be set in order to initiate YMODEM data transfer

while using the YMODEM download option, it is important to set the maximum file size to avoid encountering
an "YMODEM file transfer Failed- Aborted/File size exceeds limit" error.

The LSRAM used in the Libero design used to run this example project has a size of 128KB. However, it is important to note
that the maximum size of the SPI flash and I2C eeprom when copying from the LSRAM is 32KB.

This example project can be used with another design using a different hardware
configuration. This can be achieved by overwriting the content of this example
project's _fpga_design_config.h_ file with the correct data from your Libero design.

### Booting the system:

The boot flow is as below:
- Run this project in step-debug mode from TCM address space
- Download new hex file to LSRAM address space using UART menu option 3. (This step is optional if the LSRAM is preloaded)
- Copy the downloaded hex file to EEPROM or SPI flash per your design using UART menu options 1 and 2
### Bootloader-Debug : Memory details and Boot flow:

#### Memory details:
| Memory/Functionality | Default values | How to change default values |
| ----------- | ---------------------- | -------------------------- |
| LSRAM | 128KB | LSRAM Configurator in Libero design|
| Copy from LSRAM to NVM(SPI Flash or I2C EEPROM) | 32KB | FLASH_EXECUTABLE_SIZE macro in source code|
| Copy from NVM to TCM | 32KB | MIV_ESS Configurator in Libero design|
| Download from YMODEM to LSRAM | 128KB | LSRAM_SIZE macro in source code |

Note: LSRAM_SIZE value should not exceed LSRAM size configured in the Libero design.

#### The boot flow is as below:
- Launch the project in step-debug mode from the TCM address space
- (Optional) If the LSRAM is not initialized with a memory client in the Libero design, download a new raw binary file to the LSRAM address space using UART menu option 3
- To Run the loaded application select UART menu option 4
- To Copy the downloaded raw binary file to the SPI flash or EEPROM based on your Libero design using UART menu options 1 and 2
- For SPI boot on PolarFire Eval Kit:
- Push and hold SW8 and press and release SW6 or SW7.
- For I2C boot on Avalanche board:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${config_name:miv-rv32-bootloader debug}/miv-rv32-bootloader debug.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="miv-rv32-bootloader debug"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="${config_name:miv-rv32-bootloader}/miv-rv32-bootloader.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="miv-rv32-bootloader"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/miv-rv32-bootloader debug"/>
<listEntry value="/miv-rv32-bootloader"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
Expand Down

This file was deleted.

Loading

0 comments on commit 4f72353

Please sign in to comment.