📄 uclinux_v2_1_0.tcl
字号:
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"# SOLELY FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR# XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION# AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION# OR STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS# IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,# AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE# FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY# WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE# IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR# REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF# INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS# FOR A PARTICULAR PURPOSE.# # (c) Copyright 2004 Xilinx, Inc.# All rights reserved.# Known limitations:# Globalsset drvlist [list]array set periph_count {}array set override_array {}proc uclinux_drc {os_handle} { puts "\#--------------------------------------" puts "\# uClinux BSP DRC...!" puts "\#--------------------------------------"}proc process_core_override_list {os_handle} { global override_array puts "Hello from process_core_override" # Was a core_overrides parameter specified in the OS section? set overrides [xget_sw_parameter_value $os_handle "periph_type_overrides"] if {[string match $overrides ""]} { return } puts "Parsing override string:$overrides" # Now parse this string, saving results into a global array foreach override $overrides { set instance [string toupper [lindex $override 0]] set new_type [string toupper [lindex $override 1]] puts "Overriding $instance to $new_type" set override_array($instance) $new_type }}proc generate {os_handle} { variable drvlist puts "\#--------------------------------------" puts "\# uClinux BSP generate..." puts "\#--------------------------------------" # open the config file set config_file_name "auto-config.in" set config_file [open $config_file_name w] # print the xilinx header #set desc "uClinux Configuration File" xprint_header $config_file puts $config_file "" # get software processor handle # This call returns the current processor handle for which libgen # algorithm is being run set proc_handle [xget_libgen_proc_handle] # output memory configuration data do_memory_setup $config_file $os_handle "MAIN_MEMORY" CONFIG_XILINX_ERAM do_memory_setup $config_file $os_handle "FLASH_MEMORY" CONFIG_XILINX_FLASH do_memory_setup $config_file $os_handle "LMB_MEMORY" CONFIG_XILINX_LMB process_core_override_list $os_handle # print processor related params xprint_processor_params $config_file $proc_handle # Get list of drivers of peripherals connected to the processor set drvlist [xget_handle $proc_handle "DRIVER" "*"] puts "drvlist : $drvlist" # print the device params xprint_device_params $config_file # now duplicate much of the stuff from the standalone BSP - so # we can build the bootloader in-place set need_config_file "false" # Copy over the right set of files as src based on processor type set sw_proc_handle [xget_libgen_proc_handle] set hw_proc_handle [xget_handle $sw_proc_handle "IPINST"] set proctype [xget_value $hw_proc_handle "OPTION" "IPNAME"] # proctype should be "microblaze" set mbsrcdir "./src/microblaze" switch $proctype { "microblaze" { set procver [xget_value $hw_proc_handle "PARAMETER" "HW_VER"] foreach entry [glob -nocomplain [file join $mbsrcdir *]] { if { [string first "Makefile_old" $entry] != -1 } { if { [string compare -nocase $procver "3.00.a"] } { ;# Copy over Makefile_old only for non- v3.00.a cores file copy -force $entry [file join "." "src" "Makefile"] } } elseif {[string first "Makefile_new" $entry] != -1} { if {![string compare -nocase $procver "3.00.a"] } { ;# Copy over Makefile_new only for v3.00.a file copy -force $entry [file join "." "src" "Makefile"] } } else { if { [string first "exception" $entry] == -1 || ![string compare -nocase $procver "3.00.a"] } { # Copy over only files that are not related to exception handling. All such files have exception in their names file copy -force $entry "./src/" } } } set need_config_file "true" } "default" {puts"unsupported processor type $proctype\n"} } file delete -force $mbsrcdir # handle the stdout and stdin params, for the bootloader xhandle_stdout $os_handle xhandle_stdin $os_handle # close the file... close $config_file}################################################### procedure post_generate# This copies the auto-config.in file into the kernel tree# if required##################################################proc post_generate {lib_handle} { set config_file_name "auto-config.in" set value [xget_value $lib_handle "PARAMETER" TARGET_DIR] puts "TARGET_DIR : $value" if {$value != ""} { if {[file isdirectory $value] == 0} { exec bash -c "mkdir -p $value" } exec bash -c "cp $config_file_name $value" }}proc do_memory_setup {config_file os_handle param_prefix config_prefix} { # print system memory set proc_handle [xget_libgen_proc_handle] set mem [xget_sw_parameter_value $os_handle $param_prefix] # Did MSS file specify a memory? if {[string match "" $mem]} { puts "WARNING: No ${param_prefix} specified" return; } set mem_bank [xget_sw_parameter_value $os_handle "${param_prefix}_BANK"] set mem_handle [xget_sw_ipinst_handle_from_processor $proc_handle $mem] # Was it a valid instance? if {[string match $mem_handle ""]} { puts "ERROR: $param_prefix instance $mem not found" return; } # Check for banked vs direct memory core if {$mem_bank == -1 || [string match $mem_bank ""]} { set base_param_name "C_BASEADDR" set high_param_name "C_HIGHADDR" } else { set base_param_name [format "C_MEM%i_BASEADDR" $mem_bank] set high_param_name [format "C_MEM%i_HIGHADDR" $mem_bank] } # Process memory core parameters set mem_start [xget_sw_parameter_value $mem_handle $base_param_name] set mem_end [xget_sw_parameter_value $mem_handle $high_param_name] # remove any embedded underscore characters set mem_start [string map {"_" ""} $mem_start] set mem_end [string map {"_" ""} $mem_end] # Check for manual override of memory region size set mem_size_override [xget_sw_parameter_value $os_handle "${param_prefix}_SIZE"] if {$mem_size_override==0 || [string match $mem_size_override ""]} { puts "No override specified for ${param_prefix}" set mem_size [expr $mem_end - $mem_start + 1] } else { puts "Override specified for ${param_prefix}:$mem_size_override" set mem_size $mem_size_override } # Format start_addr and size as hex strings set mem_start [format "0x%08x" $mem_start] set mem_size [format "0x%08x" $mem_size] # Generate config file entries puts $config_file "\# $param_prefix Settings" puts $config_file "define_hex ${config_prefix}_START $mem_start" puts $config_file "define_hex ${config_prefix}_SIZE $mem_size" puts $config_file ""} proc xprint_processor_params {config_file proc_handle} { # print system clock set sys_clock [xget_sw_parameter_value $proc_handle "CORE_CLOCK_FREQ_HZ"] puts $config_file "\# System Clock Frequency" puts $config_file "define_int CONFIG_XILINX_CPU_CLOCK_FREQ $sys_clock" puts $config_file "" # print microblaze params set hwproc_handle [xget_handle $proc_handle "IPINST"] set args [xget_hw_parameter_handle $hwproc_handle "*"] set proc_string "MICROBLAZE0" xprint_params $config_file $proc_string $args puts $config_file ""}proc xprint_device_params {config_file} { variable drvlist global periph_count foreach drv $drvlist { xprint_drv_param $config_file $drv } # Output peripheral counts puts $config_file "\# Peripheral counts" foreach p [array names periph_count] { set format_str "define_int CONFIG_XILINX_%s_NUM_INSTANCES %i" puts $config_file [format $format_str $p $periph_count($p)] } puts $config_file ""}# Returns list in form of { {irq_num portname} {irq_num portname} ...}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -