[PATCH v2 3/4] bsps/xil: Adjust Xilinx support code for Cortex-R5

Kinsey Moore kinsey.moore at oarcorp.com
Thu Oct 12 17:01:49 UTC 2023


This fixes some issues in the Xilinx support code that are critical to
support the Cortex-R5F cores present in my Xilinx SoCs. The imported
Cortex-R5 xil_cache.c matches the existing information in
bsps/shared/xil/VERSION.
---
 bsps/include/xil/arm/ARMv8/32bit/xil_system.h | 37 ++++++++++++++++++
 bsps/include/xil/arm/ARMv8/64bit/xil_system.h | 37 ++++++++++++++++++
 bsps/include/xil/arm/cortexa9/xil_system.h    | 38 +++++++++++++++++++
 bsps/include/xil/arm/cortexr5/xil_system.h    | 38 +++++++++++++++++++
 bsps/include/xil/microblaze/xil_system.h      | 37 ++++++++++++++++++
 bsps/include/xil/xdebug.h                     |  2 +
 bsps/shared/xil/{ => arm/ARMv8}/xil_cache.c   |  0
 bsps/shared/xil/arm/cortexr5/xil_mpu.c        |  4 ++
 spec/build/bsps/objxilinxsupport.yml          |  1 -
 spec/build/bsps/objxilinxsupportilp32.yml     |  3 +-
 spec/build/bsps/objxilinxsupportlp64.yml      |  3 +-
 spec/build/bsps/objxilinxsupportr5.yml        |  5 ++-
 12 files changed, 201 insertions(+), 4 deletions(-)
 create mode 100644 bsps/include/xil/arm/ARMv8/32bit/xil_system.h
 create mode 100644 bsps/include/xil/arm/ARMv8/64bit/xil_system.h
 create mode 100644 bsps/include/xil/arm/cortexa9/xil_system.h
 create mode 100644 bsps/include/xil/arm/cortexr5/xil_system.h
 create mode 100644 bsps/include/xil/microblaze/xil_system.h
 create mode 100644 bsps/include/xil/xdebug.h
 rename bsps/shared/xil/{ => arm/ARMv8}/xil_cache.c (100%)

diff --git a/bsps/include/xil/arm/ARMv8/32bit/xil_system.h b/bsps/include/xil/arm/ARMv8/32bit/xil_system.h
new file mode 100644
index 0000000000..7269e5c8d9
--- /dev/null
+++ b/bsps/include/xil/arm/ARMv8/32bit/xil_system.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ *  COPYRIGHT (c) 2023.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_XIL_SYSTEM_H
+#define LIBBSP_SHARED_XIL_SYSTEM_H
+
+/*
+ * This file defines anything necessary for the Xilinx support infrastructure to
+ * function properly on a particular platform.
+ */
+
+#endif
diff --git a/bsps/include/xil/arm/ARMv8/64bit/xil_system.h b/bsps/include/xil/arm/ARMv8/64bit/xil_system.h
new file mode 100644
index 0000000000..7269e5c8d9
--- /dev/null
+++ b/bsps/include/xil/arm/ARMv8/64bit/xil_system.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ *  COPYRIGHT (c) 2023.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_XIL_SYSTEM_H
+#define LIBBSP_SHARED_XIL_SYSTEM_H
+
+/*
+ * This file defines anything necessary for the Xilinx support infrastructure to
+ * function properly on a particular platform.
+ */
+
+#endif
diff --git a/bsps/include/xil/arm/cortexa9/xil_system.h b/bsps/include/xil/arm/cortexa9/xil_system.h
new file mode 100644
index 0000000000..88d5b9aa6e
--- /dev/null
+++ b/bsps/include/xil/arm/cortexa9/xil_system.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ *  COPYRIGHT (c) 2023.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_XIL_SYSTEM_H
+#define LIBBSP_SHARED_XIL_SYSTEM_H
+
+/*
+ * This file defines anything necessary for the Xilinx support infrastructure to
+ * function properly on a particular platform.
+ */
+#define ARMA9
+
+#endif
diff --git a/bsps/include/xil/arm/cortexr5/xil_system.h b/bsps/include/xil/arm/cortexr5/xil_system.h
new file mode 100644
index 0000000000..4274d6916a
--- /dev/null
+++ b/bsps/include/xil/arm/cortexr5/xil_system.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ *  COPYRIGHT (c) 2023.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_XIL_SYSTEM_H
+#define LIBBSP_SHARED_XIL_SYSTEM_H
+
+/*
+ * This file defines anything necessary for the Xilinx support infrastructure to
+ * function properly
+ */
+#define ARMR5
+
+#endif
diff --git a/bsps/include/xil/microblaze/xil_system.h b/bsps/include/xil/microblaze/xil_system.h
new file mode 100644
index 0000000000..7269e5c8d9
--- /dev/null
+++ b/bsps/include/xil/microblaze/xil_system.h
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ *  COPYRIGHT (c) 2023.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_XIL_SYSTEM_H
+#define LIBBSP_SHARED_XIL_SYSTEM_H
+
+/*
+ * This file defines anything necessary for the Xilinx support infrastructure to
+ * function properly on a particular platform.
+ */
+
+#endif
diff --git a/bsps/include/xil/xdebug.h b/bsps/include/xil/xdebug.h
new file mode 100644
index 0000000000..416a2f2cb3
--- /dev/null
+++ b/bsps/include/xil/xdebug.h
@@ -0,0 +1,2 @@
+/* Minimal stub file for Xilinx driver compatibility. */
+#define xdbg_printf(...)
diff --git a/bsps/shared/xil/xil_cache.c b/bsps/shared/xil/arm/ARMv8/xil_cache.c
similarity index 100%
rename from bsps/shared/xil/xil_cache.c
rename to bsps/shared/xil/arm/ARMv8/xil_cache.c
diff --git a/bsps/shared/xil/arm/cortexr5/xil_mpu.c b/bsps/shared/xil/arm/cortexr5/xil_mpu.c
index ae96f43117..a50133d51e 100644
--- a/bsps/shared/xil/arm/cortexr5/xil_mpu.c
+++ b/bsps/shared/xil/arm/cortexr5/xil_mpu.c
@@ -115,12 +115,16 @@ static const struct {
 	{ 0x100000000, REGION_4G },
 };
 
+#ifndef __rtems__
 #if defined (__GNUC__)
 XMpu_Config Mpu_Config __attribute__((section(".bootdata")));
 #elif defined (__ICCARM__)
 #pragma default_function_attributes = @ ".bootdata"
 XMpu_Config Mpu_Config;
 #endif
+#else
+XMpu_Config Mpu_Config __attribute__((section(".bsp_start_data")));
+#endif
 
 /************************** Function Prototypes ******************************/
 void Xil_InitializeExistingMPURegConfig(void);
diff --git a/spec/build/bsps/objxilinxsupport.yml b/spec/build/bsps/objxilinxsupport.yml
index d686ae9cfd..f67316ebdb 100644
--- a/spec/build/bsps/objxilinxsupport.yml
+++ b/spec/build/bsps/objxilinxsupport.yml
@@ -38,7 +38,6 @@ links:
 - role: build-dependency
   uid: optxilsupportpath
 source:
-- bsps/shared/xil/xil_cache.c
 - bsps/shared/xil/xil_assert.c
 - bsps/shared/xil/xil_mem.c
 type: build
diff --git a/spec/build/bsps/objxilinxsupportilp32.yml b/spec/build/bsps/objxilinxsupportilp32.yml
index 2db5d12bef..0fc4fb0f35 100644
--- a/spec/build/bsps/objxilinxsupportilp32.yml
+++ b/spec/build/bsps/objxilinxsupportilp32.yml
@@ -17,5 +17,6 @@ install:
   - bsps/include/xil/arm/ARMv8/32bit/xpseudo_asm.h
   - bsps/include/xil/arm/ARMv8/32bit/xreg_cortexa53.h
 links: []
-source: []
+source:
+- bsps/shared/xil/arm/ARMv8/xil_cache.c
 type: build
diff --git a/spec/build/bsps/objxilinxsupportlp64.yml b/spec/build/bsps/objxilinxsupportlp64.yml
index efb2e8d58a..330ffc34fd 100644
--- a/spec/build/bsps/objxilinxsupportlp64.yml
+++ b/spec/build/bsps/objxilinxsupportlp64.yml
@@ -19,5 +19,6 @@ install:
   - bsps/include/xil/arm/ARMv8/64bit/xpseudo_asm.h
   - bsps/include/xil/arm/ARMv8/64bit/xreg_cortexa53.h
 links: []
-source: []
+source:
+- bsps/shared/xil/arm/ARMv8/xil_cache.c
 type: build
diff --git a/spec/build/bsps/objxilinxsupportr5.yml b/spec/build/bsps/objxilinxsupportr5.yml
index 4f7fe33606..db402af8ca 100644
--- a/spec/build/bsps/objxilinxsupportr5.yml
+++ b/spec/build/bsps/objxilinxsupportr5.yml
@@ -14,6 +14,9 @@ install:
   - bsps/include/xil/arm/cortexr5/xil_exception.h
   - bsps/include/xil/arm/cortexr5/xpseudo_asm.h
   - bsps/include/xil/arm/cortexr5/xreg_cortexr5.h
+  - bsps/include/xil/arm/cortexr5/xil_mpu.h
 links: []
-source: []
+source:
+- bsps/shared/xil/arm/cortexr5/xil_cache.c
+- bsps/shared/xil/arm/cortexr5/xil_mpu.c
 type: build
-- 
2.39.2



More information about the devel mailing list