From: kolerov93@gmail.com
To: newlib@sourceware.org
Cc: shahab@synopsys.com, claziss@gmail.com,
Yuriy Kolerov <kolerov93@gmail.com>,
Vladimir Isaev <vvisaev@gmail.com>
Subject: [PATCH 11/15] arc: libgloss: Add support of IoT Development Kit board
Date: Tue, 21 May 2024 10:56:54 +0100 [thread overview]
Message-ID: <20240521095658.10311-12-kolerov93@gmail.com> (raw)
In-Reply-To: <20240521095658.10311-1-kolerov93@gmail.com>
From: Yuriy Kolerov <kolerov93@gmail.com>
An example of building an application:
$ arc-elf32-gcc -mcpu=em -specs=iotdk.specs main.c -o main
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
---
libgloss/arc/iotdk-uart-setup.c | 36 +++++++++++++++++++++++++++++++++
libgloss/arc/iotdk.ld | 14 +++++++++++++
libgloss/arc/iotdk.specs | 18 +++++++++++++++++
3 files changed, 68 insertions(+)
create mode 100644 libgloss/arc/iotdk-uart-setup.c
create mode 100644 libgloss/arc/iotdk.ld
create mode 100644 libgloss/arc/iotdk.specs
diff --git a/libgloss/arc/iotdk-uart-setup.c b/libgloss/arc/iotdk-uart-setup.c
new file mode 100644
index 000000000..e6d2ac887
--- /dev/null
+++ b/libgloss/arc/iotdk-uart-setup.c
@@ -0,0 +1,36 @@
+/*
+ * iotdk-setup.c -- provide _setup_low_level() to initialize UART.
+ *
+ * Copyright (c) 2024 Synopsys Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ *
+ */
+
+#include "uart-8250.h"
+
+/* Setup UART parameters. */
+int
+_setup_low_level (void)
+{
+ void * const uart_base = (void *) 0x80014000;
+ const uint32_t uart_clk_ena = 0xC0;
+ const int uart_aux_mapped = 1;
+ const uint32_t uart_clock = 16000000;
+ const uint32_t uart_baud = 115200;
+
+ /* For this platform we have to enable UART clock before configuring it. */
+ __builtin_arc_sr (0x01, (uint32_t) uart_base + uart_clk_ena);
+
+ _uart_8250_setup (uart_base, uart_aux_mapped, uart_clock, uart_baud);
+
+ return 0;
+}
diff --git a/libgloss/arc/iotdk.ld b/libgloss/arc/iotdk.ld
new file mode 100644
index 000000000..18874e819
--- /dev/null
+++ b/libgloss/arc/iotdk.ld
@@ -0,0 +1,14 @@
+/* Memory map for ARC IoT DK - EM9D */
+
+MEMORY
+{
+ ICCM : ORIGIN = 0x20000000, LENGTH = 256K
+ DCCM : ORIGIN = 0x80000000, LENGTH = 128K
+}
+
+REGION_ALIAS("startup", ICCM)
+REGION_ALIAS("text", ICCM)
+REGION_ALIAS("data", DCCM)
+REGION_ALIAS("sdata", DCCM)
+
+INCLUDE arcv2elf-common.ld
diff --git a/libgloss/arc/iotdk.specs b/libgloss/arc/iotdk.specs
new file mode 100644
index 000000000..9f9ba433f
--- /dev/null
+++ b/libgloss/arc/iotdk.specs
@@ -0,0 +1,18 @@
+%rename link iotdk_link
+%rename link_gcc_c_sequence iotdk_link_gcc_c_sequence
+%rename startfile iotdk_startfile
+
+*link:
+%(iotdk_link) -T iotdk.ld%s
+
+*iotdk_libgloss:
+-luart_8250 -liotdk_uart
+
+*iotdk_libc:
+%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}
+
+*link_gcc_c_sequence:
+%(iotdk_link_gcc_c_sequence) --start-group %G %(iotdk_libc) %(iotdk_libgloss) --end-group
+
+*startfile:
+%(iotdk_startfile) arc-main-helper%O%s
--
2.39.2
next prev parent reply other threads:[~2024-05-21 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 9:56 [PATCH 00/15] A series of fixes for ARC and libgloss update kolerov93
2024-05-21 9:56 ` [PATCH 01/15] arc: libgloss: Use long calls attribute for exit_halt kolerov93
2024-05-21 9:56 ` [PATCH 02/15] arc: libc: Add support of 16-entry register file kolerov93
2024-05-21 9:56 ` [PATCH 03/15] arc: libc,libgloss: Remove .file directive from .S files kolerov93
2024-05-21 9:56 ` [PATCH 04/15] arc: libc: Record r58/r59 in long-jump's buffer kolerov93
2024-05-21 9:56 ` [PATCH 05/15] arc: libgloss: Use fstat call instead of stat for nSIM kolerov93
2024-05-21 9:56 ` [PATCH 06/15] arc: libgloss: Introduce hostlink interface kolerov93
2024-05-21 9:56 ` [PATCH 07/15] arc: libgloss: Use atexit to setup fini routines kolerov93
2024-05-21 9:56 ` [PATCH 08/15] arc: libgloss: Clean registers before any use kolerov93
2024-05-21 9:56 ` [PATCH 09/15] arc: libgloss: Add UART 8250 library kolerov93
2024-05-21 9:56 ` [PATCH 10/15] arc: libgloss: Add a linker script common for all boards kolerov93
2024-05-21 9:56 ` kolerov93 [this message]
2024-05-21 9:56 ` [PATCH 12/15] arc: libgloss: Add support of HS Development Kit board kolerov93
2024-05-21 9:56 ` [PATCH 13/15] arc: libgloss: Add support of EM SDP board kolerov93
2024-05-21 9:56 ` [PATCH 14/15] arc: libgloss: Add support of EM Starter Kit board kolerov93
2024-05-21 9:56 ` [PATCH 15/15] arc: libgloss: Add build rules for new boards kolerov93
2024-05-22 18:28 ` [PATCH 00/15] A series of fixes for ARC and libgloss update Jeff Johnston
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=20240521095658.10311-12-kolerov93@gmail.com \
--to=kolerov93@gmail.com \
--cc=claziss@gmail.com \
--cc=newlib@sourceware.org \
--cc=shahab@synopsys.com \
--cc=vvisaev@gmail.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).