mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
added psmake as a subproject
This commit is contained in:
commit
e98b605a3f
5
fpga/lib/psmake/.gitignore
vendored
Normal file
5
fpga/lib/psmake/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# generic intermediate and editor backup files
|
||||
*.swp
|
||||
*.~
|
||||
.#*
|
||||
*~
|
177
fpga/lib/psmake/LICENSE.txt
Normal file
177
fpga/lib/psmake/LICENSE.txt
Normal file
@ -0,0 +1,177 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
1064
fpga/lib/psmake/README.md
Normal file
1064
fpga/lib/psmake/README.md
Normal file
File diff suppressed because it is too large
Load Diff
195
fpga/lib/psmake/common.mk
Normal file
195
fpga/lib/psmake/common.mk
Normal file
@ -0,0 +1,195 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2018-2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : common.mk
|
||||
## Initial Author : Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : XSDK/Vitis common functionality
|
||||
##
|
||||
## Uses: bootgen cat git mkdir patch rm sed touch
|
||||
##
|
||||
################################################################################
|
||||
|
||||
|
||||
################################################################################
|
||||
# VCS
|
||||
|
||||
# user arguments
|
||||
VCS_SKIP ?=
|
||||
|
||||
# get version control information
|
||||
ifeq ($(VCS_SKIP),)
|
||||
VCS_HEAD := $(shell git rev-parse --verify --short HEAD 2>/dev/null)
|
||||
endif
|
||||
ifneq ($(VCS_HEAD),)
|
||||
VCS_DIRTY := $(shell git diff-index --name-only HEAD | head -n 1)
|
||||
VCS_VER := _g$(VCS_HEAD)$(patsubst %,-dirty,$(VCS_DIRTY))
|
||||
else
|
||||
VCS_VER :=
|
||||
endif
|
||||
|
||||
# get build time stamp
|
||||
BSTAMP := $(shell date +%Y%m%d-%H%M%S)
|
||||
|
||||
# user arguments, usually provided on command line
|
||||
# container for build directories (= xsdk workspaces)
|
||||
CNTR ?= build
|
||||
# build directory name
|
||||
BLDN ?= $(CFG)_$(BSTAMP)$(VCS_VER)
|
||||
# relative path to build directory
|
||||
O ?= $(CNTR)/$(BLDN)
|
||||
|
||||
###############################################################################
|
||||
# Repositories
|
||||
|
||||
REPOS ?=
|
||||
|
||||
ifneq ($(strip $(REPOS)),)
|
||||
__REPOS_CCMD = $(foreach REPO,$(REPOS), \
|
||||
repo -set {$(REPO)};)
|
||||
endif
|
||||
|
||||
$(O)/.metadata/repos.stamp:
|
||||
ifneq ($(strip $(REPOS)),)
|
||||
$(XSCT) -eval 'setws {$(O)}; $(__REPOS_CCMD)'
|
||||
else
|
||||
mkdir -p $(O)/.metadata/
|
||||
endif
|
||||
touch $@
|
||||
|
||||
###############################################################################
|
||||
# Source symlinking, patch and sed rules
|
||||
|
||||
# arg1: app name
|
||||
# arg2: src file name, scheme <srcfile>
|
||||
define symlink-src
|
||||
rm -f $(O)/$(1)/src/$$(notdir $(2)) && \
|
||||
ln -s ../../../../$(2) $(O)/$(1)/src/$$(notdir $(2)) &&
|
||||
endef
|
||||
|
||||
# arg1: app name
|
||||
# arg2: patch file name, scheme <patchfile>[;<stripnum>]
|
||||
define patch-src
|
||||
patch -d $(O)/$(1)/ -p$$(subst ,1,$$(word 2,$$(subst ;, ,$(2)))) \
|
||||
<$$(word 1,$$(subst ;, ,$(2))) &&
|
||||
endef
|
||||
|
||||
# arg1: app name
|
||||
# arg2: src file name to edit and sed command file, scheme <srcfile>;<sedfile>
|
||||
define sed-src
|
||||
sed -i -f $$(lastword $$(subst ;, ,$(2))) \
|
||||
$(O)/$(1)/$$(firstword $$(subst ;, ,$(2))) &&
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Bootgen projects
|
||||
|
||||
BOOTGEN ?= bootgen
|
||||
|
||||
BOOTGEN_PRJS ?=
|
||||
|
||||
# arg1: BIF file name
|
||||
# arg2: BIF attribute
|
||||
define gen-bif-attr
|
||||
\t[$$($(1)_$(2)_BIF_ATTR)] $$($(1)_$(2)_BIF_FILE)\n
|
||||
endef
|
||||
|
||||
# arg1: Bootgen project
|
||||
# arg2: BIF attribute
|
||||
define gen-bootgen-dep
|
||||
$$(if $$(findstring yes,$$($(1)_$(2)_BIF_FILE_NO_DEP)),,\
|
||||
$(O)/$$($(1)_$(2)_BIF_FILE))
|
||||
endef
|
||||
|
||||
define gen-bif-rule
|
||||
$(1)_FLASH_TYPE ?=
|
||||
$(1)_FLASH_FSBL ?=
|
||||
$(1)_FLASH_OFF ?= 0
|
||||
$(1)_BOOTGEN_DEP = $$(foreach BIF_ATTR,$$($(1)_BIF_ATTRS),\
|
||||
$(call gen-bootgen-dep,$(1),$$(BIF_ATTR)))
|
||||
|
||||
$(O)/$(1)/$(1).bif: $$($(1)_BOOTGEN_DEP)
|
||||
mkdir -p $(O)/$(1)
|
||||
printf '$(1):\n{\n' > $(O)/$(1)/$(1).bif
|
||||
ifneq ($$(strip $$($(1)_BIF_ATTRS)),)
|
||||
printf '$$(foreach BIF_ATTR,$$($(1)_BIF_ATTRS), \
|
||||
$(call gen-bif-attr,$(1),$$(BIF_ATTR)))' \
|
||||
>> $(O)/$(1)/$(1).bif
|
||||
endif
|
||||
printf '}\n' >> $(O)/$(1)/$(1).bif
|
||||
|
||||
$(O)/$(1)/BOOT.BIN: $(O)/$(1)/$(1).bif
|
||||
ifeq ($$($(1)_BIF_NO_OUTPUT),yes)
|
||||
cd $(O) && $(BOOTGEN) -arch $$($(1)_BIF_ARCH) -image $(1)/$(1).bif \
|
||||
$$($(1)_BIF_ARGS_EXTRA)
|
||||
else
|
||||
cd $(O) && $(BOOTGEN) -arch $$($(1)_BIF_ARCH) -image $(1)/$(1).bif \
|
||||
-o $(1)/BOOT.BIN -w $$($(1)_BIF_ARGS_EXTRA)
|
||||
endif
|
||||
|
||||
GEN_BOOTGEN_DEP += $(O)/$(1)/$(1).bif
|
||||
BLD_BOOTGEN_DEP += $(O)/$(1)/BOOT.BIN
|
||||
|
||||
# NOTE: Target $(1)_flash is written for QSPI flashing in mind - other types
|
||||
# might need more or other arguments!
|
||||
$(1)_flash: $(O)/$(1)/BOOT.BIN
|
||||
cd $(O) && \
|
||||
program_flash \
|
||||
-flash_type $$($(1)_FLASH_TYPE) \
|
||||
-fsbl $$($(1)_FLASH_FSBL) \
|
||||
-f $(1)/BOOT.BIN -offset $$($(1)_FLASH_OFF) \
|
||||
-verify \
|
||||
-cable type xilinx_tcf url $(HW_SERVER_URL)
|
||||
.PHONY: $(1)_flash
|
||||
|
||||
# shortcut to build bootgen project, "make <bootgen>"
|
||||
$(1): $(O)/$(1)/BOOT.BIN
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_clean:
|
||||
find $(O)/$(1)/* -not -name $(1).bif -delete
|
||||
.PHONY: $(1)_clean
|
||||
|
||||
$(1)_distclean:
|
||||
rm -fr $(O)/$(1)
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Common targets
|
||||
|
||||
# show logs
|
||||
metalog:
|
||||
cat $(O)/.metadata/.log
|
||||
sdklog:
|
||||
cat $(O)/SDK.log
|
||||
.PHONY: sdklog metalog
|
||||
|
||||
# remove workspace
|
||||
distclean:
|
||||
rm -fr $(O)
|
||||
.PHONY: distclean
|
||||
|
||||
# open XSCT in interactive mode
|
||||
xsct:
|
||||
$(XSCT) -interactive -eval 'setws $(O)'
|
||||
.PHONY: xsct
|
1
fpga/lib/psmake/examples/vitis/baud_rate.sed
Normal file
1
fpga/lib/psmake/examples/vitis/baud_rate.sed
Normal file
@ -0,0 +1 @@
|
||||
s/UART_BAUD 9600/UART_BAUD 115200/
|
98
fpga/lib/psmake/examples/vitis/default.mk
Normal file
98
fpga/lib/psmake/examples/vitis/default.mk
Normal file
@ -0,0 +1,98 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2019-2020 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : default.mk
|
||||
## Initial Author : Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : Example for Vitis Makefile
|
||||
##
|
||||
## Build with default fixed platform for ZC102:
|
||||
##
|
||||
## $ make HW_PLAT=zcu102
|
||||
##
|
||||
## Also provide PLATS variable if default does not fit.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
# FSBL
|
||||
|
||||
DOMAIN_PRJS += fsbl_bsp
|
||||
fsbl_bsp_PROC = psu_cortexa53_0
|
||||
fsbl_bsp_IS_FSBL = yes
|
||||
fsbl_bsp_LIBS = xilffs xilsecure xilpm
|
||||
fsbl_bsp_POST_CREATE_TCL = bsp config use_strfunc 1
|
||||
|
||||
APP_PRJS += fsbl
|
||||
fsbl_TMPL = Zynq MP FSBL
|
||||
fsbl_DOMAIN = fsbl_bsp
|
||||
fsbl_CPPSYMS = FSBL_DEBUG_DETAILED
|
||||
|
||||
################################################################################
|
||||
# Hello World
|
||||
|
||||
DOMAIN_PRJS += gen_bsp
|
||||
gen_bsp_PROC = psu_cortexa53_0
|
||||
gen_bsp_EXTRA_CFLAGS = -g -Wall -Wextra -Os
|
||||
gen_bsp_STDOUT = psu_uart_1
|
||||
|
||||
APP_PRJS += helloworld
|
||||
helloworld_TMPL = Hello World
|
||||
helloworld_DOMAIN = gen_bsp
|
||||
helloworld_BCFG = Debug
|
||||
helloworld_PATCH = helloworld.patch
|
||||
helloworld_SED = platform.c;baud_rate.sed
|
||||
|
||||
APP_PRJS += example_app
|
||||
example_app_TMPL = Empty Application
|
||||
example_app_DOMAIN = gen_bsp
|
||||
example_app_BCFG = Debug
|
||||
example_app_SRC = example_app
|
||||
|
||||
################################################################################
|
||||
# Boot image
|
||||
|
||||
BOOTGEN_PRJS += bootbin
|
||||
|
||||
bootbin_BIF_ARCH = zynqmp
|
||||
bootbin_BIF_ATTRS = fsbl helloworld
|
||||
bootbin_fsbl_BIF_ATTR = bootloader, destination_cpu=a53-0
|
||||
bootbin_fsbl_BIF_FILE = fsbl/$(fsbl_BCFG)/fsbl.elf
|
||||
bootbin_helloworld_BIF_ATTR = destination_cpu=a53-0
|
||||
bootbin_helloworld_BIF_FILE = helloworld/$(helloworld_BCFG)/helloworld.elf
|
||||
|
||||
################################################################################
|
||||
# Key generation
|
||||
|
||||
BOOTGEN_PRJS += generate_pem
|
||||
|
||||
generate_pem_BIF_ARCH = zynqmp
|
||||
generate_pem_BIF_NO_OUTPUT = yes
|
||||
generate_pem_BIF_ARGS_EXTRA = -p zu9eg -generate_keys pem
|
||||
generate_pem_BIF_ATTRS = pskfile sskfile fsbl
|
||||
generate_pem_pskfile_BIF_ATTR = pskfile
|
||||
generate_pem_pskfile_BIF_FILE = generate_pem/psk0.pem
|
||||
generate_pem_pskfile_BIF_FILE_NO_DEP = yes
|
||||
generate_pem_sskfile_BIF_ATTR = sskfile
|
||||
generate_pem_sskfile_BIF_FILE = generate_pem/ssk0.pem
|
||||
generate_pem_sskfile_BIF_FILE_NO_DEP = yes
|
||||
generate_pem_fsbl_BIF_ATTR = bootloader, destination_cpu=a53-0
|
||||
generate_pem_fsbl_BIF_FILE = fsbl/$(fsbl_BCFG)/fsbl.elf
|
61
fpga/lib/psmake/examples/vitis/example_app/helloworld.c
Normal file
61
fpga/lib/psmake/examples/vitis/example_app/helloworld.c
Normal file
@ -0,0 +1,61 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009 - 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
|
||||
* XILINX 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* helloworld.c: simple test application
|
||||
*
|
||||
* This application configures UART 16550 to baud rate 9600.
|
||||
* PS7 UART (Zynq) is not initialized by this application, since
|
||||
* bootrom/bsp configures it to baud rate 115200
|
||||
*
|
||||
* ------------------------------------------------
|
||||
* | UART TYPE BAUD RATE |
|
||||
* ------------------------------------------------
|
||||
* uartns550 9600
|
||||
* uartlite Configurable only in HW design
|
||||
* ps7_uart 115200 (configured by bootrom/bsp)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "platform.h"
|
||||
#include "xil_printf.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
init_platform();
|
||||
|
||||
print("Hello World Example Application\n\r");
|
||||
print("Successfully ran Hello World application");
|
||||
cleanup_platform();
|
||||
return 0;
|
||||
}
|
111
fpga/lib/psmake/examples/vitis/example_app/platform.c
Normal file
111
fpga/lib/psmake/examples/vitis/example_app/platform.c
Normal file
@ -0,0 +1,111 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 - 2015 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
|
||||
* XILINX 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "xparameters.h"
|
||||
#include "xil_cache.h"
|
||||
|
||||
#include "platform_config.h"
|
||||
|
||||
/*
|
||||
* Uncomment one of the following two lines, depending on the target,
|
||||
* if ps7/psu init source files are added in the source directory for
|
||||
* compiling example outside of SDK.
|
||||
*/
|
||||
/*#include "ps7_init.h"*/
|
||||
/*#include "psu_init.h"*/
|
||||
|
||||
#ifdef STDOUT_IS_16550
|
||||
#include "xuartns550_l.h"
|
||||
|
||||
#define UART_BAUD 115200
|
||||
#endif
|
||||
|
||||
void
|
||||
enable_caches()
|
||||
{
|
||||
#ifdef __PPC__
|
||||
Xil_ICacheEnableRegion(CACHEABLE_REGION_MASK);
|
||||
Xil_DCacheEnableRegion(CACHEABLE_REGION_MASK);
|
||||
#elif __MICROBLAZE__
|
||||
#ifdef XPAR_MICROBLAZE_USE_ICACHE
|
||||
Xil_ICacheEnable();
|
||||
#endif
|
||||
#ifdef XPAR_MICROBLAZE_USE_DCACHE
|
||||
Xil_DCacheEnable();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
disable_caches()
|
||||
{
|
||||
#ifdef __MICROBLAZE__
|
||||
#ifdef XPAR_MICROBLAZE_USE_DCACHE
|
||||
Xil_DCacheDisable();
|
||||
#endif
|
||||
#ifdef XPAR_MICROBLAZE_USE_ICACHE
|
||||
Xil_ICacheDisable();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
init_uart()
|
||||
{
|
||||
#ifdef STDOUT_IS_16550
|
||||
XUartNs550_SetBaud(STDOUT_BASEADDR, XPAR_XUARTNS550_CLOCK_HZ, UART_BAUD);
|
||||
XUartNs550_SetLineControlReg(STDOUT_BASEADDR, XUN_LCR_8_DATA_BITS);
|
||||
#endif
|
||||
/* Bootrom/BSP configures PS7/PSU UART to 115200 bps */
|
||||
}
|
||||
|
||||
void
|
||||
init_platform()
|
||||
{
|
||||
/*
|
||||
* If you want to run this example outside of SDK,
|
||||
* uncomment one of the following two lines and also #include "ps7_init.h"
|
||||
* or #include "ps7_init.h" at the top, depending on the target.
|
||||
* Make sure that the ps7/psu_init.c and ps7/psu_init.h files are included
|
||||
* along with this example source files for compilation.
|
||||
*/
|
||||
/* ps7_init();*/
|
||||
/* psu_init();*/
|
||||
enable_caches();
|
||||
init_uart();
|
||||
}
|
||||
|
||||
void
|
||||
cleanup_platform()
|
||||
{
|
||||
disable_caches();
|
||||
}
|
41
fpga/lib/psmake/examples/vitis/example_app/platform.h
Normal file
41
fpga/lib/psmake/examples/vitis/example_app/platform.h
Normal file
@ -0,0 +1,41 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2008 - 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
|
||||
* XILINX 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __PLATFORM_H_
|
||||
#define __PLATFORM_H_
|
||||
|
||||
#include "platform_config.h"
|
||||
|
||||
void init_platform();
|
||||
void cleanup_platform();
|
||||
|
||||
#endif
|
@ -0,0 +1,6 @@
|
||||
#ifndef __PLATFORM_CONFIG_H_
|
||||
#define __PLATFORM_CONFIG_H_
|
||||
|
||||
#define STDOUT_IS_PSU_UART
|
||||
#define UART_DEVICE_ID 1
|
||||
#endif
|
11
fpga/lib/psmake/examples/vitis/helloworld.patch
Normal file
11
fpga/lib/psmake/examples/vitis/helloworld.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/helloworld.c 2020-09-01 11:44:33.249528296 +0200
|
||||
+++ b/helloworld.c~ 2020-09-01 12:02:34.945994392 +0200
|
||||
@@ -54,7 +54,7 @@
|
||||
{
|
||||
init_platform();
|
||||
|
||||
- print("Hello World\n\r");
|
||||
+ print("Hello World Vitis Makefile\n\r");
|
||||
print("Successfully ran Hello World application");
|
||||
cleanup_platform();
|
||||
return 0;
|
1
fpga/lib/psmake/examples/xsdk/baud_rate.sed
Normal file
1
fpga/lib/psmake/examples/xsdk/baud_rate.sed
Normal file
@ -0,0 +1 @@
|
||||
s/UART_BAUD 9600/UART_BAUD 115200/
|
99
fpga/lib/psmake/examples/xsdk/default.mk
Normal file
99
fpga/lib/psmake/examples/xsdk/default.mk
Normal file
@ -0,0 +1,99 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : default.mk
|
||||
## Initial Author : Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : Example for XSDK Makefile
|
||||
##
|
||||
################################################################################
|
||||
|
||||
# Defaults
|
||||
|
||||
BIT ?= hw/design_1_wrapper.bit
|
||||
|
||||
################################################################################
|
||||
# FSBL
|
||||
|
||||
BSP_PRJS += fsbl_bsp
|
||||
fsbl_bsp_PROC = psu_cortexa53_0
|
||||
fsbl_bsp_IS_FSBL = yes
|
||||
fsbl_bsp_LIBS = xilffs xilsecure xilpm
|
||||
fsbl_bsp_POST_CREATE_TCL = configbsp -bsp fsbl_bsp use_strfunc 1
|
||||
|
||||
APP_PRJS += fsbl
|
||||
fsbl_TMPL = Zynq MP FSBL
|
||||
fsbl_BSP = fsbl_bsp
|
||||
fsbl_CPPSYMS = FSBL_DEBUG_DETAILED
|
||||
|
||||
################################################################################
|
||||
# Hello World
|
||||
|
||||
BSP_PRJS += gen_bsp
|
||||
gen_bsp_PROC = psu_cortexa53_0
|
||||
gen_bsp_EXTRA_CFLAGS = -g -Wall -Wextra -Os
|
||||
gen_bsp_STDOUT = psu_uart_1
|
||||
|
||||
APP_PRJS += helloworld
|
||||
helloworld_TMPL = Hello World
|
||||
helloworld_BSP = gen_bsp
|
||||
helloworld_BCFG = Debug
|
||||
helloworld_PATCH = helloworld.patch
|
||||
helloworld_SED = platform.c;baud_rate.sed
|
||||
helloworld_LIBS = helloworldlib
|
||||
|
||||
LIB_PRJS += helloworldlib
|
||||
helloworldlib_PROC = psu_cortexa53
|
||||
helloworldlib_BCFG = Debug
|
||||
helloworldlib_SRC = helloworldlib.c helloworldlib.h
|
||||
|
||||
################################################################################
|
||||
# Boot image
|
||||
|
||||
BOOTGEN_PRJS += bootbin
|
||||
|
||||
bootbin_BIF_ARCH = zynqmp
|
||||
bootbin_BIF_ATTRS = fsbl bit helloworld
|
||||
bootbin_fsbl_BIF_ATTR = bootloader, destination_cpu=a53-0
|
||||
bootbin_fsbl_BIF_FILE = fsbl/$(fsbl_BCFG)/fsbl.elf
|
||||
bootbin_bit_BIF_ATTR = destination_device=pl
|
||||
bootbin_bit_BIF_FILE = $(BIT)
|
||||
bootbin_helloworld_BIF_ATTR = destination_cpu=a53-0
|
||||
bootbin_helloworld_BIF_FILE = helloworld/$(helloworld_BCFG)/helloworld.elf
|
||||
|
||||
################################################################################
|
||||
# Key generation
|
||||
|
||||
BOOTGEN_PRJS += generate_pem
|
||||
|
||||
generate_pem_BIF_ARCH = zynqmp
|
||||
generate_pem_BIF_NO_OUTPUT = yes
|
||||
generate_pem_BIF_ARGS_EXTRA = -p zu9eg -generate_keys pem
|
||||
generate_pem_BIF_ATTRS = pskfile sskfile fsbl
|
||||
generate_pem_pskfile_BIF_ATTR = pskfile
|
||||
generate_pem_pskfile_BIF_FILE = generate_pem/psk0.pem
|
||||
generate_pem_pskfile_BIF_FILE_NO_DEP = yes
|
||||
generate_pem_sskfile_BIF_ATTR = sskfile
|
||||
generate_pem_sskfile_BIF_FILE = generate_pem/ssk0.pem
|
||||
generate_pem_sskfile_BIF_FILE_NO_DEP = yes
|
||||
generate_pem_fsbl_BIF_ATTR = bootloader, destination_cpu=a53-0
|
||||
generate_pem_fsbl_BIF_FILE = fsbl/$(fsbl_BCFG)/fsbl.elf
|
18
fpga/lib/psmake/examples/xsdk/helloworld.patch
Normal file
18
fpga/lib/psmake/examples/xsdk/helloworld.patch
Normal file
@ -0,0 +1,18 @@
|
||||
--- a/helloworld.c 2020-05-13 11:53:50.934001488 +0200
|
||||
+++ b/helloworld.c~ 2020-05-13 14:19:33.378515155 +0200
|
||||
@@ -48,13 +48,14 @@
|
||||
#include <stdio.h>
|
||||
#include "platform.h"
|
||||
#include "xil_printf.h"
|
||||
+#include "helloworldlib.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
init_platform();
|
||||
|
||||
- print("Hello World\n\r");
|
||||
+ helloworld();
|
||||
|
||||
cleanup_platform();
|
||||
return 0;
|
6
fpga/lib/psmake/examples/xsdk/helloworldlib.c
Normal file
6
fpga/lib/psmake/examples/xsdk/helloworldlib.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void helloworld(void)
|
||||
{
|
||||
printf("Hello World\n\r");
|
||||
}
|
1
fpga/lib/psmake/examples/xsdk/helloworldlib.h
Normal file
1
fpga/lib/psmake/examples/xsdk/helloworldlib.h
Normal file
@ -0,0 +1 @@
|
||||
void helloworld(void);
|
344
fpga/lib/psmake/petalinux.mk
Normal file
344
fpga/lib/psmake/petalinux.mk
Normal file
@ -0,0 +1,344 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2018-2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : Makefile
|
||||
## Initial Author : Joachim Foerster
|
||||
## <joachim.foerster@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : petalinux-* convenience wrapper
|
||||
##
|
||||
## Based on Makefile for PetaLinux by Stefan Wiehler.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
ifeq ($(PETALINUX_VER),)
|
||||
$(error PETALINUX_VER is unset. This Makefile must be invoked from within a PetaLinux environment)
|
||||
endif
|
||||
|
||||
MAKEFILE_PATH = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
# default target
|
||||
all: build
|
||||
|
||||
# include Makefile snippet local to project, if one exists
|
||||
-include local.mk
|
||||
|
||||
# tools
|
||||
ifeq ($(shell expr $(subst .,,$(PETALINUX_VER)) ">" 20191),1)
|
||||
XSDB ?= $(PETALINUX)/tools/xsct/bin/xsdb
|
||||
else
|
||||
ifeq ($(shell expr $(subst .,,$(PETALINUX_VER)) "<" 20183),1)
|
||||
XSDB ?= $(PETALINUX)/tools/hsm/bin/xsdb
|
||||
else
|
||||
# for v2018.3 and v2019.1, xsdb is automatically found via $PATH
|
||||
XSDB ?= xsdb
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(shell expr $(subst .,,$(PETALINUX_VER)) ">" 20183),1)
|
||||
SILENTCONFIG = --silentconfig
|
||||
else
|
||||
SILENTCONFIG = --oldconfig
|
||||
endif
|
||||
|
||||
PLATFORM = $(shell cat project-spec/configs/config | \
|
||||
grep -E '^CONFIG_SYSTEM_(MICROBLAZE|ZYNQ|ZYNQMP)=y$$' | \
|
||||
sed -e 's/^CONFIG_SYSTEM_\(.*\)=y$$/\1/' | \
|
||||
tr [:upper:] [:lower:])
|
||||
|
||||
# defaults
|
||||
DEF_IMAGEUB = images/linux/image.ub
|
||||
SYSTEM_DTB ?= images/linux/system.dtb
|
||||
SYSTEM_DTS ?= images/linux/system.dts
|
||||
PETALINUX_CONFIG = project-spec/configs/config
|
||||
LOCAL_CONF = build/conf/local.conf
|
||||
SOURCE_DOWNLOADS = build/downloads
|
||||
SOURCE_MIRROR = $(shell awk 'BEGIN { FS = "file://" } /PREMIRRORS =/ { gsub(/ \\n \\/, "", $$2); print $$2 }' build/conf/plnxtool.conf)
|
||||
MANIFEST_PATH = $(lastword $(wildcard build/tmp/deploy/licenses/petalinux-image-minimal-*))
|
||||
|
||||
# location of imported .hdf/.xsa file
|
||||
ifeq ($(HDF),)
|
||||
# if user does not specify HDF, select PRJ_HDF from existing .hdf or .xsa file
|
||||
PRJ_HDF = $(wildcard project-spec/hw-description/*.hdf project-spec/hw-description/*.xsa)
|
||||
else
|
||||
# if user specifies HDF, let PRJ_HDF depend on HDF suffix and assume "system" as prefix
|
||||
PRJ_HDF = project-spec/hw-description/system$(suffix $(HDF))
|
||||
endif
|
||||
ifeq ($(PRJ_HDF),)
|
||||
$(error missing HDF, run with argument HDF=<path-to-.hdf-or-.xsa-file>)
|
||||
endif
|
||||
|
||||
# defaults for flash-* targets
|
||||
FLASH_TYPE ?= qspi_single
|
||||
FSBL_ELF ?= images/linux/zynqmp_fsbl.elf
|
||||
BOOT_BIN ?= images/linux/BOOT.BIN
|
||||
BOOT_BIN_OFF ?= 0
|
||||
KERNEL_IMG ?= $(DEF_IMAGEUB)
|
||||
KERNEL_IMG_OFF ?= $(shell echo $$((16 * 1024 * 1024)))
|
||||
|
||||
# user arguments
|
||||
HDF ?=
|
||||
BIT ?=
|
||||
FSBL ?=
|
||||
ATF ?=
|
||||
PMUFW ?=
|
||||
UBOOT ?=
|
||||
BOOT ?=
|
||||
BSP ?=
|
||||
BOOT_ARG_EXTRA ?=
|
||||
UPDATE_MIRROR ?= 0
|
||||
SOURCE_RELEASE ?= source-release
|
||||
MANIFESTS ?= manifests
|
||||
|
||||
ifneq ($(HDF),)
|
||||
TMPHDF ?= build/psmake/tmphdf/$(notdir $(HDF))/$(notdir $(HDF))
|
||||
endif
|
||||
|
||||
# petalinux-* generic arguments
|
||||
ifeq ($(V),1)
|
||||
GEN_ARGS = -v
|
||||
endif
|
||||
# petalinux-package --boot arguments
|
||||
ifneq ($(BIT),no)
|
||||
BOOT_ARG_FPGA = --fpga
|
||||
ifneq ($(BIT),)
|
||||
BOOT_ARG_FPGA += $(BIT)
|
||||
endif
|
||||
endif
|
||||
# no need to specify --fsbl if default is to be used
|
||||
BOOT_ARG_FSBL =
|
||||
ifneq ($(FSBL),)
|
||||
BOOT_ARG_FSBL += --fsbl $(FSBL)
|
||||
endif
|
||||
# no need to specify --atf if default is to be used
|
||||
BOOT_ARG_ATF =
|
||||
ifneq ($(ATF),)
|
||||
BOOT_ARG_ATF += --atf $(ATF)
|
||||
endif
|
||||
# no need to specify --pmufw if default is to be used
|
||||
BOOT_ARG_PMUFW =
|
||||
ifneq ($(PMUFW),)
|
||||
BOOT_ARG_PMUFW += --pmufw $(PMUFW)
|
||||
endif
|
||||
BOOT_ARG_UBOOT = --u-boot
|
||||
ifneq ($(UBOOT),)
|
||||
BOOT_ARG_UBOOT += $(UBOOT)
|
||||
endif
|
||||
ifneq ($(BOOT),)
|
||||
BOOT_ARG_OUT = -o $(BOOT)
|
||||
endif
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
||||
define set-update-mirror
|
||||
sed -i 's/CONFIG_YOCTO_BB_NO_NETWORK=y/# CONFIG_YOCTO_BB_NO_NETWORK is not set/' $(PETALINUX_CONFIG)
|
||||
printf 'BB_GENERATE_MIRROR_TARBALLS = "1"' >> $(LOCAL_CONF)
|
||||
petalinux-config $(SILENTCONFIG)
|
||||
endef
|
||||
|
||||
define reset-update-mirror
|
||||
sed -i 's/# CONFIG_YOCTO_BB_NO_NETWORK is not set/CONFIG_YOCTO_BB_NO_NETWORK=y/' $(PETALINUX_CONFIG)
|
||||
sed -i '/BB_GENERATE_MIRROR_TARBALLS/d' $(LOCAL_CONF)
|
||||
petalinux-config $(SILENTCONFIG)
|
||||
endef
|
||||
|
||||
# arg1: cmd
|
||||
define trap-update-mirror
|
||||
sh -c "trap 'trap - SIGINT SIGTERM ERR; \
|
||||
sed -i \"s/# CONFIG_YOCTO_BB_NO_NETWORK is not set/CONFIG_YOCTO_BB_NO_NETWORK=y/\" $(PETALINUX_CONFIG); \
|
||||
sed -i \"/BB_GENERATE_MIRROR_TARBALLS/d\" $(LOCAL_CONF); \
|
||||
petalinux-config $(SILENTCONFIG); \
|
||||
exit 1' SIGINT SIGTERM ERR; $(1)"
|
||||
endef
|
||||
|
||||
|
||||
define set-source-release
|
||||
printf 'INHERIT += "archiver"\n' >> $(LOCAL_CONF)
|
||||
printf 'ARCHIVER_MODE[src] = "original"\n' >> $(LOCAL_CONF)
|
||||
petalinux-config $(SILENTCONFIG)
|
||||
endef
|
||||
|
||||
define reset-source-release
|
||||
sed -i '/INHERIT += "archiver"/d' $(LOCAL_CONF)
|
||||
sed -i '/ARCHIVER_MODE\[src\] = "original"/d' $(LOCAL_CONF)
|
||||
petalinux-config $(SILENTCONFIG)
|
||||
endef
|
||||
|
||||
# arg1: cmd
|
||||
define trap-source-release
|
||||
sh -c "trap 'trap - SIGINT SIGTERM ERR; \
|
||||
sed -i \"/INHERIT += \\\"archiver\\\"/d\" $(LOCAL_CONF); \
|
||||
sed -i \"/ARCHIVER_MODE\\\[src\\\] = \\\"original\\\"/d\" $(LOCAL_CONF); \
|
||||
petalinux-config $(SILENTCONFIG); \
|
||||
exit 1' SIGINT SIGTERM ERR; $(1)"
|
||||
endef
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
||||
FORCE:
|
||||
|
||||
|
||||
# force only if "gethdf" is one of the targets
|
||||
$(PRJ_HDF): $(HDF) $(subst gethdf,FORCE,$(findstring gethdf,$(MAKECMDGOALS)))
|
||||
mkdir -p $(dir $(TMPHDF))
|
||||
ln -sf $(realpath $(HDF)) $(TMPHDF)
|
||||
petalinux-config $(GEN_ARGS) --get-hw-description $(dir $(TMPHDF)) $(SILENTCONFIG)
|
||||
|
||||
gethdf: $(PRJ_HDF)
|
||||
|
||||
.PHONY: gethdf
|
||||
|
||||
|
||||
config: $(PRJ_HDF)
|
||||
petalinux-config $(GEN_ARGS)
|
||||
|
||||
config-kernel: $(PRJ_HDF)
|
||||
DISPLAY= petalinux-config $(GEN_ARGS) -c kernel
|
||||
|
||||
config-rootfs: $(PRJ_HDF)
|
||||
petalinux-config $(GEN_ARGS) -c rootfs
|
||||
|
||||
build: $(PRJ_HDF)
|
||||
ifneq ($(shell grep CONFIG_YOCTO_BB_NO_NETWORK=y project-spec/configs/config),)
|
||||
$(call trap-update-mirror,__BLD_ARGS=\"$(GEN_ARGS)\" $(MAKE) __build)
|
||||
else
|
||||
__BLD_ARGS="$(GEN_ARGS)" $(MAKE) __build
|
||||
endif
|
||||
|
||||
sdk: $(PRJ_HDF)
|
||||
ifneq ($(shell grep CONFIG_YOCTO_BB_NO_NETWORK=y project-spec/configs/config),)
|
||||
$(call trap-update-mirror,__BLD_ARGS=\"$(GEN_ARGS) -s\" $(MAKE) __build)
|
||||
else
|
||||
__BLD_ARGS="$(GEN_ARGS) -s" $(MAKE) __build
|
||||
endif
|
||||
|
||||
source-release: $(PRJ_HDF)
|
||||
$(call trap-source-release,__BLD_ARGS=\"$(GEN_ARGS)\" $(MAKE) __source-release)
|
||||
__BLD_ARGS="$(GEN_ARGS)" $(MAKE) __source-release
|
||||
|
||||
__build:
|
||||
ifeq ($(UPDATE_MIRROR),1)
|
||||
$(call set-update-mirror)
|
||||
endif
|
||||
petalinux-build $(__BLD_ARGS)
|
||||
ifeq ($(UPDATE_MIRROR),1)
|
||||
mkdir -p $(SOURCE_MIRROR)
|
||||
find $(SOURCE_DOWNLOADS)/* -path '$(SOURCE_DOWNLOADS)/git2' -prune -or \
|
||||
-not -name '*.done' \
|
||||
-type f \
|
||||
-print \
|
||||
-exec cp -n {} $(SOURCE_MIRROR) \;
|
||||
$(call reset-update-mirror)
|
||||
endif
|
||||
|
||||
__source-release:
|
||||
$(call set-source-release)
|
||||
__BLD_ARGS="$(GEN_ARGS)" $(MAKE) __build
|
||||
$(MAKEFILE_PATH)/source-release.sh $(SOURCE_RELEASE)
|
||||
mkdir -p $(MANIFESTS)
|
||||
find $(MANIFEST_PATH) -name '*.manifest' -exec cp {} $(MANIFESTS) \;
|
||||
$(call reset-source-release)
|
||||
|
||||
|
||||
.PHONY: config config-kernel config-rootfs build sdk source-release
|
||||
|
||||
|
||||
package-boot: $(PRJ_HDF)
|
||||
petalinux-package --boot --force \
|
||||
$(BOOT_ARG_FPGA) $(BOOT_ARG_FSBL) $(BOOT_ARG_ATF) \
|
||||
$(BOOT_ARG_PMUFW) $(BOOT_ARG_UBOOT) $(BOOT_ARG_EXTRA) \
|
||||
$(BOOT_ARG_OUT)
|
||||
package-boot: $(BOOT)
|
||||
|
||||
package-prebuilt: $(PRJ_HDF)
|
||||
petalinux-package --prebuilt --force -a $(DEF_IMAGEUB):images
|
||||
|
||||
$(BSP): $(PRJ_HDF)
|
||||
ifeq ($(BSP),)
|
||||
@echo "error: missing BSP, run with argument BSP=<path-to-.bsp-file>"
|
||||
@false
|
||||
else
|
||||
petalinux-package --bsp --force -p $(PWD) -o $(BSP)
|
||||
endif
|
||||
package-bsp: $(BSP)
|
||||
|
||||
dts: $(SYSTEM_DTS)
|
||||
$(SYSTEM_DTS): $(SYSTEM_DTB)
|
||||
dtc -I dtb -O dts -o $@ $<
|
||||
|
||||
reset-jtag: $(PRF_HDF)
|
||||
$(XSDB) $(MAKEFILE_PATH)xsdb/$(PLATFORM)-reset.tcl
|
||||
|
||||
boot-jtag-u-boot: reset-jtag
|
||||
petalinux-boot --jtag --u-boot -v --fpga --hw_server-url $(HW_SERVER_URL)
|
||||
|
||||
boot-jtag-kernel: reset-jtag
|
||||
petalinux-boot --jtag --kernel -v --fpga --hw_server-url $(HW_SERVER_URL)
|
||||
|
||||
boot-jtag-psinit-uboot: reset-jtag
|
||||
$(XSDB) $(MAKEFILE_PATH)xsdb/$(PLATFORM)-boot-psinit-uboot.tcl
|
||||
|
||||
boot-qemu: $(PRJ_HDF)
|
||||
petalinux-boot --qemu --kernel
|
||||
|
||||
# IMPORTANT: program_flash can be found in Xilinx Vivado toolchain, only
|
||||
# (<= v2018.2)!
|
||||
flash-boot: reset-jtag
|
||||
program_flash \
|
||||
-flash_type $(FLASH_TYPE) \
|
||||
-fsbl $(FSBL_ELF) \
|
||||
-f $(BOOT_BIN) -offset $(BOOT_BIN_OFF) \
|
||||
-verify \
|
||||
-cable type xilinx_tcf url $(HW_SERVER_URL)
|
||||
|
||||
flash-kernel: reset-jtag
|
||||
program_flash \
|
||||
-flash_type $(FLASH_TYPE) \
|
||||
-fsbl $(FSBL_ELF) \
|
||||
-f $(KERNEL_IMG) -offset $(KERNEL_IMG_OFF) \
|
||||
-verify \
|
||||
-cable type xilinx_tcf url $(HW_SERVER_URL)
|
||||
|
||||
flash: flash-boot flash-kernel
|
||||
|
||||
.PHONY: $(BOOT) $(BSP) package-boot package-prebuilt package-bsp dts \
|
||||
reset-jtag boot-jtag-u-boot boot-jtag-kernel boot-jtag-psinit-uboot \
|
||||
boot-qemu flash-boot flash-kernel flash
|
||||
|
||||
mrproper:
|
||||
petalinux-build $(GEN_ARGS) -x mrproper
|
||||
ifeq ($(CLEAN_HDF),1)
|
||||
-cd project-spec/hw-description/ && \
|
||||
ls -1 | grep -v -e ^metadata$$ | xargs rm -fr
|
||||
endif
|
||||
rm -rf project-spec/meta-plnx-generated/
|
||||
-find pre-built/ -type f -not -name 'pmu_rom_qemu_sha3.elf' \
|
||||
-not -name 'system.dtb' \
|
||||
-not -name 'linux-boot.*' \
|
||||
-delete
|
||||
rm -rf *.bsp
|
||||
|
||||
.PHONY: mrproper
|
27
fpga/lib/psmake/source-release.sh
Executable file
27
fpga/lib/psmake/source-release.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to archive a subset of packages matching specific license(s)
|
||||
# Source and license files are copied into sub folders of package folder
|
||||
#
|
||||
# Based upon example script in
|
||||
# https://www.yoctoproject.org/docs/3.1/dev-manual/dev-manual.html#maintaining-open-source-license-compliance-during-your-products-lifecycle
|
||||
|
||||
src_release_dir="$1"
|
||||
mkdir -p $src_release_dir
|
||||
for a in build/tmp/deploy/sources/*; do
|
||||
for d in $a/*; do
|
||||
# Get package name from path
|
||||
p=`basename $d`
|
||||
p=${p%-*}
|
||||
p=${p%-*}
|
||||
# Only archive GPL packages (update *GPL* regex for your license check)
|
||||
numfiles=`ls build/tmp/deploy/licenses/$p/*GPL* 2> /dev/null | wc -l`
|
||||
if [ $numfiles -ge 1 ]; then
|
||||
echo Archiving $p
|
||||
mkdir -p $src_release_dir/$p/source
|
||||
cp $d/* $src_release_dir/$p/source 2> /dev/null
|
||||
mkdir -p $src_release_dir/$p/license
|
||||
cp build/tmp/deploy/licenses/$p/* $src_release_dir/$p/license 2> /dev/null
|
||||
fi
|
||||
done
|
||||
done
|
312
fpga/lib/psmake/vitis.mk
Normal file
312
fpga/lib/psmake/vitis.mk
Normal file
@ -0,0 +1,312 @@
|
||||
#!/usr/bin/make -f
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2019-2020 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : Makefile
|
||||
## Initial Author : Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : Vitis convenience wrapper
|
||||
##
|
||||
## Uses: vitis xsct
|
||||
##
|
||||
################################################################################
|
||||
|
||||
ifeq ($(XILINX_VITIS),)
|
||||
$(error XILINX_VITIS is unset. This Makefile must be invoked from within a Vitis environment)
|
||||
endif
|
||||
|
||||
MAKEFILE_PATH := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
all: build
|
||||
|
||||
# include config
|
||||
CFG ?= default
|
||||
include $(CFG).mk
|
||||
|
||||
include $(MAKEFILE_PATH)common.mk
|
||||
|
||||
###############################################################################
|
||||
# Variables
|
||||
|
||||
# platform project paths
|
||||
HDF ?=
|
||||
XPFM ?=
|
||||
|
||||
# user arguments, defaults, usually set via config.mk
|
||||
DEF_DOMAIN_PROC ?= psu_cortexa53_0
|
||||
DEF_DOMAIN_OS ?= standalone
|
||||
DEF_APP_PROC ?= psu_cortexa53_0
|
||||
DEF_APP_TMPL ?= Empty Application
|
||||
DEF_APP_OS ?= standalone
|
||||
DEF_APP_LANG ?= C
|
||||
DEF_APP_BCFG ?= Release
|
||||
DEF_APP_OPT ?= Optimize more (-O2)
|
||||
|
||||
DOMAIN_PRJS ?=
|
||||
APP_PRJS ?=
|
||||
|
||||
# user arguments, rarely modified
|
||||
PLAT_PRJ ?= plat
|
||||
XSCT ?= xsct
|
||||
VITIS ?= vitis
|
||||
|
||||
###############################################################################
|
||||
# Platform repos
|
||||
|
||||
PLATS ?=
|
||||
|
||||
ifneq ($(strip $(PLATS)),)
|
||||
__PLATS_CCMD = $(foreach PLAT,$(PLATS), \
|
||||
repo -add-platforms {$(PLAT)};)
|
||||
endif
|
||||
|
||||
$(O)/.metadata/plats.stamp:
|
||||
ifneq ($(strip $(PLATS)),)
|
||||
$(XSCT) -eval 'setws {$(O)}; $(__PLATS_CCMD)'
|
||||
else
|
||||
mkdir -p $(O)/.metadata/
|
||||
endif
|
||||
touch $@
|
||||
|
||||
###############################################################################
|
||||
# Platform
|
||||
|
||||
# arg1: platform name
|
||||
# arg2: path to platform file
|
||||
define gen-plat-rule
|
||||
$(O)/$(1)/hw/$(1).stamp: $(O)/.metadata/repos.stamp $(O)/.metadata/plats.stamp
|
||||
ifneq ($(HDF),)
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
platform create -name {$(1)} -hw {$(2)}'
|
||||
else
|
||||
ifneq ($(XPFM),)
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
platform create -name {$(1)} -xpfm {$(XPFM)}'
|
||||
touch $(O)/$(1)/xpfm.stamp
|
||||
else
|
||||
@echo "error: missing HDF or XPFM, run either with HDF=<path-to-.xsa-file> or XPFM=<path-to-.xpfm-file>" >&2
|
||||
@false
|
||||
endif
|
||||
endif
|
||||
touch $$@
|
||||
|
||||
# shortcut to create platform, "make <plat>"
|
||||
$(1): $(O)/$(1)/hw/$(1).stamp
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
platform remove -name {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Domains
|
||||
|
||||
# arg1: domain name
|
||||
# arg2: platform name
|
||||
define gen-domain-rule
|
||||
$(1)_PROC ?= $(DEF_DOMAIN_PROC)
|
||||
$(1)_OS ?= $(DEF_DOMAIN_OS)
|
||||
$(1)_LIBS ?=
|
||||
$(1)_EXTRA_CFLAGS ?=
|
||||
$(1)_STDIN ?=
|
||||
$(1)_STDOUT ?=
|
||||
$(1)_IS_FSBL ?=
|
||||
|
||||
ifneq ($$strip($$($(1)_LIBS)),)
|
||||
__$(1)_LIBS_CCMD = $$(foreach LIB,$$($(1)_LIBS), \
|
||||
bsp setlib -name {$$(LIB)};)
|
||||
endif
|
||||
__$(1)_EXTRA_CCMD =
|
||||
ifneq ($$($(1)_EXTRA_CFLAGS),)
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
bsp config extra_compiler_flags {$$($(1)_EXTRA_CFLAGS)};
|
||||
endif
|
||||
ifneq ($$($(1)_STDIN),)
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
bsp config stdin {$$($(1)_STDIN)};
|
||||
endif
|
||||
ifneq ($$($(1)_STDOUT),)
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
bsp config stdout {$$($(1)_STDOUT)};
|
||||
endif
|
||||
ifeq ($$($(1)_IS_FSBL),yes)
|
||||
# non-default BSP settings for FSBL
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
bsp config {zynqmp_fsbl_bsp} {true}; \
|
||||
bsp config {read_only} {true}; \
|
||||
bsp config {use_mkfs} {false}; \
|
||||
bsp config {extra_compiler_flags} {-g -Wall -Wextra -Os -flto -ffat-lto-objects};
|
||||
endif
|
||||
|
||||
$(O)/$(2)/$$($(1)_PROC)/$(1)/bsp/Makefile: $(O)/$(2)/hw/$(2).stamp
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
platform active {$(2)}; \
|
||||
domain create -name {$(1)} -proc {$$($(1)_PROC)} \
|
||||
-os {$$($(1)_OS)}; \
|
||||
$$(__$(1)_LIBS_CCMD) \
|
||||
$$(__$(1)_EXTRA_CCMD) \
|
||||
$$($(1)_POST_CREATE_TCL); \
|
||||
bsp regenerate'
|
||||
ifneq ($$(strip $$($(1)_PATCH)),)
|
||||
$$(foreach PATCH,$$($(1)_PATCH),$(call patch-src,$(1),$$(PATCH))) :
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_SED)),)
|
||||
$$(foreach SED,$$($(1)_SED),$(call sed-src,$(1),$$(SED))) :
|
||||
endif
|
||||
|
||||
|
||||
$(O)/$(2)/export/$(2)/sw/$(2)/$(1)/bsplib/lib/libxil.a: $(O)/$(2)/$$($(1)_PROC)/$(1)/bsp/Makefile
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
platform active {$(2)}; \
|
||||
platform generate -domains {$(1)}'
|
||||
|
||||
# shortcut to create domain, "make <domain>"
|
||||
$(1): $(O)/$(2)/export/$(2)/sw/$(2)/$(1)/bsplib/lib/libxil.a
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
platform active {$(2)}; \
|
||||
domain remove -name {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Applications
|
||||
|
||||
# arg1: app name
|
||||
# arg2: src file/folder name, scheme <srcfile>
|
||||
# Paths are normalized because Vitis does not accept relative paths
|
||||
define import-src
|
||||
importsources -name $(1) -path [file normalize $(2)] -soft-link;
|
||||
endef
|
||||
|
||||
# arg1: app name
|
||||
# arg2: platform name
|
||||
define gen-app-rule
|
||||
$(1)_PROC ?= $(DEF_APP_PROC)
|
||||
$(1)_TMPL ?= $(DEF_APP_TMPL)
|
||||
$(1)_OS ?= $(DEF_APP_OS)
|
||||
$(1)_LANG ?= $(DEF_APP_LANG)
|
||||
$(1)_BCFG ?= $(DEF_APP_BCFG)
|
||||
$(1)_OPT ?= $(DEF_APP_OPT)
|
||||
|
||||
ifneq ($$strip($$($(1)_CPPSYMS)),)
|
||||
__$(1)_CPPSYMS_CCMD = $$(foreach SYM,$$($(1)_CPPSYMS), \
|
||||
app config -name {$(1)} define-compiler-symbols {$$(SYM)};)
|
||||
endif
|
||||
ifneq ($$($(1)_HW),)
|
||||
$(O)/$(1)/src/lscript.ld:
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
app create -name {$(1)} -hw {$$($(1)_HW)} \
|
||||
-proc {$$($(1)_PROC)} -template {$$($(1)_TMPL)} \
|
||||
-os {$$($(1)_OS)} -lang {$$($(1)_LANG)}'
|
||||
else
|
||||
ifneq ($$($(1)_PLAT),)
|
||||
$(O)/$(1)/src/lscript.ld:
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
app create -name {$(1)} -platform {$$($(1)_PLAT)} \
|
||||
-domain {$$($(1)_DOMAIN)} \
|
||||
-proc {$$($(1)_PROC)} -template {$$($(1)_TMPL)} \
|
||||
-os {$$($(1)_OS)} -lang {$$($(1)_LANG)}; \
|
||||
app config -name {$(1)} build-config {$$($(1)_BCFG)}; \
|
||||
app config -name {$(1)} compiler-optimization {$$($(1)_OPT)}; \
|
||||
$$(__$(1)_CPPSYMS_CCMD) \
|
||||
$$($(1)_POST_CREATE_TCL)'
|
||||
else
|
||||
$(O)/$(1)/src/lscript.ld:
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
app create -name {$(1)} -platform {$(2)} \
|
||||
-domain {$$($(1)_DOMAIN)} \
|
||||
-proc {$$($(1)_PROC)} -template {$$($(1)_TMPL)} \
|
||||
-os {$$($(1)_OS)} -lang {$$($(1)_LANG)}; \
|
||||
app config -name {$(1)} build-config {$$($(1)_BCFG)}; \
|
||||
app config -name {$(1)} compiler-optimization {$$($(1)_OPT)}; \
|
||||
$$(__$(1)_CPPSYMS_CCMD) \
|
||||
$$($(1)_POST_CREATE_TCL)'
|
||||
endif
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_SRC)),)
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
$$(foreach SRC,$$($(1)_SRC),$(call import-src,$(1),$$(SRC)))'
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_PATCH)),)
|
||||
$$(foreach PATCH,$$($(1)_PATCH),$(call patch-src,$(1)/src,$$(PATCH))) :
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_SED)),)
|
||||
$$(foreach SED,$$($(1)_SED),$(call sed-src,$(1)/src,$$(SED))) :
|
||||
endif
|
||||
|
||||
$(O)/$(1)/$$($(1)_BCFG)/$(1).elf: $(O)/$(2)/export/$(2)/sw/$(2)/$$($(1)_DOMAIN)/bsplib/lib/libxil.a \
|
||||
$(O)/.metadata/repos.stamp $(O)/.metadata/plats.stamp $(O)/$(1)/src/lscript.ld \
|
||||
$$($(1)_SRC)
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
app build -name {$(1)}'
|
||||
|
||||
GEN_APPS_DEP += $(O)/$(2)/export/$(2)/sw/$(2)/$$($(1)_DOMAIN)/bsplib/lib/libxil.a
|
||||
BLD_APPS_DEP += $(O)/$(1)/$$($(1)_BCFG)/$(1).elf
|
||||
|
||||
# shortcut to create application, "make <app>"
|
||||
$(1): $(O)/$(1)/$$($(1)_BCFG)/$(1).elf
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
app remove {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Targets
|
||||
|
||||
# generate make rules for platform project, single
|
||||
$(eval $(call gen-plat-rule,$(PLAT_PRJ),$(HDF)))
|
||||
getdsa: $(PLAT_PRJ)
|
||||
.PHONY: gethwplat
|
||||
|
||||
# generate make rules for domains, multiple
|
||||
$(foreach DOMAIN_PRJ,$(DOMAIN_PRJS),\
|
||||
$(eval $(call gen-domain-rule,$(DOMAIN_PRJ),$(PLAT_PRJ))))
|
||||
|
||||
# generate make rules for apps, multiple
|
||||
$(foreach APP_PRJ,$(APP_PRJS),\
|
||||
$(eval $(call gen-app-rule,$(APP_PRJ),$(PLAT_PRJ))))
|
||||
|
||||
# generate make rules for bootgen projects, multiple
|
||||
$(foreach BOOTGEN_PRJ,$(BOOTGEN_PRJS),\
|
||||
$(eval $(call gen-bif-rule,$(BOOTGEN_PRJ))))
|
||||
|
||||
# generate all projects
|
||||
generate: $(GEN_APPS_DEP) $(GEN_BOOTGEN_DEP)
|
||||
.PHONY: generate
|
||||
|
||||
# build all projects
|
||||
build: $(BLD_APPS_DEP) $(BLD_BOOTGEN_DEP)
|
||||
.PHONY: build
|
||||
|
||||
# open workspace in GUI mode
|
||||
vitis:
|
||||
$(VITIS) -workspace $(O)
|
||||
.PHONY: vitis
|
94
fpga/lib/psmake/xsdb/zynq-boot-psinit-uboot.tcl
Normal file
94
fpga/lib/psmake/xsdb/zynq-boot-psinit-uboot.tcl
Normal file
@ -0,0 +1,94 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : zynq-boot-psinit-uboot.tcl
|
||||
## Initial Author : Joachim Foerster
|
||||
## <joachim.foerster@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : petalinux-* convenience wrapper
|
||||
##
|
||||
## TCL script for XSDB to "boot" Zynq 7000 into U-Boot via
|
||||
## JTAG using ps7_init TCL function instead of FSBL
|
||||
## executable. Thus no FSBL hook code is executed.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
|
||||
if {![info exists ::env(HW_SERVER_URL)]} {
|
||||
puts stderr "error: environment variable HW_SERVER_URL not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# use PetaLinux built-in defaults if user does not specify certain items
|
||||
set PS7INIT "project-spec/hw-description/ps7_init.tcl"
|
||||
if {[info exists ::env(BIT)]} {
|
||||
set BIT $::env(BIT)
|
||||
} else {
|
||||
set BIT "images/linux/system.bit"
|
||||
}
|
||||
if {[info exists ::env(UBOOT)]} {
|
||||
set UBOOT $::env(UBOOT)
|
||||
} else {
|
||||
set UBOOT "images/linux/u-boot.elf"
|
||||
}
|
||||
|
||||
if {![file exists $PS7INIT]} {
|
||||
puts stderr "error: required file $PS7INIT does not exist"
|
||||
exit 1
|
||||
}
|
||||
if {![file exists $BIT]} {
|
||||
puts stderr "error: required file $BIT does not exist"
|
||||
exit 1
|
||||
}
|
||||
if {![file exists $UBOOT]} {
|
||||
puts stderr "error: required file $UBOOT does not exist"
|
||||
exit 1
|
||||
}
|
||||
|
||||
source $PS7INIT
|
||||
|
||||
connect -url $::env(HW_SERVER_URL)
|
||||
|
||||
puts "Execute ps7_init TCL proc ..."
|
||||
targets -set -filter {name =~ "ARM*#0"}
|
||||
ps7_init
|
||||
puts "done."
|
||||
|
||||
puts "Download bitstream $BIT ..."
|
||||
fpga $BIT
|
||||
puts "done."
|
||||
|
||||
puts "Execute ps7_post_config TCL proc ..."
|
||||
targets -set -filter {name =~ "ARM*#0"}
|
||||
ps7_post_config
|
||||
puts "done."
|
||||
|
||||
puts "Download U-Boot executable $UBOOT ..."
|
||||
targets -set -filter {name =~ "ARM*#0"}
|
||||
dow $UBOOT
|
||||
puts "done."
|
||||
|
||||
puts "Start U-Boot ..."
|
||||
con
|
||||
puts "done."
|
||||
|
||||
disconnect
|
46
fpga/lib/psmake/xsdb/zynq-reset.tcl
Normal file
46
fpga/lib/psmake/xsdb/zynq-reset.tcl
Normal file
@ -0,0 +1,46 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : zynq-reset.tcl
|
||||
## Initial Author : Joachim Foerster
|
||||
## <joachim.foerster@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : petalinux-* convenience wrapper
|
||||
##
|
||||
## TCL script for XSDB to "reset" Zynq 7000. PL is left
|
||||
## unconfigured and PS CPU cores are stopped.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
if {![info exists ::env(HW_SERVER_URL)]} {
|
||||
puts stderr "error: environment variable HW_SERVER_URL not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
connect -url $::env(HW_SERVER_URL)
|
||||
|
||||
puts "Trigger system reset on APU ..."
|
||||
targets -set -filter {name =~ "APU"}
|
||||
rst -system
|
||||
puts "done."
|
||||
|
||||
disconnect
|
51
fpga/lib/psmake/xsdb/zynqmp-reset.tcl
Normal file
51
fpga/lib/psmake/xsdb/zynqmp-reset.tcl
Normal file
@ -0,0 +1,51 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : zynqmp-reset.tcl
|
||||
## Initial Author : Stefan Wiehler <stefan.wiehler@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : petalinux-* convenience wrapper
|
||||
##
|
||||
## TCL script for XSDB to "reset" Zynq UltraScale+. PL is left
|
||||
## unconfigured and PS CPU cores are stopped.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
connect -url $::env(HW_SERVER_URL)
|
||||
|
||||
if {$::env(PETALINUX_VER) < 2018.3} {
|
||||
set ZYNQMP_UTILS "tools/hsm/scripts/sdk/util/zynqmp_utils.tcl"
|
||||
} elseif {$::env(PETALINUX_VER) == 2018.3} {
|
||||
set ZYNQMP_UTILS "tools/xsct/SDK/2018.3/scripts/sdk/util/zynqmp_utils.tcl"
|
||||
} elseif {$::env(PETALINUX_VER) == 2019.1} {
|
||||
set ZYNQMP_UTILS "tools/xsct/scripts/sdk/util/zynqmp_utils.tcl"
|
||||
} else {
|
||||
set ZYNQMP_UTILS "tools/xsct/scripts/vitis/util/zynqmp_utils.tcl"
|
||||
}
|
||||
source $::env(PETALINUX)/$ZYNQMP_UTILS
|
||||
targets -set -nocase -filter {name =~"APU*"} -index 1
|
||||
rst -system
|
||||
after 3000
|
||||
targets -set -nocase -filter {name =~"APU*"} -index 1
|
||||
reset_apu
|
||||
targets -set -filter {level==0} -index 0
|
||||
exit
|
369
fpga/lib/psmake/xsdk.mk
Normal file
369
fpga/lib/psmake/xsdk.mk
Normal file
@ -0,0 +1,369 @@
|
||||
#!/usr/bin/make -f
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
## Copyright 2018-2019 Missing Link Electronics, Inc.
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Name : Makefile
|
||||
## Initial Author : Joachim Foerster
|
||||
## <joachim.foerster@missinglinkelectronics.com>
|
||||
##
|
||||
################################################################################
|
||||
##
|
||||
## File Summary : xsct/xsdk convenience wrapper
|
||||
##
|
||||
## Uses: xsct xsdk
|
||||
##
|
||||
################################################################################
|
||||
|
||||
ifeq ($(XILINX_VIVADO),)
|
||||
$(error XILINX_VIVADO is unset. This Makefile must be invoked from within a Vivado/XSDK environment)
|
||||
endif
|
||||
|
||||
MAKEFILE_PATH := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
all: build
|
||||
|
||||
# include config
|
||||
CFG ?= default
|
||||
include $(CFG).mk
|
||||
|
||||
include $(MAKEFILE_PATH)common.mk
|
||||
|
||||
###############################################################################
|
||||
# Variables
|
||||
|
||||
# path to .hdf file exported from Vivado
|
||||
HDF ?=
|
||||
|
||||
# user arguments, defaults, usually set via config.mk
|
||||
DEF_BSP_OS ?= standalone
|
||||
DEF_APP_LANG ?= C
|
||||
DEF_APP_BCFG ?= Release
|
||||
DEF_APP_OPT ?= Optimize more (-O2)
|
||||
DEF_APP_TMPL ?= Empty Application
|
||||
DEF_LIB_TYPE ?= static
|
||||
DEF_LIB_OS ?= standalone
|
||||
DEF_LIB_LANG ?= C
|
||||
DEF_LIB_BCFG ?= Release
|
||||
DEF_LIB_OPT ?= Optimize more (-O2)
|
||||
|
||||
BSP_PRJS ?=
|
||||
APP_PRJS ?=
|
||||
|
||||
# user arguments, rarely modified
|
||||
HW_PRJ ?= hw
|
||||
XSCT ?= xsct
|
||||
XSDK ?= xsdk
|
||||
|
||||
# internal settings
|
||||
# <none>
|
||||
|
||||
###############################################################################
|
||||
# Hardware Platform Project
|
||||
|
||||
# arg1: hw name
|
||||
# arg2: path to hdf file
|
||||
define gen-hw-rule
|
||||
$(O)/$(1)/system.hdf: $(O)/.metadata/repos.stamp
|
||||
ifeq ($(HDF),)
|
||||
@echo "error: missing HDF, run with HDF=<path-to-hdf>" >&2
|
||||
@false
|
||||
endif
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
createhw -name {$(1)} -hwspec {$(2)}; \
|
||||
$$($(1)_POST_CREATE_TCL)'
|
||||
|
||||
# shortcut to create hw, "make <hw>"
|
||||
$(1): $(O)/$(1)/system.hdf
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
deleteprojects -name {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Board Support Packages (BSPs)
|
||||
|
||||
# arg1: bsp name
|
||||
# arg2: hw name
|
||||
define gen-bsp-rule
|
||||
$(1)_PROC ?=
|
||||
$(1)_OS ?= $(DEF_BSP_OS)
|
||||
ifeq ($$($(1)_PROC),psu_cortexa53_0)
|
||||
$(1)_ARCH ?= 64
|
||||
else
|
||||
$(1)_ARCH ?= 32
|
||||
endif
|
||||
$(1)_LIBS ?=
|
||||
$(1)_EXTRA_CFLAGS ?=
|
||||
$(1)_STDIN ?=
|
||||
$(1)_STDOUT ?=
|
||||
$(1)_IS_FSBL ?=
|
||||
|
||||
ifneq ($$strip($$($(1)_LIBS)),)
|
||||
__$(1)_LIBS_CCMD = $$(foreach LIB,$$($(1)_LIBS), \
|
||||
setlib -bsp {$(1)} -lib {$$(LIB)};)
|
||||
endif
|
||||
__$(1)_EXTRA_CCMD =
|
||||
ifneq ($$($(1)_EXTRA_CFLAGS),)
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
configbsp -bsp {$(1)} extra_compiler_flags {$$($(1)_EXTRA_CFLAGS)};
|
||||
endif
|
||||
ifneq ($$($(1)_STDIN),)
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
configbsp -bsp {$(1)} stdin {$$($(1)_STDIN)};
|
||||
endif
|
||||
ifneq ($$($(1)_STDOUT),)
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
configbsp -bsp {$(1)} stdout {$$($(1)_STDOUT)};
|
||||
endif
|
||||
ifeq ($$($(1)_IS_FSBL),yes)
|
||||
# non-default BSP settings for FSBL
|
||||
__$(1)_EXTRA_CCMD += \
|
||||
configbsp -bsp {$(1)} {zynqmp_fsbl_bsp} {true}; \
|
||||
configbsp -bsp {$(1)} {read_only} {true}; \
|
||||
configbsp -bsp {$(1)} {use_mkfs} {false}; \
|
||||
configbsp -bsp {$(1)} {extra_compiler_flags} {-g -Wall -Wextra -Os -flto -ffat-lto-objects};
|
||||
endif
|
||||
$(O)/$(1)/system.mss: $(O)/$(2)/system.hdf
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
createbsp -name {$(1)} -proc {$$($(1)_PROC)} \
|
||||
-hwproject {$(2)} -os {$$($(1)_OS)} \
|
||||
-arch {$$($(1)_ARCH)}; \
|
||||
$$(__$(1)_LIBS_CCMD) \
|
||||
$$(__$(1)_EXTRA_CCMD) \
|
||||
$$($(1)_POST_CREATE_TCL); \
|
||||
regenbsp -bsp {$(1)}'
|
||||
ifneq ($$(strip $$($(1)_PATCH)),)
|
||||
$$(foreach PATCH,$$($(1)_PATCH),$(call patch-src,$(1),$$(PATCH))) :
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_SED)),)
|
||||
$$(foreach SED,$$($(1)_SED),$(call sed-src,$(1),$$(SED))) :
|
||||
endif
|
||||
|
||||
$(O)/$(1)/$$($(1)_PROC)/lib/libxil.a: $(O)/$(2)/system.hdf $(O)/$(1)/system.mss
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -build -type bsp -name {$(1)}'
|
||||
|
||||
# shortcut to build bsp, "make <bsp>"
|
||||
$(1): $(O)/$(1)/$$($(1)_PROC)/lib/libxil.a
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_clean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -clean -type bsp -name {$(1)}'
|
||||
.PHONY: $(1)_clean
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
deleteprojects -name {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Applications
|
||||
|
||||
# arg1: app name
|
||||
define gen-app-proc-contents-rule
|
||||
$$($(1)_PROC)
|
||||
endef
|
||||
|
||||
# arg1: app name
|
||||
# arg2: hw name
|
||||
define gen-app-rule
|
||||
$(1)_BSP ?=
|
||||
$(1)_PROC ?= $(call gen-app-proc-contents-rule,$$($(1)_BSP))
|
||||
$(1)_LANG ?= $(DEF_APP_LANG)
|
||||
$(1)_BCFG ?= $(DEF_APP_BCFG)
|
||||
$(1)_OPT ?= $(DEF_APP_OPT)
|
||||
$(1)_TMPL ?= $(DEF_APP_TMPL)
|
||||
$(1)_CPPSYMS ?=
|
||||
$(1)_LIBS ?=
|
||||
|
||||
ifneq ($$strip($$($(1)_CPPSYMS)),)
|
||||
__$(1)_CPPSYMS_CCMD = $$(foreach SYM,$$($(1)_CPPSYMS), \
|
||||
configapp -app {$(1)} define-compiler-symbols {$$(SYM)};)
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_LIBS)),)
|
||||
__$(1)_LIBS_CCMD = $$(foreach LIB,$$($(1)_LIBS), \
|
||||
configapp -app {$(1)} include-path {../../$$(LIB)/src}; \
|
||||
configapp -app {$(1)} library-search-path {../../$$(LIB)/$$($$(LIB)_BCFG)}; \
|
||||
configapp -app {$(1)} libraries {$$(LIB)};)
|
||||
endif
|
||||
$(O)/$(1)/src/lscript.ld: $(O)/$$($(1)_BSP)/system.mss
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
createapp -name {$(1)} -app {$$($(1)_TMPL)} \
|
||||
-proc {$$($(1)_PROC)} -hwproject {$(2)} \
|
||||
-bsp {$$($(1)_BSP)} -lang {$$($(1)_LANG)}; \
|
||||
configapp -app {$(1)} build-config {$$($(1)_BCFG)}; \
|
||||
configapp -app {$(1)} compiler-optimization {$$($(1)_OPT)}; \
|
||||
$$(__$(1)_CPPSYMS_CCMD) \
|
||||
$$(__$(1)_LIBS_CCMD) \
|
||||
$$($(1)_POST_CREATE_TCL)'
|
||||
ifneq ($$(strip $$($(1)_SRC)),)
|
||||
$$(foreach SRC,$$($(1)_SRC),$(call symlink-src,$(1),$$(SRC))) :
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_PATCH)),)
|
||||
$$(foreach PATCH,$$($(1)_PATCH),$(call patch-src,$(1)/src,$$(PATCH))) :
|
||||
endif
|
||||
ifneq ($$(strip $$($(1)_SED)),)
|
||||
$$(foreach SED,$$($(1)_SED),$(call sed-src,$(1)/src,$$(SED))) :
|
||||
endif
|
||||
|
||||
__$(1)_SRC = $(addprefix $(O)/$(1)/src/,$$($(1)_SRC))
|
||||
$(O)/$(1)/$$($(1)_BCFG)/$(1).elf: $(O)/$$($(1)_BSP)/$$($(1)_PROC)/lib/libxil.a $(O)/$(1)/src/lscript.ld $$(__$(1)_SRC) $$($(1)_LIBS)
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -build -type app -name {$(1)}'
|
||||
|
||||
GEN_APPS_DEP += $(O)/$(1)/src/lscript.ld
|
||||
BLD_APPS_DEP += $(O)/$(1)/$$($(1)_BCFG)/$(1).elf
|
||||
|
||||
# shortcut to build app, "make <app>"
|
||||
$(1): $(O)/$(1)/$$($(1)_BCFG)/$(1).elf
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_clean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -clean -type app -name {$(1)}'
|
||||
.PHONY: $(1)_clean
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
deleteprojects -name {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Libraries
|
||||
|
||||
# arg1: lib name
|
||||
define gen-lib-rule
|
||||
$(1)_TYPE ?= $(DEF_LIB_TYPE)
|
||||
$(1)_PROC ?= $(DEF_LIB_PROC)
|
||||
$(1)_OS ?= $(DEF_LIB_OS)
|
||||
$(1)_LANG ?= $(DEF_LIB_LANG)
|
||||
ifeq ($$($(1)_PROC),psu_cortexa53)
|
||||
$(1)_ARCH ?= 64
|
||||
else
|
||||
$(1)_ARCH ?= 32
|
||||
endif
|
||||
$(1)_BCFG ?= $(DEF_LIB_BCFG)
|
||||
$(1)_OPT ?= $(DEF_LIB_OPT)
|
||||
$(1)_CPPSYMS ?=
|
||||
|
||||
ifneq ($$strip($$($(1)_CPPSYMS)),)
|
||||
__$(1)_CPPSYMS_CCMD = $$(foreach SYM,$$($(1)_CPPSYMS), \
|
||||
configapp -app {$(1)} define-compiler-symbols {$$(SYM)};)
|
||||
endif
|
||||
$(O)/$(1)/src:
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
createlib -name {$(1)} -type {$$($(1)_TYPE)} \
|
||||
-proc {$$($(1)_PROC)} -os {$$($(1)_OS)} \
|
||||
-lang {$$($(1)_LANG)} -arch {$$($(1)_ARCH)}; \
|
||||
configapp -app {$(1)} build-config {$$($(1)_BCFG)}; \
|
||||
configapp -app {$(1)} compiler-optimization {$$($(1)_OPT)}; \
|
||||
$$(__$(1)_CPPSYMS_CCMD) \
|
||||
$$($(1)_POST_CREATE_TCL)'
|
||||
ifneq ($$(strip $$($(1)_SRC)),)
|
||||
$$(foreach SRC,$$($(1)_SRC),$(call symlink-src,$(1),$$(SRC))) :
|
||||
endif
|
||||
|
||||
__$(1)_SRC = $(addprefix $(O)/$(1)/src/,$$($(1)_SRC))
|
||||
ifeq ($$($(1)_TYPE),shared)
|
||||
$(O)/$(1)/$$($(1)_BCFG)/lib$(1).so: $(O)/$(1)/src
|
||||
else
|
||||
$(O)/$(1)/$$($(1)_BCFG)/lib$(1).a: $(O)/$(1)/src
|
||||
endif
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -build -type app -name {$(1)}'
|
||||
# Workaround for missing "lib" prefix
|
||||
ifeq ($$($(1)_TYPE),shared)
|
||||
ln -fs $(1).so $(O)/$(1)/$$($(1)_BCFG)/lib$(1).so
|
||||
endif
|
||||
|
||||
GEN_LIBS_DEP += $(O)/$(1)/src
|
||||
ifeq ($$($(1)_TYPE),shared)
|
||||
BLD_LIBS_DEP += $(O)/$(1)/$$($(1)_BCFG)/lib$(1).so
|
||||
else
|
||||
BLD_LIBS_DEP += $(O)/$(1)/$$($(1)_BCFG)/lib$(1).a
|
||||
endif
|
||||
|
||||
# shortcut to build lib, "make <lib>"
|
||||
ifeq ($$($(1)_TYPE),shared)
|
||||
$(1): $(O)/$(1)/$$($(1)_BCFG)/lib$(1).so
|
||||
else
|
||||
$(1): $(O)/$(1)/$$($(1)_BCFG)/lib$(1).a
|
||||
endif
|
||||
.PHONY: $(1)
|
||||
|
||||
$(1)_clean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -clean -type app -name {$(1)}'
|
||||
.PHONY: $(1)_clean
|
||||
|
||||
$(1)_distclean:
|
||||
-$(XSCT) -eval 'setws {$(O)}; \
|
||||
deleteprojects -name {$(1)}'
|
||||
.PHONY: $(1)_distclean
|
||||
endef
|
||||
|
||||
###############################################################################
|
||||
# Targets
|
||||
|
||||
# generate make rules for hardware project, single
|
||||
$(eval $(call gen-hw-rule,$(HW_PRJ),$(HDF)))
|
||||
gethdf: $(HW_PRJ)
|
||||
.PHONY: gethdf
|
||||
|
||||
# generate make rules for bsp projects, multiple
|
||||
$(foreach BSP_PRJ,$(BSP_PRJS),\
|
||||
$(eval $(call gen-bsp-rule,$(BSP_PRJ),$(HW_PRJ))))
|
||||
|
||||
# generate make rules for application projects, multiple
|
||||
$(foreach APP_PRJ,$(APP_PRJS),\
|
||||
$(eval $(call gen-app-rule,$(APP_PRJ),$(HW_PRJ))))
|
||||
|
||||
# generate make rules for library projects, multiple
|
||||
$(foreach LIB_PRJ,$(LIB_PRJS),\
|
||||
$(eval $(call gen-lib-rule,$(LIB_PRJ))))
|
||||
|
||||
# generate make rules for bootgen projects, multiple
|
||||
$(foreach BOOTGEN_PRJ,$(BOOTGEN_PRJS),\
|
||||
$(eval $(call gen-bif-rule,$(BOOTGEN_PRJ))))
|
||||
|
||||
# generate all (app) projects
|
||||
generate: $(GEN_APPS_DEP) $(GEN_BOOTGEN_DEP)
|
||||
.PHONY: generate
|
||||
|
||||
# build all (app) projects
|
||||
build: $(BLD_APPS_DEP) $(BLD_BOOTGEN_DEP)
|
||||
.PHONY: build
|
||||
|
||||
# open workspace in GUI mode
|
||||
xsdk:
|
||||
$(XSDK) -workspace $(O)
|
||||
.PHONY: xsdk
|
||||
|
||||
# clean all projects
|
||||
clean:
|
||||
$(XSCT) -eval 'setws {$(O)}; \
|
||||
projects -clean -type all'
|
||||
.PHONY: clean
|
Loading…
x
Reference in New Issue
Block a user