Skip to content

Commit 4d2c7bb

Browse files
dgarskedanielinux
authored andcommitted
Fix CI build errors
1 parent 8da5d0f commit 4d2c7bb

File tree

12 files changed

+41
-34
lines changed

12 files changed

+41
-34
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,22 @@ 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+
export PATH="$GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-${XPACK_VER}/bin:$PATH"
97+
riscv-none-elf-gcc --version
98+
riscv-none-elf-gcc -print-multi-lib | head -5
10099
101100
# ============================================================
102101
# Build wolfboot
@@ -116,9 +115,9 @@ jobs:
116115
- name: Build wolfboot (riscv32)
117116
if: ${{ inputs.arch == 'riscv' }}
118117
run: |
119-
make CROSS_COMPILE=riscv32-unknown-elf- FREEDOM_E_SDK=$GITHUB_WORKSPACE/freedom-e-sdk ${{inputs.make-args}}
118+
make CROSS_COMPILE=riscv-none-elf- FREEDOM_E_SDK=$GITHUB_WORKSPACE/freedom-e-sdk ${{inputs.make-args}}
120119
121120
- name: Build wolfboot (riscv64)
122121
if: ${{ inputs.arch == 'riscv64' }}
123122
run: |
124-
make CROSS_COMPILE=riscv64-unknown-elf- ${{inputs.make-args}}
123+
make CROSS_COMPILE=riscv-none-elf- ${{inputs.make-args}}

hal/mpfs250-m.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ SECTIONS
8989
/* Public key store - must be in a copied section so it's available
9090
* in L2 SRAM after startup copies .data from eNVM */
9191
KEEP(*(.keystore*))
92-
. = ALIGN(4);
92+
. = ALIGN(8);
9393
_end_data = .;
9494
} > L2_SCRATCH AT > FLASH_ENVM
9595

@@ -100,7 +100,7 @@ SECTIONS
100100
*(.bss*)
101101
*(.sbss*)
102102
*(COMMON)
103-
. = ALIGN(4);
103+
. = ALIGN(8);
104104
_end_bss = .;
105105
_end = .;
106106
} > L2_SCRATCH

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 */
@@ -276,7 +276,7 @@ void RAMFUNCTION *memcpy(void *dst, const void *src, size_t n)
276276
}
277277
#endif /* IAR */
278278

279-
#ifndef __IAR_SYSTEMS_ICC__
279+
#if !defined(__IAR_SYSTEMS_ICC__) && !defined(TARGET_X86_64_EFI)
280280
void *memmove(void *dst, const void *src, size_t n)
281281
{
282282
int i;
@@ -293,7 +293,7 @@ void *memmove(void *dst, const void *src, size_t n)
293293
return memcpy(dst, src, n);
294294
}
295295
}
296-
#endif
296+
#endif /* !IAR && !X86_64_EFI */
297297
#endif /* __CCRX__ Renesas CCRX */
298298
#endif /* WOLFBOOT_USE_STDLIBC */
299299

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));

0 commit comments

Comments
 (0)