Skip to content

Commit 2fc6fe8

Browse files
dgarskedanielinux
authored andcommitted
Peer review fixes
1 parent d3ff578 commit 2fc6fe8

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

config/examples/polarfire_mpfs250.config

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ ELF?=1
2828
# Optionally allow downgrade to older valid version in update partition
2929
ALLOW_DOWNGRADE?=0
3030

31-
# Use assembly version of ECDSA and SHA
31+
# Use RISC-V assembly version of ECDSA and SHA
3232
NO_ASM?=0
3333
NO_ARM_ASM?=0
34-
3534
# Optional: Use smaller SHA512
3635
#CFLAGS_EXTRA+=-DUSE_SLOW_SHA512
3736

37+
# DDR Address for wolfBoot to start from
38+
WOLFBOOT_ORIGIN?=0x80000000
39+
3840
# Flash sector size (4KB typical)
3941
WOLFBOOT_SECTOR_SIZE?=0x1000
4042

docs/Targets.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ The PolarFire SoC is a 64-bit RISC-V SoC featuring a five-core CPU cluster (1×
797797
`hal/mpfs250.c` - Hardware abstraction layer implementation (UART and uSD)
798798
`hal/mpfs250.h` - Register definitions and hardware interfaces
799799
`hal/mpfs250.ld` - Linker script for the platform
800-
`hal/mpfs.dts` / `hal/mpfs.dtb` - Device tree source and binary
800+
`hal/mpfs.dts` - Device tree source
801801
`hal/mpfs.yaml` - HSS payload generator configuration
802802
`hal/mpfs250.its` - Example FIT image creation template
803803

@@ -836,12 +836,16 @@ Use this command to assemble a bootable wolfboot image:
836836
hss-payload-generator -vvv -c ./hal/mpfs.yaml wolfboot.bin
837837
```
838838

839-
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`
839+
You must generated the Device Tree Binary using:
840+
841+
```sh
842+
dtc -I dts -O dtb hal/mpfs.dts -o hal/mpfs.dtb`
843+
```
840844

841845
Example one-shot command:
842846

843847
```sh
844-
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
848+
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
845849
```
846850

847851
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:

hal/mpfs250.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static uint32_t g_rca = 0; /* SD Card Relative Address */
144144
#define DEFAULT_DELAY 0xFFFF
145145
#endif
146146

147-
int mmc_set_timeout(uint32_t timeout_us)
147+
static int mmc_set_timeout(uint32_t timeout_us)
148148
{
149149
uint32_t reg, i, tcfclk, tcfclk_mhz, tcfclk_khz, timeout_val, dtcv;
150150

@@ -198,8 +198,7 @@ int mmc_set_timeout(uint32_t timeout_us)
198198
return 0;
199199
}
200200

201-
/* TODO: Fix with real timer */
202-
void mmc_delay(uint32_t delay)
201+
static void mmc_delay(uint32_t delay)
203202
{
204203
while (delay--) {
205204
asm volatile("nop");
@@ -212,7 +211,7 @@ void mmc_delay(uint32_t delay)
212211
* EMMC_SD_SRS10_BVS_3_0V
213212
* EMMC_SD_SRS10_BVS_3_3V
214213
*/
215-
int mmc_set_power(uint32_t voltage)
214+
static int mmc_set_power(uint32_t voltage)
216215
{
217216
uint32_t reg;
218217

@@ -248,7 +247,7 @@ int mmc_set_power(uint32_t voltage)
248247
}
249248

250249
/* returns actual frequency in kHz */
251-
uint32_t mmc_set_clock(uint32_t clock_khz)
250+
static uint32_t mmc_set_clock(uint32_t clock_khz)
252251
{
253252
static uint32_t last_clock_khz = 0;
254253
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)
355354
{
356355
int status = 0;
357356
uint32_t cmd_reg;
358-
uint32_t cmd_type = EMMC_SD_SRS03_CMD_NORMAL; /* TODO: Add support for suspend and resume */
357+
uint32_t cmd_type = EMMC_SD_SRS03_CMD_NORMAL;
359358

360359
#ifdef DEBUG_MMC
361360
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)
402401
}
403402

404403
/* TODO: Add timeout */
405-
int mmc_wait_busy(int check_dat0)
404+
static int mmc_wait_busy(int check_dat0)
406405
{
407406
uint32_t status;
408407
if (check_dat0) {

hal/mpfs250.ld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ MEMORY
99
{
1010
/* The first 0x100 bytes of eNVM are used for boot ROM secure boot meta information */
1111
FLASH_ENVM (rx) : ORIGIN = 0x20220100, LENGTH = 128k - 0x100
12-
DDR (rx) : ORIGIN = 0x80000000, LENGTH = 1028k
12+
/* DDR 32-bit cached range is 0x8000_0000 to 0xFFFF_FFFF */
13+
DDR (rx) : ORIGIN = @WOLFBOOT_ORIGIN@, LENGTH = 1028k
1314
L2_SCRATCH (rwx) : ORIGIN = 0x0A000000, LENGTH = 256k
1415
}
1516

tools/scripts/x86_fsp/qemu/qemu.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ while getopts "d:wpt" opt; do
5353
;;
5454
t) ENABLE_TPM=true
5555
;;
56+
c)
57+
CLEAR_TPM_NV=true
58+
;;
5659
*)
5760
echo "Usage: $0 [-d DEBUG_STAGE1 | DEBUG_STAGE2] [-w] [-p]"
5861
echo "-p : create /tmp/qemu_mon.in and /tmp/qemu_mon.out pipes for monitor qemu"
5962
echo "-w : wait for GDB to connect to the QEMU gdb server"
6063
echo "-t : enable TPM emulation (requires swtpm)"
64+
echo "-c : clear TPM NV"
6165
exit 1
6266
;;
6367
esac
@@ -110,7 +114,9 @@ if [ "$ENABLE_TPM" = true ]; then
110114
killall swtpm || true
111115
sleep 1
112116
echo TPM Emulation ON
113-
rm -rf /tmp/swtpm || true
117+
if [ "$CLEAR_TPM_NV" = true ]; then
118+
rm -rf /tmp/swtpm || true
119+
fi
114120
mkdir -p /tmp/swtpm
115121
swtpm socket --tpm2 --tpmstate dir=/tmp/swtpm \
116122
--ctrl type=unixio,path=/tmp/swtpm/swtpm-sock --log level=20 &

0 commit comments

Comments
 (0)