Skip to content

Commit 7acaf16

Browse files
committed
Enable MPFS250 build test
1 parent 04a342c commit 7acaf16

File tree

11 files changed

+34
-80
lines changed

11 files changed

+34
-80
lines changed

.github/workflows/test-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575

7676
- name: Install cross compilers
7777
run: |
78-
sudo apt-get install -y gcc-arm-none-eabi gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gnu-efi
78+
sudo apt-get install -y gcc-arm-none-eabi gcc-aarch64-linux-gnu gcc-powerpc-linux-gnu gnu-efi gcc-riscv64-unknown-elf
7979
8080
- name: make clean
8181
run: |

.github/workflows/test-configs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ jobs:
207207
arch: arm
208208
config-file: ./config/examples/mcxw-tz.config
209209

210-
# TODO: polarfire_mpfs250.config requires PolarFire SoC SDK
211-
#polarfire_mpfs250_test:
212-
# uses: ./.github/workflows/test-build-mcux-sdk.yml
213-
# with:
214-
# arch: riscv64
215-
# config-file: ./config/examples/polarfire_mpfs250.config
210+
microchip_mpfs250_test:
211+
uses: ./.github/workflows/test-build.yml
212+
with:
213+
arch: riscv64
214+
config-file: ./config/examples/polarfire_mpfs250.config
215+
216216
raspi3_test:
217217
uses: ./.github/workflows/test-build.yml
218218
with:

arch.mk

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,8 @@ endif
561561
ifeq ($(ARCH),RISCV64)
562562
CROSS_COMPILE?=riscv64-unknown-elf-
563563
CFLAGS+=-DMMU -DWOLFBOOT_DUALBOOT
564-
#UPDATE_OBJS:=src/update_ram.o
565-
UPDATE_OBJS:=src/update_disk.o
566564
CFLAGS+=-DWOLFBOOT_UPDATE_DISK
565+
UPDATE_OBJS:=src/update_disk.o
567566
OBJS += src/gpt.o
568567
ARCH_FLAGS=-march=rv64imafdc -mabi=lp64d -mcmodel=medany
569568
CFLAGS+=-fno-builtin-printf -DUSE_M_TIME -g -nostartfiles -DARCH_RISCV64
@@ -575,8 +574,8 @@ ifeq ($(ARCH),RISCV64)
575574
LDFLAGS+=-Wl,--gc-sections
576575

577576
OBJS+=src/boot_riscv64_start.o src/boot_riscv64.o src/vector_riscv64.o
578-
ARCH_FLASH_OFFSET=0x20220000
579577

578+
CFLAGS+=-DWOLFBOOT_FDT
580579
OBJS+=src/fdt.o
581580

582581
ifeq ($(SPMATH),1)
@@ -849,7 +848,7 @@ ifeq ($(TARGET),nxp_t1024)
849848
ARCH_FLAGS=-mhard-float -mcpu=e5500
850849
CFLAGS+=$(ARCH_FLAGS)
851850
BIG_ENDIAN=1
852-
CFLAGS+=-DMMU -DWOLFBOOT_DUALBOOT
851+
CFLAGS+=-DMMU -DWOLFBOOT_FDT -DWOLFBOOT_DUALBOOT
853852
CFLAGS+=-pipe # use pipes instead of temp files
854853
CFLAGS+=-feliminate-unused-debug-types
855854
LDFLAGS+=$(ARCH_FLAGS)
@@ -870,7 +869,7 @@ ifeq ($(TARGET),nxp_t2080)
870869
ARCH_FLAGS=-mhard-float -mcpu=e6500
871870
CFLAGS+=$(ARCH_FLAGS)
872871
BIG_ENDIAN=1
873-
CFLAGS+=-DMMU -DWOLFBOOT_DUALBOOT
872+
CFLAGS+=-DMMU -DWOLFBOOT_FDT -DWOLFBOOT_DUALBOOT
874873
CFLAGS+=-pipe # use pipes instead of temp files
875874
CFLAGS+=-feliminate-unused-debug-types
876875
LDFLAGS+=$(ARCH_FLAGS)
@@ -1033,9 +1032,6 @@ ifeq ($(filter $(TARGET),x86_fsp_qemu kontron_vx3060_s2),$(TARGET))
10331032
FSP_TGL=1
10341033
CFLAGS+=-DWOLFBOOT_TGL=1
10351034
endif
1036-
1037-
# load to address in RAM after wolfBoot (aligned to 16 bytes)
1038-
CFLAGS+=-DWOLFBOOT_NO_LOAD_ADDRESS
10391035
endif
10401036

10411037
ifeq ($(TARGET),x86_fsp_qemu)
@@ -1049,6 +1045,8 @@ ifeq ("${FSP}", "1")
10491045
LD_START_GROUP =
10501046
LD_END_GROUP =
10511047
LD := ld
1048+
# load to address in RAM after wolfBoot (aligned to 16 bytes)
1049+
CFLAGS+=-DWOLFBOOT_NO_LOAD_ADDRESS
10521050
ifeq ($(filter-out $(STAGE1),1),)
10531051
# building stage1
10541052
ifeq ($(FSP_TGL), 1)
@@ -1377,7 +1375,7 @@ BOOT_IMG?=test-app/image.bin
13771375

13781376
## Update mechanism
13791377
ifeq ($(ARCH),AARCH64)
1380-
CFLAGS+=-DMMU -DWOLFBOOT_DUALBOOT
1378+
CFLAGS+=-DMMU -DWOLFBOOT_FDT -DWOLFBOOT_DUALBOOT
13811379
OBJS+=src/fdt.o
13821380
UPDATE_OBJS:=src/update_ram.o
13831381
else

config/examples/raspi3-encrypted.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ WOLFBOOT_PARTITION_SWAP_ADDRESS=0xFFFFFFFF
1616
WOLFBOOT_PARTITION_SIZE=0x1000000
1717
WOLFBOOT_SECTOR_SIZE=0x400
1818
EXT_FLASH=0
19-
MMU=1
2019
ENCRYPT=1
2120
NO_XIP=1
2221
ENCRYPT_WITH_AES256=1

hal/x86_fsp_qemu_loader.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
#ifdef __WOLFBOOT
2828
#include <printf.h>
2929

30-
31-
static void panic(void);
32-
3330
void hal_init(void)
3431
{
3532
}
@@ -88,7 +85,3 @@ void *hal_get_dts_update_address(void)
8885
return 0;
8986
}
9087

91-
static void panic(void)
92-
{
93-
while(1) {}
94-
}

src/elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static int check_scatter_format(const unsigned char* ehdr, int is_elf32);
5050

5151

5252

53-
#if defined(MMU) || defined (WOLFBOOT_FSP) || defined (ARCH_PPC)
53+
#if defined(MMU) || defined(WOLFBOOT_FSP) || defined(WOLFBOOT_ELF)
5454
/* Loader for elf32 or elf64 format program headers
5555
* Returns the entry point function
5656
*/

src/fdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2323
*/
2424

25-
#if defined(MMU) && !defined(BUILD_LOADER_STAGE1)
25+
#if (defined(MMU) || defined(WOLFBOOT_FDT)) && !defined(BUILD_LOADER_STAGE1)
2626

2727
#include "fdt.h"
2828
#include "hal.h"
@@ -851,4 +851,4 @@ void* fit_load_image(void* fdt, const char* image, int* lenp)
851851

852852
}
853853

854-
#endif /* MMU && !BUILD_LOADER_STAGE1 */
854+
#endif /* (MMU || WOLFBOOT_FDT) && !BUILD_LOADER_STAGE1 */

src/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#endif
2828

2929
#include <stddef.h>
30-
#ifndef TARGET_library
30+
#if !defined(TARGET_library) && !defined(ARCH_RISCV64)
3131
#include <string.h>
3232
#else
3333
size_t strlen(const char *s); /* forward declaration */

src/update_disk.c

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
#include "printf.h"
4444
#include "wolfboot/wolfboot.h"
4545
#include "disk.h"
46+
#ifdef WOLFBOOT_ELF
47+
#include "elf.h"
48+
#endif
4649

4750
#include <stdint.h>
4851
#include <string.h>
@@ -53,10 +56,7 @@
5356
#include "x86/ahci.h"
5457
#include "x86/ata.h"
5558
#include "pci.h"
56-
57-
#ifdef WOLFBOOT_TGL
5859
#include "x86/tgl_fsp.h"
59-
#endif
6060

6161
#ifdef TARGET_kontron_vx3060_s2
6262
#define BOOT_PART_A 5
@@ -117,7 +117,6 @@ void RAMFUNCTION wolfBoot_start(void)
117117
#ifdef WOLFBOOT_FSP
118118
struct stage2_parameter *stage2_params;
119119
uint32_t sata_bar;
120-
121120
ret = x86_fsp_tgl_init_sata(&sata_bar);
122121
if (ret != 0)
123122
wolfBoot_panic();
@@ -191,7 +190,7 @@ void RAMFUNCTION wolfBoot_start(void)
191190
}
192191

193192
memset(&os_image, 0, sizeof(os_image));
194-
ret = wolfBoot_open_image_address(&os_image, (void*)load_address);
193+
ret = wolfBoot_open_image_address(&os_image, (void*)p_hdr);
195194
if (ret < 0) {
196195
wolfBoot_printf("Error parsing loaded image\r\n");
197196
selected ^= 1;
@@ -208,7 +207,7 @@ void RAMFUNCTION wolfBoot_start(void)
208207
}
209208
/* Log memory load */
210209
x86_log_memory_load((uint32_t)(uintptr_t)load_address,
211-
(uint32_t)(uintptr_t)load_address + os_image.fw_size,
210+
(uint32_t)(uintptr_t)load_address + os_image.fw_size + IMAGE_HEADER_SIZE,
212211
part_name);
213212
#endif
214213

@@ -217,7 +216,7 @@ void RAMFUNCTION wolfBoot_start(void)
217216
load_off = 0;
218217
do {
219218
ret = disk_read(BOOT_DISK, cur_part, load_off, DISK_BLOCK_SIZE,
220-
(uint8_t *)load_address + load_off);
219+
(uint8_t*)load_address + load_off);
221220
if (ret < 0)
222221
break;
223222
load_off += ret;
@@ -265,14 +264,7 @@ void RAMFUNCTION wolfBoot_start(void)
265264

266265
load_address = (uint32_t*)os_image.fw_base;
267266

268-
#ifdef WOLFBOOT_ELF
269-
/* Load elf */
270-
if (elf_load_image_mmu((uint8_t*)load_address, (uintptr_t*)&load_address, NULL) != 0){
271-
wolfBoot_printf("Invalid elf, falling back to raw binary\n");
272-
}
273-
#endif
274-
275-
#ifdef MMU
267+
#ifdef WOLFBOOT_FDT
276268
/* Is this a Flattened uImage Tree (FIT) image (FDT format) */
277269
if (wolfBoot_get_dts_size(load_address) > 0) {
278270
void* fit = (void*)load_address;
@@ -296,42 +288,14 @@ void RAMFUNCTION wolfBoot_start(void)
296288
}
297289
}
298290
}
299-
else {
300-
/* Load DTS to RAM */
301-
#ifdef EXT_FLASH
302-
if (PART_IS_EXT(&os_image) &&
303-
wolfBoot_open_image(&os_image, PART_DTS_BOOT) >= 0) {
304-
dts_addr = (uint8_t*)WOLFBOOT_LOAD_DTS_ADDRESS;
305-
dts_size = (uint32_t)os_image.fw_size;
306-
307-
wolfBoot_printf("Loading DTS (size %lu) to RAM at %08lx\n",
308-
(long unsigned int)dts_size, (long unsigned int)dts_addr);
309-
ext_flash_check_read((uintptr_t)os_image.fw_base,
310-
(uint8_t*)dts_addr, dts_size);
311-
}
312-
else
313-
#endif /* EXT_FLASH */
314-
{
315-
dts_addr = hal_get_dts_address();
316-
if (dts_addr) {
317-
ret = wolfBoot_get_dts_size(dts_addr);
318-
if (ret < 0) {
319-
wolfBoot_printf("Failed parsing DTB to load\n");
320-
/* Allow failure, continue booting */
321-
}
322-
else {
323-
/* relocate DTS to RAM */
324-
uint8_t* dts_dst = (uint8_t*)WOLFBOOT_LOAD_DTS_ADDRESS;
325-
dts_size = (uint32_t)ret;
326-
wolfBoot_printf("Loading DTB (size %d) from %p to RAM at %p\n",
327-
dts_size, dts_addr, (void*)WOLFBOOT_LOAD_DTS_ADDRESS);
328-
memcpy(dts_dst, dts_addr, dts_size);
329-
dts_addr = dts_dst;
330-
}
331-
}
332-
}
291+
#endif
292+
293+
#ifdef WOLFBOOT_ELF
294+
/* Load elf */
295+
if (elf_load_image_mmu((uint8_t*)load_address, (uintptr_t*)&load_address, NULL) != 0){
296+
wolfBoot_printf("Invalid elf, falling back to raw binary\n");
333297
}
334-
#endif /* MMU */
298+
#endif
335299

336300
wolfBoot_printf("Booting at %08lx\r\n", load_address);
337301

tools/elf-parser/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CC=gcc
66
CFLAGS=-Wall -g -ggdb
7-
CFLAGS+=-I../../include -DWOLFBOOT_ELF -DELF_PARSER -DPRINTF_ENABLED -DMMU -DARCH_FLASH_OFFSET=0
7+
CFLAGS+=-I../../include -DWOLFBOOT_ELF -DELF_PARSER -DPRINTF_ENABLED -DARCH_FLASH_OFFSET=0
88
EXE=elf-parser
99

1010
LIBS=

0 commit comments

Comments
 (0)