From 9eecf81cf77c26d7ba1debc5e159113a9bc33963 Mon Sep 17 00:00:00 2001 From: Kinjal Pravinbhai Patel Date: Tue, 16 Dec 2014 14:57:56 +0530 Subject: [PATCH] drivers: cpu_cortexa53: added new driver This patch adds new driver cpu_cortexa53 for zynq ultrascale mp support Signed-off-by: Kinjal Pravinbhai Patel --- .../cpu_cortexa53/data/cpu_cortexa53.mdd | 49 ++++++ .../cpu_cortexa53/data/cpu_cortexa53.tcl | 155 ++++++++++++++++++ .../drivers/cpu_cortexa53/src/Makefile | 22 +++ .../cpu_cortexa53/src/xcpu_cortexa53.h | 39 +++++ 4 files changed, 265 insertions(+) create mode 100755 XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.mdd create mode 100755 XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.tcl create mode 100755 XilinxProcessorIPLib/drivers/cpu_cortexa53/src/Makefile create mode 100755 XilinxProcessorIPLib/drivers/cpu_cortexa53/src/xcpu_cortexa53.h diff --git a/XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.mdd b/XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.mdd new file mode 100755 index 00000000..b52eddb3 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.mdd @@ -0,0 +1,49 @@ +############################################################################### +# +# Copyright (C) 2014 Xilinx, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# Use of the Software is limited solely to applications: +# (a) running on a Xilinx device, or +# (b) that interact with a Xilinx device through a bus or interconnect. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the Xilinx shall not be used +# in advertising or otherwise to promote the sale, use or other dealings in +# this Software without prior written authorization from Xilinx. +# +############################################################################### +OPTION psf_version = 2.1; + +BEGIN driver cpu_cortexa53 + +OPTION copyfiles = all; +OPTION driver_state = ACTIVE; +OPTION supported_peripherals = (ps8_cortexa53); +OPTION default_os = "standalone_v5_0"; +OPTION VERSION = 1.0; +OPTION NAME = cpu_cortexa53; + + +PARAM name = compiler, desc = "Compiler used to compile both BSP/Libraries and Applications.", type = string, default = aarch64-none-elf-gcc; +PARAM name = archiver, desc = "Archiver used to archive libraries for both BSP generation as well as for applications", type = string, default = aarch64-none-elf-ar; +PARAM name = compiler_flags, desc = "Compiler flags used in BSP and library generation. '-c' flag stands for 'compile and assemble, but do not link'. Without this flag, gcc tries to link the code, which will fail bacause there is no application involved during libgen. '-O2' can be overwritten by extra compiler flags", type = string, default = "-O2 -c", permit = none; +PARAM name = extra_compiler_flags, desc = "Extra compiler flags used in BSP and library generation.", type = string, default = "-g"; + +END driver diff --git a/XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.tcl b/XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.tcl new file mode 100755 index 00000000..9e084b19 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/cpu_cortexa53/data/cpu_cortexa53.tcl @@ -0,0 +1,155 @@ +############################################################################### +# +# Copyright (C) 2014 Xilinx, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# Use of the Software is limited solely to applications: +# (a) running on a Xilinx device, or +# (b) that interact with a Xilinx device through a bus or interconnect. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the Xilinx shall not be used +# in advertising or otherwise to promote the sale, use or other dealings in +# this Software without prior written authorization from Xilinx. +# +############################################################################### +# +# Modification History +# +# Ver Who Date Changes +# ----- ---- -------- ----------------------------------------------- +# 1.0 pkp 07/21/14 Initial version +# +############################################################################## +#uses "xillib.tcl" + +############################################################ +# "generate" procedure +############################################################ +proc generate {drv_handle} { + + xdefine_cortexa53_params $drv_handle + xdefine_include_file $drv_handle "xparameters.h" "XCPU_CORTEXA53" "C_CPU_CLK_FREQ_HZ" + xdefine_canonical_xpars $drv_handle "xparameters.h" "CPU_CORTEXA53" "C_CPU_CLK_FREQ_HZ" + xdefine_addr_params_for_ext_intf $drv_handle "xparameters.h" +} + +proc xdefine_cortexa53_params {drvhandle} { + + set sw_proc_handle [get_sw_processor] + set hw_proc_handle [get_cells [get_property HW_INSTANCE $sw_proc_handle ]] + set procdrv [get_sw_processor] + set archiver [get_property CONFIG.archiver $procdrv] + if {[string first "iarchive" $archiver] < 0 } { + } else { + set libxil_a [file join .. .. lib libxil.a] + if { ![file exists $libxil_a] } { + # create empty libxil.a + set fd [open "test.a" a+] + close $fd + exec $archiver --create --output $libxil_a test.a + file delete -force test.a + } + } + set periphs [::hsm::utils::get_common_driver_ips $drvhandle] + set lprocs [get_cells -filter "IP_NAME==ps8_cortexa53"] + set lprocs [lsort $lprocs] + + set config_inc [::hsm::utils::open_include_file "xparameters.h"] + puts $config_inc "/* Definition for CPU ID */" + + foreach periph $periphs { + set iname [get_property NAME $periph] + + #----------- + # Set CPU ID + #----------- + set id 0 + foreach processor $lprocs { + if {[string compare -nocase $processor $iname] == 0} { + puts $config_inc "#define XPAR_CPU_ID $id" + } + incr id + } + } + + close $config_inc +} + +proc xdefine_addr_params_for_ext_intf {drvhandle file_name} { + set sw_proc_handle [get_sw_processor] + set hw_proc_handle [get_cells [get_property HW_INSTANCE $sw_proc_handle ]] + + # Open include file + set file_handle [::hsm::utils::open_include_file $file_name] + + set mem_ranges [get_mem_ranges -of_objects $hw_proc_handle] + foreach mem_range $mem_ranges { + set inst [get_property INSTANCE $mem_range] + if {$inst != ""} { + continue + } + + + set bparam_name [get_property BASE_NAME $mem_range] + set bparam_value [get_property BASE_VALUE $mem_range] + set hparam_name [get_property HIGH_NAME $mem_range] + set hparam_value [get_property HIGH_VALUE $mem_range] + + # Print all parameters for all peripherals + + + set name [string toupper [get_property NAME $mem_range]] + puts $file_handle "" + puts $file_handle "/* Definitions for interface [string toupper $name] */" + set name [format "XPAR_%s_" $name] + + + if {$bparam_value != ""} { + set value [::hsm::utils::format_addr_string $bparam_value $bparam_name] + set param [string toupper $bparam_name] + if {[string match C_* $param]} { + set name [format "%s%s" $name [string range $param 2 end]] + } else { + set name [format "%s%s" $name $param] + } + + puts $file_handle "#define $name $value" + } + + set name [string toupper [get_property NAME $mem_range]] + set name [format "XPAR_%s_" $name] + if {$hparam_value != ""} { + set value [::hsm::utils::format_addr_string $hparam_value $hparam_name] + set param [string toupper $hparam_name] + if {[string match C_* $param]} { + set name [format "%s%s" $name [string range $param 2 end]] + } else { + set name [format "%s%s" $name $param] + } + + puts $file_handle "#define $name $value" + } + + + puts $file_handle "" + } + + close $file_handle +} diff --git a/XilinxProcessorIPLib/drivers/cpu_cortexa53/src/Makefile b/XilinxProcessorIPLib/drivers/cpu_cortexa53/src/Makefile new file mode 100755 index 00000000..747a7a10 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/cpu_cortexa53/src/Makefile @@ -0,0 +1,22 @@ +COMPILER= +ARCHIVER= +CP=cp +COMPILER_FLAGS= +EXTRA_COMPILER_FLAGS= +LIB=libxil.a + +RELEASEDIR=../../../lib +INCLUDEDIR=../../../include +INCLUDES=-I${INCLUDEDIR} + +OUTS = *.o + +LIBSOURCES=*.c +INCLUDEFILES=*.h + +libs: + echo "Compiling cpu_cortexa53" + +.PHONY: include +include: + ${CP} $(INCLUDEFILES) $(INCLUDEDIR) diff --git a/XilinxProcessorIPLib/drivers/cpu_cortexa53/src/xcpu_cortexa53.h b/XilinxProcessorIPLib/drivers/cpu_cortexa53/src/xcpu_cortexa53.h new file mode 100755 index 00000000..a2ae6353 --- /dev/null +++ b/XilinxProcessorIPLib/drivers/cpu_cortexa53/src/xcpu_cortexa53.h @@ -0,0 +1,39 @@ +/****************************************************************************** +* +* Copyright (C) 2014 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ +/*****************************************************************************/ +/** +* +* @file xcpu_cortexa53.h +* +* dummy file +* +******************************************************************************/