Hi, I tried to follow the porting guide on https://www.barebox.org/doc/latest/devel/porting.html# but couldn't follow the instructions. I would like to port barebox to a new SoC (which is not a derivative of any known SoC). It has the following: * Single Cortex A53 * SRAM (4MB) located on address 0xC000000000 The below patch shows my initial test to try and have a starting point. I am setting env variables: export ARCH=arm64 export CROSS_COMPILE=/home/pliops/workspace/ARM/arm-gnu-toolchain/bin/aarch64-none-elf- Then I build with: make spider_defconfig && make This gives an error: aarch64-none-elf-gcc: error: unrecognized argument in option '-mabi=apcs-gnu' aarch64-none-elf-gcc: note: valid arguments to '-mabi=' are: ilp32 lp64 aarch64-none-elf-gcc: error: unrecognized command-line option '-msoft-float' aarch64-none-elf-gcc: error: unrecognized command-line option '-mno-unaligned-access' /home/pliops/workspace/simplest-linux-demo/barebox/scripts/Makefile.build:140: recipe for target 'scripts/mod/empty.o' failed make[2]: *** [scripts/mod/empty.o] Error 1 Not sure why the compiler flags get -mabi=apcs-gnu when I explicitly set CONFIG_CPU_V8 and the arch/arm/Makefile has: ifeq ($(CONFIG_CPU_V8), y) CFLAGS_ABI :=-mabi=lp64 The changes I did: >From 848b5f9b18bb1bb96d197cbc1b368ee0a729d581 Mon Sep 17 00:00:00 2001 From: Lior Weintraub <liorw@xxxxxxxxxx> Date: Sun, 28 May 2023 15:51:44 +0300 Subject: [PATCH 1/1] Initial Pliops Spider board --- arch/arm/boards/pliops/spider/Makefile | 4 ++++ arch/arm/boards/pliops/spider/board.c | 26 ++++++++++++++++++++++ arch/arm/boards/pliops/spider/lowlevel.c | 28 ++++++++++++++++++++++++ arch/arm/configs/spider_defconfig | 3 +++ 4 files changed, 61 insertions(+) create mode 100644 arch/arm/boards/pliops/spider/Makefile create mode 100644 arch/arm/boards/pliops/spider/board.c create mode 100644 arch/arm/boards/pliops/spider/lowlevel.c create mode 100644 arch/arm/configs/spider_defconfig diff --git a/arch/arm/boards/pliops/spider/Makefile b/arch/arm/boards/pliops/spider/Makefile new file mode 100644 index 0000000000..da63d2625f --- /dev/null +++ b/arch/arm/boards/pliops/spider/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-y += board.o +lwl-y += lowlevel.o diff --git a/arch/arm/boards/pliops/spider/board.c b/arch/arm/boards/pliops/spider/board.c new file mode 100644 index 0000000000..17cdd5e2b9 --- /dev/null +++ b/arch/arm/boards/pliops/spider/board.c @@ -0,0 +1,26 @@ +#include <bbu.h> +#include <boot.h> +#include <bootm.h> +#include <common.h> +#include <deep-probe.h> +#include <environment.h> +#include <fcntl.h> +#include <globalvar.h> + +static int spider_board_probe(struct device *dev) +{ + /* Do some board-specific setup */ + return 0; +} + +static const struct of_device_id spider_board_of_match[] = { + { .compatible = "spider,spider-board" }, + { /* sentinel */ }, +}; + +static struct driver spider_board_driver = { + .name = "board-spider", + .probe = spider_board_probe, + .of_compatible = spider_board_of_match, +}; +device_platform_driver(spider_board_driver); \ No newline at end of file diff --git a/arch/arm/boards/pliops/spider/lowlevel.c b/arch/arm/boards/pliops/spider/lowlevel.c new file mode 100644 index 0000000000..f3d5a27647 --- /dev/null +++ b/arch/arm/boards/pliops/spider/lowlevel.c @@ -0,0 +1,28 @@ +#include <common.h> +#include <asm/barebox-arm.h> + +#define BASE_ADDR (0xD000307000) +#define GPRAM_ADDR (0xC000000000) +#define MY_STACK_TOP (0xC000000000 + SZ_2M) // Set the stack 2MB from GPRAM start (excatly in the middle) +static inline void spider_serial_putc(void *base, int c) +{ +// if (!(readl(base + UCR1) & UCR1_UARTEN)) +// return; +// +// while (!(readl(base + USR2) & USR2_TXDC)); +// +// writel(c, base + URTX0); +} + +ENTRY_FUNCTION_WITHSTACK(start_spider_board, MY_STACK_TOP, r0, r1, r2) +{ + extern char __dtb_spider_board_start[]; + void *fdt; + + relocate_to_current_adr(); + setup_c(); + + pbl_set_putc(spider_serial_putc, (void *)BASE_ADDR); + + barebox_arm_entry(GPRAM_ADDR, SZ_2M, __dtb_spider_board_start); +} diff --git a/arch/arm/configs/spider_defconfig b/arch/arm/configs/spider_defconfig new file mode 100644 index 0000000000..b4c4a32de0 --- /dev/null +++ b/arch/arm/configs/spider_defconfig @@ -0,0 +1,3 @@ +CONFIG_TEXT_BASE=0x4000000000 +CONFIG_64BIT=y +CONFIG_CPU_V8=y -- 2.40.0 Appreciate your kind advise, Cheers, Lior.