Skip to content

Commit 27b97a3

Browse files
committed
Fix CI build errors
1 parent bc95fc5 commit 27b97a3

File tree

11 files changed

+38
-32
lines changed

11 files changed

+38
-32
lines changed

.github/workflows/test-build-riscv.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,21 @@ jobs:
8080
run: sudo apt-get update -o Acquire::Retries=3
8181

8282
# ============================================================
83-
# Prebuilt RISC-V toolchains from riscv-collab
84-
# https://github.com/riscv-collab/riscv-gnu-toolchain/releases
85-
# Extracts to: riscv/bin/riscv{32,64}-unknown-elf-*
83+
# xPack RISC-V GCC — single toolchain with full multilib
84+
# supporting both rv32 and rv64 targets (including rv32imac/ilp32
85+
# and rv64imac/lp64 which riscv-collab nightly builds lack).
86+
# https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
8687
# ============================================================
87-
- name: Download and install RISC-V toolchain (riscv32)
88-
if: ${{ inputs.arch == 'riscv' }}
89-
run: |
90-
wget -q https://github.com/riscv-collab/riscv-gnu-toolchain/releases/latest/download/riscv32-elf-ubuntu-24.04-gcc.tar.xz
91-
tar -xf riscv32-elf-ubuntu-24.04-gcc.tar.xz
92-
echo "$GITHUB_WORKSPACE/riscv/bin" >> $GITHUB_PATH
93-
$GITHUB_WORKSPACE/riscv/bin/riscv32-unknown-elf-gcc --version
94-
95-
- name: Install RISC-V toolchain (riscv64)
96-
if: ${{ inputs.arch == 'riscv64' }}
88+
- name: Download and install xPack RISC-V toolchain
9789
run: |
98-
sudo apt-get install -y gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf
99-
riscv64-unknown-elf-gcc --version
90+
XPACK_VER="15.2.0-1"
91+
XPACK_FILE="xpack-riscv-none-elf-gcc-${XPACK_VER}-linux-x64.tar.gz"
92+
wget -q "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v${XPACK_VER}/${XPACK_FILE}"
93+
echo "aaaa8060c914851a3e5ee1ba82cc3d6f80972f90638a05c6e823a37557a33758 ${XPACK_FILE}" | sha256sum -c -
94+
tar -xf "${XPACK_FILE}"
95+
echo "$GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-${XPACK_VER}/bin" >> $GITHUB_PATH
96+
riscv-none-elf-gcc --version
97+
riscv-none-elf-gcc -print-multi-lib | head -5
10098
10199
# ============================================================
102100
# Build wolfboot
@@ -116,9 +114,9 @@ jobs:
116114
- name: Build wolfboot (riscv32)
117115
if: ${{ inputs.arch == 'riscv' }}
118116
run: |
119-
make CROSS_COMPILE=riscv32-unknown-elf- FREEDOM_E_SDK=$GITHUB_WORKSPACE/freedom-e-sdk ${{inputs.make-args}}
117+
make CROSS_COMPILE=riscv-none-elf- FREEDOM_E_SDK=$GITHUB_WORKSPACE/freedom-e-sdk ${{inputs.make-args}}
120118
121119
- name: Build wolfboot (riscv64)
122120
if: ${{ inputs.arch == 'riscv64' }}
123121
run: |
124-
make CROSS_COMPILE=riscv64-unknown-elf- ${{inputs.make-args}}
122+
make CROSS_COMPILE=riscv-none-elf- ${{inputs.make-args}}

hal/mpfs250.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ int mpfs_read_serial_number(uint8_t *serial)
222222
SCBCTRL_REG(SERVICES_CR_OFFSET) = cmd;
223223

224224
/* Wait for request bit to clear (command accepted) */
225-
timeout = 10000;
225+
timeout = MPFS_SCB_TIMEOUT;
226226
while ((SCBCTRL_REG(SERVICES_CR_OFFSET) & SERVICES_CR_REQ_MASK) && timeout > 0) {
227227
timeout--;
228228
}
@@ -232,7 +232,7 @@ int mpfs_read_serial_number(uint8_t *serial)
232232
}
233233

234234
/* Wait for busy bit to clear (command completed) */
235-
timeout = 10000;
235+
timeout = MPFS_SCB_TIMEOUT;
236236
while (mpfs_scb_mailbox_busy() && timeout > 0) {
237237
timeout--;
238238
}
@@ -1268,6 +1268,8 @@ static void uart_config_baud(unsigned long base, uint32_t baudrate)
12681268
uint32_t div_int = div_x64 / 64u;
12691269
uint32_t div_frac = div_x64 - (div_int * 64u);
12701270
div_frac += (div_x128 - (div_int * 128u)) - (div_frac * 2u);
1271+
if (div_frac > 63u)
1272+
div_frac = 63u;
12711273
if (div_int > (uint32_t)UINT16_MAX)
12721274
return;
12731275
MMUART_LCR(base) |= DLAB_MASK;

hal/mpfs250.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ typedef struct {
295295
volatile uint32_t shared_mem_marker; /* 0x08: Init marker */
296296
volatile uint32_t shared_mem_status; /* 0x0C: Status */
297297
volatile uint64_t* shared_mem; /* 0x10: Shared memory pointer */
298-
volatile uint64_t reserved[2]; /* 0x18: Reserved/padding */
299-
} HLS_DATA; /* 64 bytes */
298+
volatile uint64_t reserved[5]; /* 0x18: Reserved/padding to 64 bytes */
299+
} HLS_DATA; /* 64 bytes total */
300300
#endif /* __ASSEMBLER__ */
301301

302302
#define HLS_MAIN_HART_STARTED 0x12344321UL

hal/nxp_t2080.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2020
*/
2121
#include <stdint.h>
22+
#include <stddef.h>
2223
#include "target.h"
2324
#include "printf.h"
2425
#include "image.h" /* for RAMFUNCTION */

include/printf.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848

4949
/* support for wolfBoot_printf logging */
5050
#if defined(PRINTF_ENABLED) && !defined(WOLFBOOT_NO_PRINTF)
51-
# include <stdio.h>
51+
# if !defined(DEBUG_UART) && !defined(DEBUG_ZYNQ) && !defined(WOLFBOOT_DEBUG_EFI)
52+
# include <stdio.h>
53+
# endif
5254
# if defined(DEBUG_ZYNQ) && !defined(USE_QNX) && !defined(DEBUG_UART)
5355
# include "xil_printf.h"
5456
# define wolfBoot_printf(_f_, ...) xil_printf(_f_, ##__VA_ARGS__)

src/boot_riscv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void do_boot(const uint32_t *app_offset)
273273
unsigned long dts_addr;
274274
hal_dts_fixup((uint32_t*)dts_offset);
275275
dts_addr = (unsigned long)dts_offset;
276-
#else
276+
#elif defined(WOLFBOOT_RISCV_MMODE) || __riscv_xlen == 64
277277
unsigned long dts_addr = 0;
278278
#endif
279279

src/boot_riscv_start.S

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,11 @@ _copy_params:
121121
li t0, MIE_MSIE /* wake only on IPI */
122122
csrw mie, t0
123123

124-
/* Set up per-hart stack: base + (hartid+1)*STACK_SIZE_PER_HART */
124+
/* Set up per-hart stack: base + hartid*STACK_SIZE_PER_HART */
125125
csrr a0, mhartid
126126
la t0, _secondary_hart_stack_base
127127
li t1, STACK_SIZE_PER_HART
128-
addi a1, a0, 1
129-
mul t2, a1, t1
128+
mul t2, a0, t1
130129
add sp, t0, t2
131130
li t0, -16
132131
and sp, sp, t0

src/string.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#if defined(_RENESAS_RA_)
3131
#include <stdint.h>
3232
#endif
33-
#ifndef TARGET_library
33+
#if !defined(TARGET_library) && defined(__STDC_HOSTED__) && __STDC_HOSTED__
3434
#include <string.h>
3535
#else
3636
size_t strlen(const char *s); /* forward declaration */
@@ -289,7 +289,7 @@ void RAMFUNCTION *memcpy(void *dst, const void *src, size_t n)
289289
}
290290
#endif /* IAR */
291291

292-
#ifndef __IAR_SYSTEMS_ICC__
292+
#if !defined(__IAR_SYSTEMS_ICC__) && !defined(TARGET_X86_64_EFI)
293293
void *memmove(void *dst, const void *src, size_t n)
294294
{
295295
int i;
@@ -306,7 +306,7 @@ void *memmove(void *dst, const void *src, size_t n)
306306
return memcpy(dst, src, n);
307307
}
308308
}
309-
#endif
309+
#endif /* !IAR && !X86_64_EFI */
310310
#endif /* __CCRX__ Renesas CCRX */
311311
#endif /* WOLFBOOT_USE_STDLIBC */
312312

src/x86/exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ int setup_interrupts()
202202

203203
void deinit_interrupts()
204204
{
205-
idt_descriptor.base = (uintptr_t)NULL;
205+
idt_descriptor.base = (uintptr_t)0;
206206
idt_descriptor.limit = 0xffff;
207207
asm ("cli\r\n");
208208
asm ("lidt %0\r\n" : : "m"(idt_descriptor));

test-app/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ ifeq ($(ELF_FLASH_SCATTER),1)
871871
SQUASHELF_TOOL = ../tools/squashelf/squashelf
872872
image-orig.elf: $(APP_OBJS) $(LSCRIPT)
873873
@echo "\t[LD] $@"
874-
$(Q)$(LD) $(LDFLAGS) $(APP_OBJS) $(OUTPUT_FLAG) $@
874+
$(Q)$(LD) $(LDFLAGS) $(APP_OBJS) $(LIBS) $(OUTPUT_FLAG) $@
875875

876876
image.elf: image-orig.elf
877877
@echo "\t[SQUASHELF] $@"
@@ -880,7 +880,7 @@ else
880880
# Default behavior when ELF_FLASH_SCATTER is not set
881881
image.elf: $(APP_OBJS) $(LSCRIPT)
882882
@echo "\t[LD] $@"
883-
$(Q)$(LD) $(LDFLAGS) $(APP_OBJS) $(OUTPUT_FLAG) $@
883+
$(Q)$(LD) $(LDFLAGS) $(APP_OBJS) $(LIBS) $(OUTPUT_FLAG) $@
884884
endif
885885

886886
standalone: image.bin

0 commit comments

Comments
 (0)