[13/15] arc: libgloss: Add support of EM SDP board

Message ID 20240521095658.10311-14-kolerov93@gmail.com
State New
Headers
Series A series of fixes for ARC and libgloss update |

Commit Message

Yuriy Kolerov May 21, 2024, 9:56 a.m. UTC
  From: Yuriy Kolerov <kolerov93@gmail.com>

These specs files are introduced for EM SDP board:

    * emsdp1.1.specs - EM SDP 1.1, everything in ICCM/DCCM memory
    * emsdp1.1_ram.specs - EM SDP 1.1, startup code in ICCM
      memory and everything else in RAM
    * emsdp1.2.specs - EM SDP 1.2, everything in ICCM/DCCM memory
    * emsdp1.2_ram.specs - EM SDP 1.2, startup code in ICCM
      memory and everything else in RAM

An example of building an application:

    $ arc-elf32-gcc -mcpu=em -specs=emsdp1.1_ram.specs main.c -o main

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
---
 libgloss/arc/emsdp-uart-setup.c | 32 ++++++++++++++++++++++++++++++++
 libgloss/arc/emsdp1.1.ld        | 15 +++++++++++++++
 libgloss/arc/emsdp1.1.specs     | 18 ++++++++++++++++++
 libgloss/arc/emsdp1.1_ram.ld    | 15 +++++++++++++++
 libgloss/arc/emsdp1.1_ram.specs | 18 ++++++++++++++++++
 libgloss/arc/emsdp1.2.ld        | 15 +++++++++++++++
 libgloss/arc/emsdp1.2.specs     | 18 ++++++++++++++++++
 libgloss/arc/emsdp1.2_ram.ld    | 15 +++++++++++++++
 libgloss/arc/emsdp1.2_ram.specs | 18 ++++++++++++++++++
 9 files changed, 164 insertions(+)
 create mode 100644 libgloss/arc/emsdp-uart-setup.c
 create mode 100644 libgloss/arc/emsdp1.1.ld
 create mode 100644 libgloss/arc/emsdp1.1.specs
 create mode 100644 libgloss/arc/emsdp1.1_ram.ld
 create mode 100644 libgloss/arc/emsdp1.1_ram.specs
 create mode 100644 libgloss/arc/emsdp1.2.ld
 create mode 100644 libgloss/arc/emsdp1.2.specs
 create mode 100644 libgloss/arc/emsdp1.2_ram.ld
 create mode 100644 libgloss/arc/emsdp1.2_ram.specs
  

Patch

diff --git a/libgloss/arc/emsdp-uart-setup.c b/libgloss/arc/emsdp-uart-setup.c
new file mode 100644
index 000000000..eacf98057
--- /dev/null
+++ b/libgloss/arc/emsdp-uart-setup.c
@@ -0,0 +1,32 @@ 
+/*
+ * emsdp-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 *) 0xf0004000;
+  const int uart_aux_mapped = 0;
+  const uint32_t uart_clock = 100000000;
+  const uint32_t uart_baud = 115200;
+
+  _uart_8250_setup (uart_base, uart_aux_mapped, uart_clock, uart_baud);
+
+  return 0;
+}
diff --git a/libgloss/arc/emsdp1.1.ld b/libgloss/arc/emsdp1.1.ld
new file mode 100644
index 000000000..c50ba0684
--- /dev/null
+++ b/libgloss/arc/emsdp1.1.ld
@@ -0,0 +1,15 @@ 
+/* Memory map for ARC EM Software Development Platform 1.0 and 1.1 */
+
+MEMORY
+{
+    PSRAM : ORIGIN = 0x10000000, LENGTH =  16M
+    ICCM0 : ORIGIN = 0x60000000, LENGTH = 128K
+    DCCM  : ORIGIN = 0x80000000, LENGTH = 128K
+}
+
+REGION_ALIAS("startup", ICCM0)
+REGION_ALIAS("text", ICCM0)
+REGION_ALIAS("data", DCCM)
+REGION_ALIAS("sdata", DCCM)
+
+INCLUDE arcv2elf-common.ld
diff --git a/libgloss/arc/emsdp1.1.specs b/libgloss/arc/emsdp1.1.specs
new file mode 100644
index 000000000..965c8d532
--- /dev/null
+++ b/libgloss/arc/emsdp1.1.specs
@@ -0,0 +1,18 @@ 
+%rename link emsdp_link
+%rename link_gcc_c_sequence emsdp_link_gcc_c_sequence
+%rename startfile emsdp_startfile
+
+*link:
+%(emsdp_link) -T emsdp1.1.ld%s
+
+*emsdp_libgloss:
+-luart_8250 -lemsdp_uart
+
+*emsdp_libc:
+%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}
+
+*link_gcc_c_sequence:
+%(emsdp_link_gcc_c_sequence) --start-group %G %(emsdp_libc) %(emsdp_libgloss) --end-group
+
+*startfile:
+%(emsdp_startfile) arc-main-helper%O%s
diff --git a/libgloss/arc/emsdp1.1_ram.ld b/libgloss/arc/emsdp1.1_ram.ld
new file mode 100644
index 000000000..743a4808d
--- /dev/null
+++ b/libgloss/arc/emsdp1.1_ram.ld
@@ -0,0 +1,15 @@ 
+/* Memory map for ARC EM Software Development Platform 1.0 and 1.1 */
+
+MEMORY
+{
+    PSRAM : ORIGIN = 0x10000000, LENGTH =  16M
+    ICCM0 : ORIGIN = 0x60000000, LENGTH = 128K
+    DCCM  : ORIGIN = 0x80000000, LENGTH = 128K
+}
+
+REGION_ALIAS("startup", ICCM0)
+REGION_ALIAS("text", PSRAM)
+REGION_ALIAS("data", PSRAM)
+REGION_ALIAS("sdata", PSRAM)
+
+INCLUDE arcv2elf-common.ld
diff --git a/libgloss/arc/emsdp1.1_ram.specs b/libgloss/arc/emsdp1.1_ram.specs
new file mode 100644
index 000000000..6fa74e869
--- /dev/null
+++ b/libgloss/arc/emsdp1.1_ram.specs
@@ -0,0 +1,18 @@ 
+%rename link emsdp_link
+%rename link_gcc_c_sequence emsdp_link_gcc_c_sequence
+%rename startfile emsdp_startfile
+
+*link:
+%(emsdp_link) -T emsdp1.1_ram.ld%s
+
+*emsdp_libgloss:
+-luart_8250 -lemsdp_uart
+
+*emsdp_libc:
+%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}
+
+*link_gcc_c_sequence:
+%(emsdp_link_gcc_c_sequence) --start-group %G %(emsdp_libc) %(emsdp_libgloss) --end-group
+
+*startfile:
+%(emsdp_startfile) arc-main-helper%O%s
diff --git a/libgloss/arc/emsdp1.2.ld b/libgloss/arc/emsdp1.2.ld
new file mode 100644
index 000000000..7e536d07c
--- /dev/null
+++ b/libgloss/arc/emsdp1.2.ld
@@ -0,0 +1,15 @@ 
+/* Memory map for ARC EM Software Development Platform 1.2 */
+
+MEMORY
+{
+    ICCM0 : ORIGIN = 0x10000000, LENGTH = 128K
+    PSRAM : ORIGIN = 0x40000000, LENGTH =  16M
+    DCCM  : ORIGIN = 0x80000000, LENGTH = 128K
+}
+
+REGION_ALIAS("startup", ICCM0)
+REGION_ALIAS("text", ICCM0)
+REGION_ALIAS("data", DCCM)
+REGION_ALIAS("sdata", DCCM)
+
+INCLUDE arcv2elf-common.ld
diff --git a/libgloss/arc/emsdp1.2.specs b/libgloss/arc/emsdp1.2.specs
new file mode 100644
index 000000000..0366fe52c
--- /dev/null
+++ b/libgloss/arc/emsdp1.2.specs
@@ -0,0 +1,18 @@ 
+%rename link emsdp_link
+%rename link_gcc_c_sequence emsdp_link_gcc_c_sequence
+%rename startfile emsdp_startfile
+
+*link:
+%(emsdp_link) -T emsdp1.2.ld%s
+
+*emsdp_libgloss:
+-luart_8250 -lemsdp_uart
+
+*emsdp_libc:
+%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}
+
+*link_gcc_c_sequence:
+%(emsdp_link_gcc_c_sequence) --start-group %G %(emsdp_libc) %(emsdp_libgloss) --end-group
+
+*startfile:
+%(emsdp_startfile) arc-main-helper%O%s
diff --git a/libgloss/arc/emsdp1.2_ram.ld b/libgloss/arc/emsdp1.2_ram.ld
new file mode 100644
index 000000000..3128c15c1
--- /dev/null
+++ b/libgloss/arc/emsdp1.2_ram.ld
@@ -0,0 +1,15 @@ 
+/* Memory map for ARC EM Software Development Platform 1.2 */
+
+MEMORY
+{
+    ICCM0 : ORIGIN = 0x10000000, LENGTH = 128K
+    PSRAM : ORIGIN = 0x40000000, LENGTH =  16M
+    DCCM  : ORIGIN = 0x80000000, LENGTH = 128K
+}
+
+REGION_ALIAS("startup", ICCM0)
+REGION_ALIAS("text", PSRAM)
+REGION_ALIAS("data", PSRAM)
+REGION_ALIAS("sdata", PSRAM)
+
+INCLUDE arcv2elf-common.ld
diff --git a/libgloss/arc/emsdp1.2_ram.specs b/libgloss/arc/emsdp1.2_ram.specs
new file mode 100644
index 000000000..97284fae2
--- /dev/null
+++ b/libgloss/arc/emsdp1.2_ram.specs
@@ -0,0 +1,18 @@ 
+%rename link emsdp_link
+%rename link_gcc_c_sequence emsdp_link_gcc_c_sequence
+%rename startfile emsdp_startfile
+
+*link:
+%(emsdp_link) -T emsdp1.2_ram.ld%s
+
+*emsdp_libgloss:
+-luart_8250 -lemsdp_uart
+
+*emsdp_libc:
+%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}
+
+*link_gcc_c_sequence:
+%(emsdp_link_gcc_c_sequence) --start-group %G %(emsdp_libc) %(emsdp_libgloss) --end-group
+
+*startfile:
+%(emsdp_startfile) arc-main-helper%O%s