From 10427d6ed4387ec1804c0838626bd733cb473cd6 Mon Sep 17 00:00:00 2001 From: Villyam Date: Fri, 13 Dec 2024 13:27:27 +0200 Subject: [PATCH] projects/scripts: Updating project and make scripts. Updating .gitignore Signed-off-by: Villyam --- .gitignore | 5 ++ projects/scripts/adi_project_lattice.tcl | 20 ++--- projects/scripts/adi_project_lattice_pb.tcl | 8 +- projects/scripts/project-lattice.mk | 81 ++++++++------------- 4 files changed, 51 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index de32717987..5229e4aba3 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,8 @@ _build library/**/.lock library/**/interfaces/*.sv .backstage_yaml +.setting.ini +MachXO3D_Template01 +ipcfg +_bld +radiantc.* diff --git a/projects/scripts/adi_project_lattice.tcl b/projects/scripts/adi_project_lattice.tcl index 345ff63995..7fca312d9a 100644 --- a/projects/scripts/adi_project_lattice.tcl +++ b/projects/scripts/adi_project_lattice.tcl @@ -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 "" \ @@ -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 "" \ @@ -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] @@ -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] @@ -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] } ############################################################################### @@ -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" \ @@ -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) diff --git a/projects/scripts/adi_project_lattice_pb.tcl b/projects/scripts/adi_project_lattice_pb.tcl index 149d2227c9..1737929c4b 100644 --- a/projects/scripts/adi_project_lattice_pb.tcl +++ b/projects/scripts/adi_project_lattice_pb.tcl @@ -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 "" \ @@ -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 "" \ @@ -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 \ diff --git a/projects/scripts/project-lattice.mk b/projects/scripts/project-lattice.mk index 619c916b84..2bb8660a69 100644 --- a/projects/scripts/project-lattice.mk +++ b/projects/scripts/project-lattice.mk @@ -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 folder from -# // 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 // -# folder ralated to Radiant project except the -# // 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, @@ -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) @@ -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 @@ -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)"; \ @@ -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, \ @@ -155,4 +135,3 @@ rd-force: $(RADIANT) system_project.tcl, \ $(PROJECT_NAME)_radiant.log, \ $(HL)$(PROJECT_NAME)$(NC) project) -