From a6b99bd0bcff5c5e78fa04371b50a4702576eef9 Mon Sep 17 00:00:00 2001 From: Gatsby Van Date: Fri, 1 Nov 2024 00:26:48 +0800 Subject: [PATCH] refactor(platform/xilinx): strengthen parameter validation --- platform/xilinx/util.tcl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/xilinx/util.tcl b/platform/xilinx/util.tcl index 9ab4476..fb12f71 100644 --- a/platform/xilinx/util.tcl +++ b/platform/xilinx/util.tcl @@ -268,6 +268,13 @@ proc _create_app {app_name app_config platform_name is_vitis} { # Configure BSP/Domain for application if {[dict exists $app_config bsp] && [dict get $app_config bsp] ne ""} { set bsp_name [dict get $app_config bsp] + if {![dict exists $::config bsps]} { + _error "BSP configuration missing" "The 'bsps' section is not found in the configuration." + } elseif {![dict exists [dict get $::config bsps] $bsp_name]} { + _error "BSP configuration missing" "No configuration found for BSP '$bsp_name' in the 'bsps' section." + } else { + _info "Configuring BSP '$bsp_name' for application '$app_name'." + } } else { set bsp_config [dict create] set bsp_config [dict set bsp_config target_cpu $cpu] @@ -280,6 +287,7 @@ proc _create_app {app_name app_config platform_name is_vitis} { set bsp_cfg [dict get $app_config bsp_config] set bsp_config [dict merge $bsp_config [dict create config $bsp_cfg]] } + _info "Creating BSP $bsp_name for Application $app_name ..." _configure_bsp $bsp_name $bsp_config $platform_name $is_vitis }