Peer review fixes

pull/655/head
David Garske 2025-12-24 09:10:25 -08:00 committed by Daniele Lacamera
parent d3ff5783b3
commit 2fc6fe8335
5 changed files with 26 additions and 14 deletions

View File

@ -28,13 +28,15 @@ ELF?=1
# Optionally allow downgrade to older valid version in update partition
ALLOW_DOWNGRADE?=0
# Use assembly version of ECDSA and SHA
# Use RISC-V assembly version of ECDSA and SHA
NO_ASM?=0
NO_ARM_ASM?=0
# Optional: Use smaller SHA512
#CFLAGS_EXTRA+=-DUSE_SLOW_SHA512
# DDR Address for wolfBoot to start from
WOLFBOOT_ORIGIN?=0x80000000
# Flash sector size (4KB typical)
WOLFBOOT_SECTOR_SIZE?=0x1000

View File

@ -797,7 +797,7 @@ The PolarFire SoC is a 64-bit RISC-V SoC featuring a five-core CPU cluster (1×
`hal/mpfs250.c` - Hardware abstraction layer implementation (UART and uSD)
`hal/mpfs250.h` - Register definitions and hardware interfaces
`hal/mpfs250.ld` - Linker script for the platform
`hal/mpfs.dts` / `hal/mpfs.dtb` - Device tree source and binary
`hal/mpfs.dts` - Device tree source
`hal/mpfs.yaml` - HSS payload generator configuration
`hal/mpfs250.its` - Example FIT image creation template
@ -836,12 +836,16 @@ Use this command to assemble a bootable wolfboot image:
hss-payload-generator -vvv -c ./hal/mpfs.yaml wolfboot.bin
```
Any customizations to the Device Tree can be made in mpfs.dts and it can be recompiled using: `dtc -I dts -O dtb mpfs.dts -o mpfs.dtb`
You must generated the Device Tree Binary using:
```sh
dtc -I dts -O dtb hal/mpfs.dts -o hal/mpfs.dtb`
```
Example one-shot command:
```sh
cp ./config/examples/polarfire_mpfs250.config .config && make clean && make wolfboot.elf && size wolfboot.elf && hss-payload-generator -vvv -c ./hal/mpfs.yaml wolfboot.bin
cp ./config/examples/polarfire_mpfs250.config .config && make clean && make wolfboot.elf && size wolfboot.elf && dtc -I dts -O dtb hal/mpfs.dts -o hal/mpfs.dtb && hss-payload-generator -vvv -c ./hal/mpfs.yaml wolfboot.bin
```
The HSS tinyCLI supports the `USBDMSC` command to mount the eMMC or SD card as a USB device. You can then use "dd" to copy the boot image to the BOOT partition. Use `lsblk` to locate the boot partition and replace /dev/sdc1 in the example:

View File

@ -144,7 +144,7 @@ static uint32_t g_rca = 0; /* SD Card Relative Address */
#define DEFAULT_DELAY 0xFFFF
#endif
int mmc_set_timeout(uint32_t timeout_us)
static int mmc_set_timeout(uint32_t timeout_us)
{
uint32_t reg, i, tcfclk, tcfclk_mhz, tcfclk_khz, timeout_val, dtcv;
@ -198,8 +198,7 @@ int mmc_set_timeout(uint32_t timeout_us)
return 0;
}
/* TODO: Fix with real timer */
void mmc_delay(uint32_t delay)
static void mmc_delay(uint32_t delay)
{
while (delay--) {
asm volatile("nop");
@ -212,7 +211,7 @@ void mmc_delay(uint32_t delay)
* EMMC_SD_SRS10_BVS_3_0V
* EMMC_SD_SRS10_BVS_3_3V
*/
int mmc_set_power(uint32_t voltage)
static int mmc_set_power(uint32_t voltage)
{
uint32_t reg;
@ -248,7 +247,7 @@ int mmc_set_power(uint32_t voltage)
}
/* returns actual frequency in kHz */
uint32_t mmc_set_clock(uint32_t clock_khz)
static uint32_t mmc_set_clock(uint32_t clock_khz)
{
static uint32_t last_clock_khz = 0;
uint32_t reg, base_clk_khz, i, mclk, freq_khz;
@ -355,7 +354,7 @@ int mmc_send_cmd(uint32_t cmd_index, uint32_t cmd_arg, uint8_t resp_type)
{
int status = 0;
uint32_t cmd_reg;
uint32_t cmd_type = EMMC_SD_SRS03_CMD_NORMAL; /* TODO: Add support for suspend and resume */
uint32_t cmd_type = EMMC_SD_SRS03_CMD_NORMAL;
#ifdef DEBUG_MMC
wolfBoot_printf("mmc_send_cmd: cmd_index: %d, cmd_arg: %08X, resp_type: %d\n",
@ -402,7 +401,7 @@ int mmc_send_cmd(uint32_t cmd_index, uint32_t cmd_arg, uint8_t resp_type)
}
/* TODO: Add timeout */
int mmc_wait_busy(int check_dat0)
static int mmc_wait_busy(int check_dat0)
{
uint32_t status;
if (check_dat0) {

View File

@ -9,7 +9,8 @@ MEMORY
{
/* The first 0x100 bytes of eNVM are used for boot ROM secure boot meta information */
FLASH_ENVM (rx) : ORIGIN = 0x20220100, LENGTH = 128k - 0x100
DDR (rx) : ORIGIN = 0x80000000, LENGTH = 1028k
/* DDR 32-bit cached range is 0x8000_0000 to 0xFFFF_FFFF */
DDR (rx) : ORIGIN = @WOLFBOOT_ORIGIN@, LENGTH = 1028k
L2_SCRATCH (rwx) : ORIGIN = 0x0A000000, LENGTH = 256k
}

View File

@ -53,11 +53,15 @@ while getopts "d:wpt" opt; do
;;
t) ENABLE_TPM=true
;;
c)
CLEAR_TPM_NV=true
;;
*)
echo "Usage: $0 [-d DEBUG_STAGE1 | DEBUG_STAGE2] [-w] [-p]"
echo "-p : create /tmp/qemu_mon.in and /tmp/qemu_mon.out pipes for monitor qemu"
echo "-w : wait for GDB to connect to the QEMU gdb server"
echo "-t : enable TPM emulation (requires swtpm)"
echo "-c : clear TPM NV"
exit 1
;;
esac
@ -110,7 +114,9 @@ if [ "$ENABLE_TPM" = true ]; then
killall swtpm || true
sleep 1
echo TPM Emulation ON
rm -rf /tmp/swtpm || true
if [ "$CLEAR_TPM_NV" = true ]; then
rm -rf /tmp/swtpm || true
fi
mkdir -p /tmp/swtpm
swtpm socket --tpm2 --tpmstate dir=/tmp/swtpm \
--ctrl type=unixio,path=/tmp/swtpm/swtpm-sock --log level=20 &