Skip to content

Commit

Permalink
sw_apps: versal_psmfw: Version less build support for PSMFW
Browse files Browse the repository at this point in the history
This patch adds support for versionless build support for PSMFW for
2020.2 release.

Signed-off-by: Rajan Vaja <[email protected]>
Acked-by: Nicole Baze <[email protected]>
  • Loading branch information
rajanv-xilinx authored and Meena Paleti committed Dec 23, 2020
1 parent 2fed935 commit 809d7ad
Show file tree
Hide file tree
Showing 14 changed files with 1,910 additions and 0 deletions.
48 changes: 48 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Makefile generated by Xilinx.

DRIVER_LIB_VERSION = 1.0
PROCESSOR = psv_psm_0
LIBRARIES = ${PROCESSOR}/lib/libxil.a
BSP_MAKEFILES := $(wildcard $(PROCESSOR)/libsrc/*/src/Makefile)
SUBDIRS := $(patsubst %/Makefile, %, $(BSP_MAKEFILES))
BSP_PARALLEL_MAKEFILES := $(filter-out $(BSP_SEQUENTIAL_MAKEFILES),$(BSP_MAKEFILES))
SEQ_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_SEQUENTIAL_MAKEFILES))
PAR_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_PARALLEL_MAKEFILES))

ifneq (,$(findstring win,$(RDI_PLATFORM)))
SHELL = CMD
endif

all:
$(MAKE) --no-print-directory seq_libs
$(MAKE) -j --no-print-directory par_libs
$(MAKE) --no-print-directory archive
@echo 'Finished building libraries'

include: $(addsuffix /make.include,$(SUBDIRS))

seq_libs: $(addsuffix /make.libs,$(SEQ_SUBDIRS))
@echo 'Finished building libraries sequentially.'

par_libs: $(addsuffix /make.libs,$(PAR_SUBDIRS))
@echo 'Finished building libraries parallelly.'

archive:
mb-ar -r $(LIBRARIES) $(wildcard $(PROCESSOR)/lib/*.o)

clean: $(addsuffix /make.clean,$(SUBDIRS))
rm -f ${PROCESSOR}/lib/libxil.a

$(PROCESSOR)/lib/libxil.a: $(PROCESSOR)/lib/libxil_init.a
cp -f $< $@

%/make.include: $(if $(wildcard $(PROCESSOR)/lib/libxil_init.a),$(PROCESSOR)/lib/libxil.a,)
@echo "Running Make include in $(subst /make.include,,$@)"
$(MAKE) -C $(subst /make.include,,$@) -s include "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra"

%/make.libs: include
@echo "Running Make libs in $(subst /make.libs,,$@)"
$(MAKE) -C $(subst /make.libs,,$@) -s libs "SHELL=$(SHELL)" "COMPILER=mb-gcc" "ASSEMBLER=mb-as" "ARCHIVER=mb-ar" "COMPILER_FLAGS= -O2 -c -mcpu=v -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare" "EXTRA_COMPILER_FLAGS=-g -ffunction-sections -fdata-sections -Wall -Wextra"

%/make.clean:
$(MAKE) -C $(subst /make.clean,,$@) -s clean
16 changes: 16 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Building Versal PSMFW from git:
===============================

PSMFW(versal_psmfw) has 3 directories.
1. data - It contains files for Vitis
2. src - It contains the PSMFW source files
3. misc - It contains miscellaneous files required to
compile PSMFW.

How to compile Versal PSMFW:
===============================
1. Go to the PSMFW src directory "lib/sw_apps/versal_psmfw/src/"
2. If executables and other artifacts from previous PSMFW build are present,
run "make clean" to delete them.
3. Give "make" to compile the PSMFW with BSP.
4. This will create "psmfw.elf" in the PSMFW src directory.
20 changes: 20 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/bspconfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

/*******************************************************************
*
* CAUTION: This file is automatically generated by HSI.
* Version:
* DO NOT EDIT.
*
* Copyright (C) 2010-2020 Xilinx, Inc. All Rights Reserved.
* SPDX-License-Identifier: MIT
*
* Description: Configurations for Standalone BSP
*
*******************************************************************/

#ifndef BSPCONFIG_H /* prevent circular inclusions */
#define BSPCONFIG_H /* by using protection macros */

#define MICROBLAZE_PVR_NONE

#endif /*end of __BSPCONFIG_H_*/
3 changes: 3 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/config.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LIBSOURCES = *.c *.S
PROFILE_ARCH_OBJS = profile_mcount_mb.o
LIBS = standalone_libs
88 changes: 88 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/copy_bsp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

# this script will copy the required bsp directories

# present working dir
WORKING_DIR=../misc

#bsp dir where files will be copied
BSP_DIR=$WORKING_DIR/versal_psmfw_bsp/psv_psm_0

#processor dir
PROC_DIRNAME=cpu

# Embedded Sw dir relative path from versal_plm src
EMBEDDED_SW_DIR=$WORKING_DIR/../../../..

# selection of drivers is based on the board selected
DRIVERS_LIST="$WORKING_DIR/drivers.txt"

# drivers directory
DRIVERS_DIR=$EMBEDDED_SW_DIR/XilinxProcessorIPLib/drivers

# standalone dir, source of standalone files
STANDALONE_DIR=$EMBEDDED_SW_DIR/lib/bsp/standalone/src

# libraries dir
SERVICES_DIR=$EMBEDDED_SW_DIR/lib/sw_services

# creation of BSP folders required
if [ -d $BSP_DIR ]; then
echo "BSP directory already exists"
else
mkdir -p $BSP_DIR/code
mkdir -p $BSP_DIR/include
mkdir -p $BSP_DIR/lib
mkdir -p $BSP_DIR/libsrc
fi

# create bsp standalone/src folder
if [ -d $BSP_DIR/libsrc/standalone/src ]; then
echo "Standalone directory already exists"
else
mkdir -p $BSP_DIR/libsrc/standalone/src
fi

# copy bsp standalone code
cp $STANDALONE_DIR/common/* $BSP_DIR/libsrc/standalone/src/
cp $STANDALONE_DIR/microblaze/* $BSP_DIR/libsrc/standalone/src/
cp -r $STANDALONE_DIR/profile $BSP_DIR/libsrc/standalone/src/
cp $WORKING_DIR/bspconfig.h $BSP_DIR/libsrc/standalone/src/
cp $WORKING_DIR/microblaze_interrupts_g.c $BSP_DIR/libsrc/standalone/src/
cp $WORKING_DIR/bspconfig.h $BSP_DIR/include/
cp $WORKING_DIR/Makefile $BSP_DIR/../

# copy the bsp drivers
while read line
do
# copy driver code to bsp
if [ -d $BSP_DIR/libsrc/$line/src ]; then
echo "$line directory already exists"
else
mkdir -p $BSP_DIR/libsrc/$line
fi
cp -r $DRIVERS_DIR/$line/src $BSP_DIR/libsrc/$line
#copy the driver include files
cp -r $DRIVERS_DIR/$line/src/*.h $BSP_DIR/include/
# copy all the HSM generated driver files DRIVER_g.c
cp $WORKING_DIR/x"$line"_g.c $BSP_DIR/libsrc/$line/src/
done < $DRIVERS_LIST

#copy the processor code.
if [ -d $BSP_DIR/libsrc/$PROC_DIRNAME/src ]; then
echo "$PROC_DIRNAME directory already exists"
else
mkdir -p $BSP_DIR/libsrc/$PROC_DIRNAME
fi
cp -r $DRIVERS_DIR/$PROC_DIRNAME/src $BSP_DIR/libsrc/$PROC_DIRNAME/src

#copy the xparameters.h
cp $WORKING_DIR/xparameters*.h $BSP_DIR/include/

# other dependencies which are required
cp $WORKING_DIR/config.make $BSP_DIR/libsrc/standalone/src/
cp $STANDALONE_DIR/common/*.h $BSP_DIR/include/
cp $STANDALONE_DIR/microblaze/*.h $BSP_DIR/include/

# no inbyte and outbyte present in standalone
cp $WORKING_DIR/inbyte.c $WORKING_DIR/outbyte.c $BSP_DIR/libsrc/standalone/src/
3 changes: 3 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/drivers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
iomodule
ipipsu
uartpsv
14 changes: 14 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/inbyte.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "xparameters.h"
#include "xuartpsv_hw.h"

#ifdef __cplusplus
extern "C" {
#endif
char inbyte(void);
#ifdef __cplusplus
}
#endif

char inbyte(void) {
return XUartPsv_RecvByte(STDIN_BASEADDRESS);
}
29 changes: 29 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/microblaze_interrupts_g.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/*******************************************************************
*
* CAUTION: This file is automatically generated by HSI.
* Version:
* DO NOT EDIT.
*
* Copyright (C) 2010-2020 Xilinx, Inc. All Rights Reserved.
* SPDX-License-Identifier: MIT
*
* Description: Interrupt Handler Table for MicroBlaze Processor
*
*******************************************************************/

#include "microblaze_interrupts_i.h"
#include "xparameters.h"


extern void XNullHandler (void *);

/*
* The interrupt handler table for microblaze processor
*/

MB_InterruptVectorTableEntry MB_InterruptVectorTable[] =
{
{ XNullHandler,
(void*) XNULL}
};
15 changes: 15 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/outbyte.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "xparameters.h"
#include "xuartpsv_hw.h"

#ifdef __cplusplus
extern "C" {
#endif
void outbyte(char c);

#ifdef __cplusplus
}
#endif

void outbyte(char c) {
XUartPsv_SendByte(STDOUT_BASEADDRESS, c);
}
77 changes: 77 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/xiomodule_g.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

/*******************************************************************
*
* CAUTION: This file is automatically generated by HSI.
* Version:
* DO NOT EDIT.
*
* Copyright (C) 2010-2020 Xilinx, Inc. All Rights Reserved.
* SPDX-License-Identifier: MIT
*
* Description: Driver configuration
*
*******************************************************************/

#include "xparameters.h"
#include "xiomodule.h"



/*
* The configuration table for devices
*/

XIOModule_Config XIOModule_ConfigTable[] =
{
{
XPAR_PSV_PSM_IOMODULE_0_DEVICE_ID,
XPAR_PSV_PSM_IOMODULE_0_BASEADDR,
XPAR_PSV_PSM_IOMODULE_0_IO_BASEADDR,
XPAR_PSV_PSM_IOMODULE_0_INTC_HAS_FAST,
XPAR_PSV_PSM_IOMODULE_0_INTC_BASE_VECTORS,
XPAR_PSV_PSM_IOMODULE_0_INTC_ADDR_WIDTH ,
((XPAR_PSV_PSM_IOMODULE_0_INTC_LEVEL_EDGE << 16) | 0x7FF),
XIN_SVC_SGL_ISR_OPTION,
XPAR_PSV_PSM_IOMODULE_0_FREQ,
XPAR_PSV_PSM_IOMODULE_0_UART_BAUDRATE,
{
XPAR_PSV_PSM_IOMODULE_0_USE_PIT1,
XPAR_PSV_PSM_IOMODULE_0_USE_PIT2,
XPAR_PSV_PSM_IOMODULE_0_USE_PIT3,
XPAR_PSV_PSM_IOMODULE_0_USE_PIT4,
},
{
XPAR_PSV_PSM_IOMODULE_0_PIT1_SIZE,
XPAR_PSV_PSM_IOMODULE_0_PIT2_SIZE,
XPAR_PSV_PSM_IOMODULE_0_PIT3_SIZE,
XPAR_PSV_PSM_IOMODULE_0_PIT4_SIZE,
},
{
XPAR_PSV_PSM_IOMODULE_0_PIT1_EXPIRED_MASK,
XPAR_PSV_PSM_IOMODULE_0_PIT2_EXPIRED_MASK,
XPAR_PSV_PSM_IOMODULE_0_PIT3_EXPIRED_MASK,
XPAR_PSV_PSM_IOMODULE_0_PIT4_EXPIRED_MASK,
},
{
XPAR_PSV_PSM_IOMODULE_0_PIT1_PRESCALER,
XPAR_PSV_PSM_IOMODULE_0_PIT2_PRESCALER,
XPAR_PSV_PSM_IOMODULE_0_PIT3_PRESCALER,
XPAR_PSV_PSM_IOMODULE_0_PIT4_PRESCALER,
},
{
XPAR_PSV_PSM_IOMODULE_0_PIT1_READABLE,
XPAR_PSV_PSM_IOMODULE_0_PIT2_READABLE,
XPAR_PSV_PSM_IOMODULE_0_PIT3_READABLE,
XPAR_PSV_PSM_IOMODULE_0_PIT4_READABLE,
},
{
XPAR_PSV_PSM_IOMODULE_0_GPO1_INIT,
XPAR_PSV_PSM_IOMODULE_0_GPO2_INIT,
XPAR_PSV_PSM_IOMODULE_0_GPO3_INIT,
XPAR_PSV_PSM_IOMODULE_0_GPO4_INIT,
},
{
}

}
};
76 changes: 76 additions & 0 deletions lib/sw_apps/versal_psmfw/misc/xipipsu_g.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

/*******************************************************************
*
* CAUTION: This file is automatically generated by HSI.
* Version:
* DO NOT EDIT.
*
* Copyright (C) 2010-2020 Xilinx, Inc. All Rights Reserved.
* SPDX-License-Identifier: MIT
*
* Description: Driver configuration
*
*******************************************************************/

#include "xparameters.h"
#include "xipipsu.h"

/*
* The configuration table for devices
*/

XIpiPsu_Config XIpiPsu_ConfigTable[XPAR_XIPIPSU_NUM_INSTANCES] =
{

{
XPAR_PSV_IPI_PSM_DEVICE_ID,
XPAR_PSV_IPI_PSM_S_AXI_BASEADDR,
XPAR_PSV_IPI_PSM_BIT_MASK,
XPAR_PSV_IPI_PSM_BUFFER_INDEX,
XPAR_PSV_IPI_PSM_INT_ID,
XPAR_XIPIPSU_NUM_TARGETS,
{

{
XPAR_PSV_IPI_0_BIT_MASK,
XPAR_PSV_IPI_0_BUFFER_INDEX
},
{
XPAR_PSV_IPI_1_BIT_MASK,
XPAR_PSV_IPI_1_BUFFER_INDEX
},
{
XPAR_PSV_IPI_2_BIT_MASK,
XPAR_PSV_IPI_2_BUFFER_INDEX
},
{
XPAR_PSV_IPI_3_BIT_MASK,
XPAR_PSV_IPI_3_BUFFER_INDEX
},
{
XPAR_PSV_IPI_4_BIT_MASK,
XPAR_PSV_IPI_4_BUFFER_INDEX
},
{
XPAR_PSV_IPI_5_BIT_MASK,
XPAR_PSV_IPI_5_BUFFER_INDEX
},
{
XPAR_PSV_IPI_6_BIT_MASK,
XPAR_PSV_IPI_6_BUFFER_INDEX
},
{
XPAR_PSV_IPI_PMC_BIT_MASK,
XPAR_PSV_IPI_PMC_BUFFER_INDEX
},
{
XPAR_PSV_IPI_PMC_NOBUF_BIT_MASK,
XPAR_PSV_IPI_PMC_NOBUF_BUFFER_INDEX
},
{
XPAR_PSV_IPI_PSM_BIT_MASK,
XPAR_PSV_IPI_PSM_BUFFER_INDEX
}
}
}
};
Loading

0 comments on commit 809d7ad

Please sign in to comment.