[sw/bootloader] renaming and minor optimizations

This commit is contained in:
Lukas Pajak 2025-01-09 09:13:10 +01:00
parent b351ae6134
commit cf119857c7
3 changed files with 9 additions and 5 deletions

View file

@ -40,7 +40,7 @@ minimal base & privileged ISA `rv32e_zicsr_zifencei` only to ensure it can work
4+^| XIP configuration
| `XIP_EN` | `0` | `0`, `1` | Set `1` to enable the XIP options
4+^| TWI configuration
| `TWI_EN` | `0` | `0`, `1` | Set `1` to enable the usage of the SPI module (including load/store executables from/to SPI flash options)
| `TWI_EN` | `0` | `0`, `1` | Set `1` to enable the usage of the TWI module (including load executables from TWI device option)
| `TWI_CLK_PRSC` | `CLK_PRSC_64` | `CLK_PRSC_2` `CLK_PRSC_4` `CLK_PRSC_8` `CLK_PRSC_64` `CLK_PRSC_128` `CLK_PRSC_1024` `CLK_PRSC_2024` `CLK_PRSC_4096` | TWI clock pre-scaler (dividing main processor clock)
| `TWI_CLK_DIV` | `3` | `0` ... `15` | TWI clock divider (dividing twi clock)
| `TWI_DEVICE_ID` | `0x50` | `0x00` ... `0x7F` | First TWI device ID to start. Is incremented until the end of the program is reached, when `TWI_ADDR_BYTES` is `1`.

View file

@ -124,7 +124,7 @@ See section <<_programming_an_external_spi_flash_via_the_bootloader>> to learn h
flash for nonvolatile program storage.
[TIP]
The bootloader also supports booting from external TWI memory. Enable it in the bootloader makefile, but be caution, enabling all features might result in a too-big binary.
The bootloader also supports booting from external TWI memory. Enable it in the bootloader makefile, but be careful, enabling all features may result in a too-big binary.
[TIP]
Executables can also be uploaded via the **on-chip debugger**.

View file

@ -141,7 +141,7 @@
enum EXE_STREAM_SOURCE_enum {
EXE_STREAM_UART = 0, /**< Get executable via UART */
EXE_STREAM_FLASH = 1, /**< Get executable via SPI flash */
EXE_STREAM_TWI = 2 /**< Get executable via I2c Device */
EXE_STREAM_TWI = 2 /**< Get executable via TWI device */
};
@ -164,7 +164,7 @@ const char error_message[5][5] = {
"EXE",
"SIZE",
"CHKS",
"FLSH",
"SPI",
"TWI"
};
@ -718,9 +718,11 @@ void save_exe(void) {
* @return 32-bit data word from stream.
**************************************************************************/
uint32_t get_exe_word(int src, uint32_t addr) {
#if (TWI_EN != 0)
if (src == EXE_STREAM_TWI) {
return twi_read_addr(addr);
} else {
#endif
union {
uint32_t uint32;
uint8_t uint8[sizeof(uint32_t)];
@ -737,7 +739,9 @@ uint32_t get_exe_word(int src, uint32_t addr) {
}
}
return data.uint32;
#if (TWI_EN != 0)
}
#endif
}
@ -1105,4 +1109,4 @@ uint32_t twi_read_addr(uint32_t addr) {
#else
return 0;
#endif
}
}