Skip to content

Commit

Permalink
projects/scripts: Updating project and make scripts.
Browse files Browse the repository at this point in the history
Updating .gitignore

Signed-off-by: Villyam <[email protected]>
  • Loading branch information
Villyam committed Dec 16, 2024
1 parent 8d8f438 commit 10427d6
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 63 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@ _build
library/**/.lock
library/**/interfaces/*.sv
.backstage_yaml
.setting.ini
MachXO3D_Template01
ipcfg
_bld
radiantc.*
20 changes: 10 additions & 10 deletions projects/scripts/adi_project_lattice.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ proc adi_project {project_name args} {
puts "\nadi_project:\n"

array set opt [list -dev_select "auto" \
-ppath "./$project_name" \
-ppath "./_bld/$project_name" \
-device "" \
-speed "" \
-board "" \
Expand Down Expand Up @@ -94,7 +94,7 @@ proc adi_project {project_name args} {
proc adi_project_create {project_name args} {
puts "\nadi_project_create:\n"

array set opt [list -ppath "./$project_name" \
array set opt [list -ppath "./_bld/$project_name" \
-device "" \
-performance "" \
-board "" \
Expand Down Expand Up @@ -195,8 +195,8 @@ proc adi_project_files_auto {project_name args} {
puts "\nadi_project_files_auto:\n"

array set opt [list -exts {*.ipx} \
-spath ./$project_name/$project_name/lib \
-ppath "./$project_name" \
-spath ./_bld/$project_name/$project_name/lib \
-ppath "./_bld/$project_name" \
-sdepth "6" \
-opt_args "" \
{*}$args]
Expand Down Expand Up @@ -287,7 +287,7 @@ proc adi_project_files_auto {project_name args} {
proc adi_project_files {project_name args} {
puts "\nadi_project_files:\n"

array set opt [list -ppath "./$project_name" \
array set opt [list -ppath "./_bld/$project_name" \
-flist "" \
-opt_args "" \
{*}$args]
Expand Down Expand Up @@ -374,11 +374,11 @@ proc add_update_constraint_file {pfile project_dir ext radiant_project opt_args}
# Adds the default project files to the Radiant project ($project_name.rdf)
proc adi_project_files_default {project_name} {
adi_project_files_auto $project_name -exts {*.ipx} \
-spath "./$project_name/$project_name/lib" \
-ppath "./$project_name" \
-spath "./_bld/$project_name/$project_name/lib" \
-ppath "./_bld/$project_name" \
-sdepth "6"
adi_project_files $project_name \
-flist [list ./$project_name/$project_name/$project_name.v]
-flist [list ./_bld/$project_name/$project_name/$project_name.v]
}

###############################################################################
Expand Down Expand Up @@ -447,7 +447,7 @@ proc adopt_path {full_path_flist base_to_cut {base_to_add ""}} {
proc adi_project_run {project_name args} {
puts "\nadi_project_run:\n"

array set opt [list -ppath "./$project_name" \
array set opt [list -ppath "./_bld/$project_name" \
-mode "export" \
-impl "impl_1" \
-top "system_top" \
Expand Down Expand Up @@ -516,7 +516,7 @@ proc adi_project_run_cmd {project_name args} {
puts "\nadi_project_run_cmd:\n"
set dir [pwd]

array set opt [list -ppath "./$project_name" -cmd_list "" {*}$args]
array set opt [list -ppath "./_bld/$project_name" -cmd_list "" {*}$args]
set ppath $opt(-ppath)
set cmd_list $opt(-cmd_list)

Expand Down
8 changes: 6 additions & 2 deletions projects/scripts/adi_project_lattice_pb.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ proc adi_project_pb {project_name args} {
set preinst_ip_mod_dir ${env(TOOLRTF)}

array set opt [list -dev_select "auto" \
-ppath "." \
-ppath "./_bld" \
-device "" \
-board "" \
-speed "" \
Expand Down Expand Up @@ -98,7 +98,7 @@ proc adi_project_pb {project_name args} {
proc adi_project_create_pb {project_name args} {
puts "\nadi_project_create_pb:\n"

array set opt [list -ppath "." \
array set opt [list -ppath "./_bld" \
-device "" \
-board "" \
-speed "" \
Expand Down Expand Up @@ -161,6 +161,10 @@ proc adi_project_create_pb {project_name args} {
set preinst_ip_mod_dir ${env(TOOLRTF)}
set propel_builder_project_dir "$ppath/$project_name/$project_name"

if {[file exists $ppath] != 1} {
file mkdir $ppath
}

sbp_create_project -name "$project_name" \
-path $ppath \
-device $device \
Expand Down
81 changes: 30 additions & 51 deletions projects/scripts/project-lattice.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,18 @@
################################################################################
## Make script for building Lattice projects. ##################################
#
# * Make commands: all pb rd rd-force pb-force clean clean-all clean-pb clean-rd.
# * Make commands: all pb rd rd-force pb-force clean clean-all.
#
# * pb: checks if dependencies exist and builds the Propel Builder project.
# (block design)
# * rd: checks for dependencies and builds the Radiant Project
# based on Propel Builder Project.
# * force: you can build the whole project without
# checking for dependencies.
# * pb-force and rd-force: you can build the respective projects without
# checking for dependencies.
# * clean: deletes the whole project and log files.
# * clean-all: deletes all the generated files during build.
# * clean-pb: deletes the Propel Builder project files and directories.
# After this you can rebuild the Propel Builder project separately by
# 'make pb' but only if you created the project without using the '-sbc'
# template file option wich is used in official project creation command,
# because if you create with '-sbc' option the command will not create
# the project becouse the first <project_name> folder from
# <adi_project_folder>/<project_name>/<project_name> is not deleted,
# becouse that contains the Radiant project files. Also deletes the log
# file for Propel Builder project.
# * clean-rd: cleans the content of <adi_project_folder>/<project_name>/
# folder ralated to Radiant project except the
# <adi_project_folder>/<project_name>/<project_name> folder.
# Also deletes the log file for Radiant project.
#
# * Note: The limitation for Propel Builder project is that it does not exit
# with error code no matter if the design was built or failed to,
Expand Down Expand Up @@ -58,7 +47,7 @@ M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_project_lattice_pb.tcl
M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_project_lattice.tcl
M_DEPS += $(HDL_PROJECT_PATH)../scripts/adi_env.tcl
M_DEPS += system_top.v
M_DEPS += $(PROJECT_NAME)/$(PROJECT_NAME)/$(PROJECT_NAME).v
M_DEPS += _bld/$(PROJECT_NAME)/$(PROJECT_NAME)/$(PROJECT_NAME).v
M_DEPS += $(wildcard *system_constr.pdc)
M_DEPS += $(wildcard *system_constr.sdc)

Expand All @@ -77,13 +66,18 @@ R_DEPS_FILTER += %adi_env.tcl
R_DEPS_FILTER += %adi_project_lattice.tcl
R_DEPS_FILTER += %system_project.tcl

PB_TARGETS += $(PROJECT_NAME)/$(PROJECT_NAME)/$(PROJECT_NAME).sbx
PB_TARGETS += $(PROJECT_NAME)/$(PROJECT_NAME)/$(PROJECT_NAME).v
PB_TARGETS += _bld/$(PROJECT_NAME)/$(PROJECT_NAME)/$(PROJECT_NAME).sbx
PB_TARGETS += _bld/$(PROJECT_NAME)/$(PROJECT_NAME)/$(PROJECT_NAME).v

R_TARGETS += _bld/$(PROJECT_NAME)/$(PROJECT_NAME).rdf
R_TARGETS += _bld/$(PROJECT_NAME)/impl_1/$(PROJECT_NAME)_impl_1.bit

R_TARGETS += $(PROJECT_NAME)/$(PROJECT_NAME).rdf
R_TARGETS += $(PROJECT_NAME)/impl_1/$(PROJECT_NAME)_impl_1.bit
CLEAN_TARGET += $(wildcard ./*/)
CLEAN_TARGET += $(wildcard *.log)
CLEAN_TARGET += $(wildcard ./radiantc.*)
CLEAN_TARGET += $(filter-out . .. ./. ./.., $(wildcard .*))

.PHONY: all pb rd rd-force pb-force clean clean-all clean-pb clean-rd
.PHONY: all pb rd force rd-force pb-force clean clean-all

all: pb rd

Expand All @@ -92,41 +86,25 @@ pb: $(PB_TARGETS)
rd: $(R_TARGETS)

clean:
-rm -Rf ${PROJECT_NAME}
-rm -f $(wildcard *.log)
-rm -Rf ./ipcfg
-rm -Rf ./sge
$(call clean, \
$(CLEAN_TARGET), \
$(HL)$(PROJECT_NAME)$(NC) project)

clean-all:
-rm -Rf ${PROJECT_NAME}
-rm -f $(wildcard *.log)
-rm -Rf ./ipcfg
-rm -Rf $(filter-out . .. ./. ./.., $(wildcard .*))
-rm -Rf ./sge

clean-pb:
-rm -Rf $(wildcard $(PROJECT_NAME)/$(PROJECT_NAME)/*)
-rm -f $(PROJECT_NAME)/.socproject
-rm -Rf ./ipcfg
-rm -f $(PROJECT_NAME)_propel_builder.log
-rm -Rf ./sge

clean-rd:
-rm -Rf $(filter-out $(PROJECT_NAME)/$(PROJECT_NAME) \
$(PROJECT_NAME)/.socproject, \
$(wildcard $(PROJECT_NAME)/*))
-rm -Rf $(filter-out $(PROJECT_NAME)/$(PROJECT_NAME) \
$(PROJECT_NAME)/.socproject \
$(PROJECT_NAME)/. \
$(PROJECT_NAME)/.., $(wildcard $(PROJECT_NAME)/.*))
-rm -f $(PROJECT_NAME)_radiant.log
$(call clean, \
$(CLEAN_TARGET), \
$(HL)$(PROJECT_NAME)$(NC) project)

$(PB_TARGETS): $(filter-out $(PB_DEPS_FILTER_OUT),$(filter $(PB_DEPS_FILTER), $(M_DEPS)))
-rm -f $(PROJECT_NAME)_propel_builder.log
$(call skip_if_missing, \
Project, \
$(PROJECT_NAME), \
true, \
rm -Rf $(CLEAN_TARGET) ; \
$(call build, \
$(PROPEL_BUILDER) system_project_pb.tcl, \
$(PROJECT_NAME)_propel_builder.log, \
$(HL)$(PROJECT_NAME)$(NC) project)
$(HL)$(PROJECT_NAME)$(NC) project))
@for file in $(filter $(R_DEPS_FILTER), $(M_DEPS)); do \
if [ ! -f $$file ]; then \
echo "No [$(HL)$$file$(NC)] found. ... $(RED)FAILED$(NC)"; \
Expand All @@ -137,13 +115,15 @@ $(PB_TARGETS): $(filter-out $(PB_DEPS_FILTER_OUT),$(filter $(PB_DEPS_FILTER), $(

$(R_TARGETS): $(filter $(R_DEPS_FILTER), $(M_DEPS))
-rm -f $(PROJECT_NAME)_radiant.log
-rm -f $(PROJECT_NAME)/system_constr.pdc
-rm -f $(PROJECT_NAME)/system_constr.sdc
-rm -f _bld/$(PROJECT_NAME)/system_constr.pdc
-rm -f _bld/$(PROJECT_NAME)/system_constr.sdc
$(call build, \
$(RADIANT) system_project.tcl, \
$(PROJECT_NAME)_radiant.log, \
$(HL)$(PROJECT_NAME)$(NC) project)

force: pb-force rd-force

pb-force:
$(call build, \
$(PROPEL_BUILDER) system_project_pb.tcl, \
Expand All @@ -155,4 +135,3 @@ rd-force:
$(RADIANT) system_project.tcl, \
$(PROJECT_NAME)_radiant.log, \
$(HL)$(PROJECT_NAME)$(NC) project)

0 comments on commit 10427d6

Please sign in to comment.