From: Lior Weintraub <liorw@pliops.com>
To: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Porting barebox to a new SoC
Date: Sun, 28 May 2023 13:04:51 +0000 [thread overview]
Message-ID: <PR3P195MB05550502A2AD5D21F032A22BC3459@PR3P195MB0555.EURP195.PROD.OUTLOOK.COM> (raw)
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@pliops.com>
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.
next reply other threads:[~2023-05-28 13:06 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-28 13:04 Lior Weintraub [this message]
2023-05-28 15:35 ` Ahmad Fatoum
2023-05-28 15:37 ` [PATCH v2] " Ahmad Fatoum
2023-05-28 20:15 ` Lior Weintraub
2023-05-29 13:34 ` Lior Weintraub
2023-05-29 19:03 ` Ahmad Fatoum
2023-05-30 20:10 ` Lior Weintraub
2023-05-31 6:10 ` Ahmad Fatoum
2023-05-31 8:05 ` Lior Weintraub
2023-05-31 8:40 ` Ahmad Fatoum
2023-05-31 16:13 ` Lior Weintraub
2023-05-31 17:55 ` Ahmad Fatoum
2023-05-31 17:59 ` Ahmad Fatoum
2023-06-01 8:54 ` Lior Weintraub
2023-06-01 9:29 ` Ahmad Fatoum
2023-06-01 11:45 ` Lior Weintraub
2023-06-01 12:35 ` Ahmad Fatoum
2023-06-06 12:54 ` Lior Weintraub
2023-06-06 14:34 ` Ahmad Fatoum
2023-06-12 9:27 ` Lior Weintraub
2023-06-12 12:28 ` Ahmad Fatoum
2023-06-12 14:59 ` Lior Weintraub
2023-06-12 15:07 ` Ahmad Fatoum
2023-06-13 12:39 ` Lior Weintraub
2023-06-13 12:50 ` Ahmad Fatoum
2023-06-13 13:27 ` Lior Weintraub
2023-06-14 6:42 ` Lior Weintraub
2023-06-16 16:20 ` Ahmad Fatoum
2023-06-19 6:40 ` Lior Weintraub
2023-06-19 15:22 ` Ahmad Fatoum
2023-06-25 20:33 ` Lior Weintraub
2023-06-30 5:52 ` Ahmad Fatoum
2023-08-03 11:17 ` Lior Weintraub
2023-08-22 8:00 ` Ahmad Fatoum
2023-08-22 8:48 ` Lior Weintraub
2023-09-07 8:32 ` Ahmad Fatoum
2023-09-07 9:07 ` Lior Weintraub
2023-09-07 9:35 ` Ahmad Fatoum
2023-09-07 11:02 ` Lior Weintraub
2023-09-12 6:04 ` Lior Weintraub
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PR3P195MB05550502A2AD5D21F032A22BC3459@PR3P195MB0555.EURP195.PROD.OUTLOOK.COM \
--to=liorw@pliops.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox