⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ucos-ii_v2_1_0.tcl

📁 xilinx内嵌CPU下的UCOS移植
💻 TCL
📖 第 1 页 / 共 4 页
字号:
		  		  puts $probe_config_file "                                         /* ---------- Configure Statistics and Counters --------------- */"		  set com_stat_en [xget_value $ucos_handle "PARAMETER" "PROBE_COM_CFG_STAT_EN"]		  puts $probe_config_file [format "#define PROBE_COM_CFG_STAT_EN          %s \n\n" $com_stat_en]		  		  puts $probe_config_file "                                         /* --------- Configure RS-232 Specific Parameters ------------- */"		  set rs232_parse_task [xget_value $ucos_handle "PARAMETER" "PROBE_RS232_CFG_PARSE_TASK_EN"]		  if {$rs232_parse_task == "true"} {		      puts $probe_config_file "#define  PROBE_RS232_CFG_PARSE_TASK_EN  DEF_TRUE\n"				set rs232_task_prio [xget_value $ucos_handle "PARAMETER" "PROBE_RS232_CFG_TASK_PRIO"]				puts $probe_config_file [format "#define  PROBE_RS232_CFG_TASK_PRIO    %s \n" $rs232_task_prio]				set rs232_task_stk_size [xget_value $ucos_handle "PARAMETER" "PROBE_RS232_CFG_TASK_STK_SIZE"]				puts $probe_config_file [format "#define  PROBE_RS232_CFG_TASK_STK_SIZE  %s \n\n" $rs232_task_stk_size]		  } else {			   puts $probe_config_file "#define  PROBE_RS232_CFG_PARSE_TASK_EN  DEF_TRUE\n"		  }		  puts $probe_config_file "#define  PROBE_RS232_CFG_RX_BUF_SIZE  PROBE_COM_CFG_RX_MAX_SIZE"		  puts $probe_config_file "#define  PROBE_RS232_CFG_TX_BUF_SIZE  PROBE_COM_CFG_TX_MAX_SIZE\n"		  		  puts $probe_config_file "#define  PROBE_RS232_CFG_COMM_SEL  0\n"		  		  set probe_com_cfg_wr_req_en  [xget_value $ucos_handle "PARAMETER" "PROBE_COM_CFG_WR_REQ_EN"]		  if {$probe_com_cfg_wr_req_en == "true"} {			puts $probe_config_file "#define  PROBE_COM_CFG_WR_REQ_EN          DEF_ENABLED\n"		  } else {			puts $probe_config_file "#define  PROBE_COM_CFG_WR_REQ_EN          DEF_DISABLED\n"		  }		  		   set probe_com_cfg_terminal_req_en  [xget_value $ucos_handle "PARAMETER" "PROBE_COM_CFG_TERMINAL_REQ_EN"]		  if {$probe_com_cfg_terminal_req_en == "true"} {			puts $probe_config_file "#define  PROBE_COM_CFG_TERMINAL_REQ_EN          DEF_ENABLED\n"		  } else {			puts $probe_config_file "#define  PROBE_COM_CFG_TERMINAL_REQ_EN          DEF_DISABLED\n"		  }		  		    set probe_com_cfg_str_req_en  [xget_value $ucos_handle "PARAMETER" "PROBE_COM_CFG_STR_REQ_EN"]		  if {$probe_com_cfg_str_req_en == "true"} {			puts $probe_config_file "#define  PROBE_COM_CFG_STR_REQ_EN          DEF_ENABLED\n"		  } else {			puts $probe_config_file "#define  PROBE_COM_CFG_STR_REQ_EN          DEF_DISABLED\n"		  }		          close $probe_config_file        file copy -force $probe_filename ../../include/	     }	 }# --------------------------------------# Tcl procedure post_generate## This proc removes _interrupt_handler.o# from libxil.a# --------------------------------------proc post_generate {os_handle} {        set sw_proc_handle [xget_libgen_proc_handle]    set hw_proc_handle [xget_handle $sw_proc_handle "IPINST"]    set procname [xget_value $hw_proc_handle "NAME"]    set proctype [xget_value $hw_proc_handle "OPTION" "IPNAME"]    if {[string compare -nocase $proctype "microblaze"] == 0} { 	set procdrv [xget_sw_driver_handle_for_ipinst $sw_proc_handle $procname]	# Remove _interrupt_handler.o from libxil.a for mb-gcc	set archiver [xget_value $procdrv "PARAMETER" "archiver"]	exec bash -c "$archiver -d ../../lib/libxil.a _interrupt_handler.o"	        # Remove _hw_exception_handler.o from libxil.a for microblaze_v3_00_a        set procver [xget_value $hw_proc_handle "PARAMETER" "HW_VER"]        if {[mb_has_exceptions $hw_proc_handle]} {            exec bash -c "$archiver -d ../../lib/libxil.a _hw_exception_handler.o"        }    }}# --------------------------------------# Return true if this MB has # exception handling support# --------------------------------------proc mb_has_exceptions { hw_proc_handle } {       # Check if the following parameters exist on this MicroBlaze's MPD    set ee [xget_value $hw_proc_handle "PARAMETER" "C_UNALIGNED_EXCEPTIONS"]    if { $ee != "" } {        return true    }    set ee [xget_value $hw_proc_handle "PARAMETER" "C_ILL_OPCODE_EXCEPTION"]    if { $ee != "" } {        return true    }    set ee [xget_value $hw_proc_handle "PARAMETER" "C_IOPB_BUS_EXCEPTION"]    if { $ee != "" } {        return true    }    set ee [xget_value $hw_proc_handle "PARAMETER" "C_DOPB_BUS_EXCEPTION"]    if { $ee != "" } {        return true    }    set ee [xget_value $hw_proc_handle "PARAMETER" "C_DIV_BY_ZERO_EXCEPTION"]    if { $ee != "" } {        return true    }     set ee [xget_value $hw_proc_handle "PARAMETER" "C_DIV_ZERO_EXCEPTION"]    if { $ee != "" } {        return true    }     set ee [xget_value $hw_proc_handle "PARAMETER" "C_FPU_EXCEPTION"]    if { $ee != "" } {        return true    }     set ee [xget_value $hw_proc_handle "PARAMETER" "C_FSL_EXCEPTION"]    if { $ee != "" } {        return true    }     set ee [xget_value $hw_proc_handle "PARAMETER" "C_USE_MMU"]    if { $ee != ""} {        return true    }     return false}# --------------------------------------# Return true if this MB has # FPU exception handling support# --------------------------------------proc mb_has_fpu_exceptions { hw_proc_handle } {        # Check if the following parameters exist on this MicroBlaze's MPD    set ee [xget_value $hw_proc_handle "PARAMETER" "C_FPU_EXCEPTION"]    if { $ee != "" } {        return true    }     return false}# --------------------------------------# Return true if this MB has PVR support# --------------------------------------proc mb_has_pvr { hw_proc_handle } {        # Check if the following parameters exist on this MicroBlaze's MPD    set pvr [xget_value $hw_proc_handle "PARAMETER" "C_PVR"]    if { $pvr != "" } {        return true    }     return false}# --------------------------------------# Return true if MB ver 'procver' has # support for handling exceptions in # delay slots# --------------------------------------proc mb_can_handle_exceptions_in_delay_slots { procver } {        if { [string compare -nocase $procver "5.00.a"] >= 0 } {        return true    } else {        return false    }}# --------------------------------------# Generate Profile Configuration# --------------------------------------proc handle_profile { os_handle proctype } {    global env    set proc [xget_processor]    set cpu_freq [xget_value $proc "PARAMETER" "CORE_CLOCK_FREQ_HZ"]    if { [string compare -nocase $cpu_freq ""] == 0 } {	puts "WARNING<profile> :: CPU Clk Frequency not specified, Assuming 100Mhz"	set cpu_freq 100000000    }    set filename [file join "src" "profile" "profile_config.h"]         file delete -force $filename    set config_file [open $filename w]    xprint_generated_header $config_file "Profiling Configuration parameters"    puts $config_file "#ifndef _PROFILE_CONFIG_H"    puts $config_file "#define _PROFILE_CONFIG_H\n"        puts $config_file "#define BINSIZE 4"    puts $config_file "#define CPU_FREQ_HZ $cpu_freq"    puts $config_file "#define SAMPLE_FREQ_HZ 100000"    puts $config_file "#define TIMER_CLK_TICKS [expr $cpu_freq / 100000]"        # proctype should be "microblaze" or "ppc405" or "ppc405_virtex4"    switch $proctype {	"microblaze" { 	    # Microblaze Processor.	    puts $config_file "#define PROC_MICROBLAZE 1"	    set timer_inst [xget_value $os_handle "PARAMETER" "profile_timer"]	    if { [string compare -nocase $timer_inst "none"] == 0 } {		# Profile Timer Not Selected		error "ERROR :: Timer for Profiling NOT selected.\nS/W Intrusive Profiling on MicroBlaze requires an xps_timer or an opb_timer." "" "mdt_error"	    } else {		handle_profile_opbtimer $config_file $timer_inst	    }	}	"ppc405"  	-	"ppc405_virtex4" {	    # PowerPC Processor	    # - PIT Timer is used for Profiling by default	    puts $config_file "#define PROC_PPC 1"	    set timer_inst [xget_value $os_handle "PARAMETER" "profile_timer"]	    if { [string compare -nocase $timer_inst "none"] == 0 } {		# PIT Timer		puts $config_file "#define PPC_PIT_INTERRUPT 1"		puts $config_file "#define ENABLE_SYS_INTR 1"	    } else {		handle_profile_opbtimer $config_file $timer_inst	    }	}	"default" {error "unknown processor type\n"}    }    puts $config_file "\n#endif"    puts $config_file "\n/******************************************************************/\n"    close $config_file}# - The opb_timer can be connected directly to Microblaze External Intr Pin.# - (OR) opb_timer can be connected to opb_intcproc handle_profile_opbtimer { config_file timer_inst } {    set timer_handle [xget_hwhandle $timer_inst]    set timer_baseaddr [xget_value $timer_handle "PARAMETER" "C_BASEADDR"]    puts $config_file "#define PROFILE_TIMER_BASEADDR [xformat_addr_string $timer_baseaddr "C_BASEADDR"]"    # Figure out how Timer is connected.    set timer_intr [xget_value $timer_handle "PORT" "Interrupt"]    if { [string compare -nocase $timer_intr ""] == 0 } {	error "ERROR<profile> :: Timer Interrupt PORT is not specified" "" "mdt_error"    }     set mhs_handle [xget_handle $timer_handle "parent"]    # CR 302300 - There can be multiple "sink" for the interrupt. So need to iterate through the list    set intr_port_list [xget_connected_ports_handle $mhs_handle $timer_intr "sink"]    set timer_connection 0    foreach intr_port $intr_port_list {	set intc_handle [xget_handle $intr_port "parent"]	# Check if the Sink is a Global Port. If so, Skip the Port Connection	if { $intc_handle == $mhs_handle } {	    continue 	}	set iptype [xget_value $intc_handle "OPTION" "IPTYPE"]	if { [string compare -nocase $iptype "PROCESSOR"] == 0 } {	    # Timer Directly Connected to the Processor	    puts $config_file "#define ENABLE_SYS_INTR 1"	    set timer_connection 1	    break	}	set ipsptype [xget_value $intc_handle "OPTION" "SPECIAL"]	if { [string compare -nocase $iptype "PERIPHERAL"] == 0  &&	     [string compare -nocase $ipsptype "INTERRUPT_CONTROLLER"] == 0 } {	    # Timer connected to Interrupt controller	    puts $config_file "#define TIMER_CONNECT_INTC 1"	    puts $config_file "#define INTC_BASEADDR [xget_value $intc_handle "PARAMETER" "C_BASEADDR"]"	    set num_intr_inputs [xget_value $intc_handle "PARAMETER" "C_NUM_INTR_INPUTS"]	    if { $num_intr_inputs == 1 } {		puts $config_file "#define ENABLE_SYS_INTR 1"	    }	    set signals [split [xget_value $intr_port "VALUE"] "&"]	    set i 1	    foreach signal $signals {		set signal [string trim $signal]		if {[string compare -nocase $signal $timer_intr] == 0} {		    set timer_id [expr ($num_intr_inputs - $i)]		    set timer_mask [expr 0x1 << $timer_id]		    puts $config_file "#define PROFILE_TIMER_INTR_ID $timer_id"		    puts $config_file "#define PROFILE_TIMER_INTR_MASK [format "0x%x" $timer_mask]"		    break		}		incr i	    }	    set timer_connection 1	    break	}     }        if { $timer_connection == 0 } {	error "ERROR<profile> :: Profile Timer Interrupt Signal Not Connected Properly"     }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -