Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xilinx a72 and a78 #252

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ option (WITH_FUNC_LINE_LOG "Log with function name, line number prefix" OFF)
option (WITH_DOC "Build with documentation" ON)

set_property (GLOBAL PROPERTY "PROJECT_EC_FLAGS" -Wall -Werror -Wextra)

if ("${PROJECT_MACHINE}" STREQUAL "zynqmp_a53" OR
"${PROJECT_MACHINE}" STREQUAL "zynqmp_a72" OR
"${PROJECT_MACHINE}" STREQUAL "zynqmp_a78" OR
"${PROJECT_MACHINE}" STREQUAL "zynqmp_r5" OR
"${PROJECT_MACHINE}" STREQUAL "microblaze_generic" OR
"${PROJECT_MACHINE}" STREQUAL "zynq7")
add_definitions( -DXLNX_PLATFORM )
endif()
7 changes: 7 additions & 0 deletions lib/system/freertos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE})
add_subdirectory(${PROJECT_MACHINE})
endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_MACHINE})

if ("${PROJECT_MACHINE}" STREQUAL "zynqmp_a53" OR
"${PROJECT_MACHINE}" STREQUAL "zynqmp_a72" OR
"${PROJECT_MACHINE}" STREQUAL "zynqmp_a78" OR
"${PROJECT_MACHINE}" STREQUAL "zynqmp_r5" OR
"${PROJECT_MACHINE}" STREQUAL "zynq7")
add_subdirectory(xlnx)
endif()
4 changes: 4 additions & 0 deletions lib/system/freertos/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

#include <metal/errno.h>

#ifdef XLNX_PLATFORM
#include <metal/system/freertos/xlnx/sys.h>
#else
#include "./@PROJECT_MACHINE@/sys.h"
arnopo marked this conversation as resolved.
Show resolved Hide resolved
#endif

#ifdef __cplusplus
extern "C" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
collect (PROJECT_LIB_HEADERS sys.h)

collect (PROJECT_LIB_SOURCES irq.c)
collect (PROJECT_LIB_SOURCES sys.c)

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

/*
* @file generic/xlnx_common/irq.c
* @brief generic libmetal Xilinx irq controller definitions.
* @file freertos/xlnx/irq.c
* @brief freertos libmetal Xilinx irq controller definitions.
*/

#include <metal/errno.h>
Expand All @@ -17,6 +17,7 @@
#include <metal/list.h>
#include <metal/utilities.h>
#include <metal/alloc.h>
#include <metal/system/freertos/xlnx/sys.h>

#define MAX_IRQS XLNX_MAXIRQS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
/*
* Copyright (c) 2016, Xilinx Inc. and Contributors. All rights reserved.
* Copyright (C) 2022, Advanced Micro Devices, Inc.
* Copyright (C) 2023, Advanced Micro Devices, Inc.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*
* @file generic/zynqmp_r5/sys.c
* @file freertos/xlnx/sys.c
* @brief machine specific system primitives implementation.
*/

#include <metal/compiler.h>
#include <metal/io.h>
#include <metal/sys.h>
#include <metal/utilities.h>
#include <stdint.h>
#include "xil_cache.h"
#include "xil_exception.h"
#include "xscugic.h"
#include "xil_mmu.h"

#if (defined(__aarch64__) || defined(ARMA53_32)) && !defined(SDT)

#ifdef VERSAL_NET
#include "xcpu_cortexa78.h"
#elif defined(versal)
#include "xcpu_cortexa72.h"
#else
#include "xreg_cortexa53.h"
#endif /* defined(versal) */

#elif defined(ARMR5)

#include "xil_mpu.h"
#include "xreg_cortexr5.h"
#include "xscugic.h"

#endif /* (defined(__aarch64__) || defined(ARMA53_32)) && !defined(SDT) */

void sys_irq_restore_enable(unsigned int flags)
{
Expand Down Expand Up @@ -60,10 +75,6 @@ void metal_weak metal_generic_default_poll(void)
metal_asm volatile("wfi");
}

/**
* The code moved to cortexr5/xil_mpu.c:Xil_MemMap()
* NULL in pa masks possible Xil_MemMap() errors.
*/
void *metal_machine_io_mem_map(void *va, metal_phys_addr_t pa,
size_t size, unsigned int flags)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
/*
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
* Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*
* @file freertos/xlnx_common/sys.h
* @file freertos/xlnx/sys.h
* @brief freertos Xilinx common system primitives for libmetal.
*/

#ifndef __METAL_FREERTOS_SYS__H__
#error "Include metal/sys.h instead of metal/freertos/@PROJECT_MACHINE@/sys.h"
#endif

#ifndef __METAL_FREERTOS_XLNX_COMMON_SYS__H__
#define __METAL_FREERTOS_XLNX_COMMON_SYS__H__
#ifndef __METAL_FREERTOS_XLNX_SYS__H__
#define __METAL_FREERTOS_XLNX_SYS__H__

#include "xscugic.h"
#include "FreeRTOS.h"

#ifdef __cplusplus
extern "C" {
#endif

#if defined(SDT) && defined(PLATFORM_ZYNQ)
#define XPAR_SCUGIC_0_DIST_BASEADDR XPAR_SCUGIC_DIST_BASEADDR
#endif

#ifndef XLNX_MAXIRQS
#define XLNX_MAXIRQS XSCUGIC_MAX_NUM_INTR_INPUTS
#endif

/**
* @brief metal_xlnx_irq_isr
*
Expand All @@ -40,8 +52,26 @@ void metal_xlnx_irq_isr(void *arg);
*/
int metal_xlnx_irq_init(void);

static inline void sys_irq_enable(unsigned int vector)
{
#ifdef PLATFORM_ZYNQ
XScuGic_EnableIntr(XPAR_SCUGIC_0_DIST_BASEADDR, vector);
#else
vPortEnableInterrupt(vector);
#endif
}

static inline void sys_irq_disable(unsigned int vector)
{
#ifdef PLATFORM_ZYNQ
XScuGic_DisableIntr(XPAR_SCUGIC_0_DIST_BASEADDR, vector);
#else
vPortDisableInterrupt(vector);
#endif
}

#ifdef __cplusplus
}
#endif

#endif /* __METAL_FREERTOS_XLNX_COMMON_SYS__H__ */
#endif /* __METAL_FREERTOS_XLNX_SYS__H__ */
5 changes: 0 additions & 5 deletions lib/system/freertos/zynq7/CMakeLists.txt

This file was deleted.

99 changes: 0 additions & 99 deletions lib/system/freertos/zynq7/sys.c

This file was deleted.

46 changes: 0 additions & 46 deletions lib/system/freertos/zynq7/sys.h

This file was deleted.

5 changes: 0 additions & 5 deletions lib/system/freertos/zynqmp_a53/CMakeLists.txt

This file was deleted.

Loading
Loading