📄 ucos-ii_v2_1_0.tcl
字号:
close $file_handle # Generate xil_malloc.h if required set xil_malloc [xget_value $os_handle "PARAMETER" "need_xil_malloc"] if {[string compare -nocase $xil_malloc "true"] == 0} { xcreate_xil_malloc_config_file } # Create config files for Microblaze exception handling if { $proctype == "microblaze" && [mb_has_exceptions $hw_proc_handle] } { set extable [xget_handle $os_handle "ARRAY" "microblaze_exception_vectors"] xcreate_mb_exc_config_file $extable $os_handle } # Create bspconfig file set bspcfg_fn [file join "src" "bspconfig.h"] file delete $bspcfg_fn set bspcfg_fh [open $bspcfg_fn w] xprint_generated_header $bspcfg_fh "Configurations for Standalone BSP" if { $proctype == "microblaze" && [mb_has_pvr $hw_proc_handle] } { set pvr [xget_value $hw_proc_handle "PARAMETER" "C_PVR"] switch $pvr { "0" { puts $bspcfg_fh "#define MICROBLAZE_PVR_NONE" } "1" { puts $bspcfg_fh "#define MICROBLAZE_PVR_BASIC" } "2" { puts $bspcfg_fh "#define MICROBLAZE_PVR_FULL" } "default" { puts $bspcfg_fh "#define MICROBLAZE_PVR_NONE" } } } else { puts $bspcfg_fh "#define MICROBLAZE_PVR_NONE" } close $bspcfg_fh copy_os_files $os_handle create_os_config_file $os_handle}# -------------------------------------------# Tcl procedure xcreate_mb_exc_config file# -------------------------------------------proc xcreate_mb_exc_config_file {extable os_handle} { set mb_table "MB_ExceptionVectorTable" set filename [file join "src" "microblaze_exceptions_g.c"] set hfilename [file join "src" "microblaze_exceptions_g.h"] file delete $filename file delete $hfilename set config_file [open $filename w] set hconfig_file [open $hfilename w] xprint_generated_header $config_file "Exception Handler Table for MicroBlaze Processor" xprint_generated_header $hconfig_file "Exception Handling Header for MicroBlaze Processor" puts $config_file "#include \"microblaze_exceptions_i.h\"" puts $config_file "#include \"xparameters.h\"" puts $config_file "\n" set sw_proc_handle [xget_libgen_proc_handle] set hw_proc_handle [xget_handle $sw_proc_handle "IPINST"] set procver [xget_value $hw_proc_handle "PARAMETER" "HW_VER"] set interconnect [xget_value $hw_proc_handle "PARAMETER" "C_INTERCONNECT"] if { $interconnect == "" || $interconnect == 0 } { set ibus_ee [xget_value $hw_proc_handle "PARAMETER" "C_IOPB_BUS_EXCEPTION"] set dbus_ee [xget_value $hw_proc_handle "PARAMETER" "C_DOPB_BUS_EXCEPTION"] } else { set ibus_ee [xget_value $hw_proc_handle "PARAMETER" "C_IPLB_BUS_EXCEPTION"] set dbus_ee [xget_value $hw_proc_handle "PARAMETER" "C_DPLB_BUS_EXCEPTION"] } set ill_ee [xget_value $hw_proc_handle "PARAMETER" "C_ILL_OPCODE_EXCEPTION"] set unalign_ee [xget_value $hw_proc_handle "PARAMETER" "C_UNALIGNED_EXCEPTIONS"] set div0_ee [xget_value $hw_proc_handle "PARAMETER" "C_DIV_ZERO_EXCEPTION"] set mmu_ee [xget_value $hw_proc_handle "PARAMETER" "C_USE_MMU"] if { $mmu_ee == "" } { set mmu_ee 0 } set fsl_ee [xget_value $hw_proc_handle "PARAMETER" "C_USE_FSL"] if { $fsl_ee == "" } { set fsl_ee 0 } if { [mb_has_fpu_exceptions $hw_proc_handle] } { set fpu_ee [xget_value $hw_proc_handle "PARAMETER" "C_FPU_EXCEPTION"] } else { set fpu_ee 0 } if { $ibus_ee == 0 && $dbus_ee == 0 && $ill_ee == 0 && $unalign_ee == 0 && $div0_ee == 0 && $fpu_ee == 0 && $mmu_ee == 0 && $fsl_ee == 0} { ;# NO exceptions are enabled close $config_file ;# Do not generate any info in either the header or the C file close $hconfig_file return } puts $hconfig_file "\#define MICROBLAZE_EXCEPTIONS_ENABLED 1" if { [mb_can_handle_exceptions_in_delay_slots $procver] } { puts $hconfig_file "#define MICROBLAZE_CAN_HANDLE_EXCEPTIONS_IN_DELAY_SLOTS" } if { $unalign_ee == 0 } { puts $hconfig_file "\#define NO_UNALIGNED_EXCEPTIONS 1" } if { $ibus_ee == 0 && $dbus_ee == 0 && $ill_ee == 0 && $div0_ee == 0 && $fpu_ee == 0 && $mmu_ee == 0 && $fsl_ee == 0 } { ;# NO other exceptions are enabled puts $hconfig_file "\#define NO_OTHER_EXCEPTIONS 1" } if { $fpu_ee != 0 } { puts $hconfig_file "\#define MICROBLAZE_FP_EXCEPTION_ENABLED 1" set predecode_fpu_exceptions [xget_value $os_handle "PARAMETER" "predecode_fpu_exceptions"] if {$predecode_fpu_exceptions != false } { puts $hconfig_file "\#define MICROBLAZE_FP_EXCEPTION_DECODE 1" } } set elements [xget_handle $extable "ELEMENTS" "*"] set ehlen [llength $elements] # # Put in extern declarations for handlers # puts $config_file "\n/*" puts $config_file "* Extern declarations" puts $config_file "*/\n" # Handle unaligned exception handler specially set entry [lindex $elements 0] set eh [xget_value $entry "PARAMETER" "handler"] if {$eh != "default"} { puts $config_file [format "extern void %s (void *);" $eh] } # Routinely handle other exceptions for {set x 1} {$x < $ehlen} {incr x} { set entry [lindex $elements $x] set eh [xget_value $entry "PARAMETER" "handler"] if {$eh != "XNullHandler"} { puts $config_file [format "extern void %s (void *);" $eh] } } # # Form the exception handler table # puts $config_file "\n/*" puts $config_file "* The exception handler table for microblaze processor" puts $config_file "*/\n" puts $config_file [format "%sEntry %s\[\] =" $mb_table $mb_table] puts $config_file "\{" # Handle FSL exception specially -- even though it is last in the MLD table, # we want to make this the first entry in the actual vector table to correspond # to its ID set entry [lindex $elements 7] set eh [xget_value $entry "PARAMETER" "handler"] set eec [xget_value $entry "PARAMETER" "callback"] puts $config_file "\t\{" puts $config_file [format "\t\t%s," $eh] puts $config_file [format "\t\t(void*) %s" $eec] puts $config_file "\t\}," # Handle unaligned exception specially set entry [lindex $elements 0] set eh [xget_value $entry "PARAMETER" "handler"] set eec [xget_value $entry "PARAMETER" "callback"] if {$eh == "default"} { puts $config_file "\t\{" puts $config_file [format "\t\t%s,\t/* This field (unaligned exceptions) will not be looked up. Instead, the default exception handler will be used automatically. */" "XNullHandler"] puts $config_file [format "\t\t(void*) %s" "NULL"] puts $config_file "\t\}," } else { puts $hconfig_file "\#define USER_SPEC_UNALIGNED_HANDLER" puts $config_file "\t\{" puts $config_file [format "\t\t%s," $eh] puts $config_file [format "\t\t(void*) %s" $eec] puts $config_file "\t\}," } # Routinely handle other exceptions for {set x 1} {$x < [expr $ehlen - 1]} {incr x} { set entry [lindex $elements $x] set eh [xget_value $entry "PARAMETER" "handler"] set eec [xget_value $entry "PARAMETER" "callback"] puts $config_file "\t\{" puts $config_file [format "\t\t%s," $eh] puts $config_file [format "\t\t(void*) %s" $eec] if { $x != [expr $ehlen - 2] } { puts $config_file "\t\}," } else { puts $config_file "\t\}" } } puts $config_file "\n\};" puts $config_file "\n" puts $hconfig_file "\n" close $config_file close $hconfig_file}################################################################################ Tcl procedure xcreate_xil_malloc_config_file###############################################################################proc xcreate_xil_malloc_config_file {} { set filename [file join "src" "xil_malloc.h"] file delete $filename set config_file [open $filename w] xprint_generated_header $config_file "Xilinx Malloc Definition file" puts $config_file "#define malloc xil_malloc" puts $config_file "\n" close $config_file }################################################################################ Tcl procedure copy_os_files###############################################################################proc copy_os_files {ucos_handle} { 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"] set msr_instr [xget_value $hw_proc_handle "PARAMETER" "C_USE_MSR_INSTR"] set source_path [xget_value $ucos_handle "PARAMETER" "OS_SOURCE_LOCATION"] set core_name [file join $source_path os_core.c] set flag_name [file join $source_path os_flag.c] set mbox_name [file join $source_path os_mbox.c] set mem_name [file join $source_path os_mem.c] set mutex_name [file join $source_path os_mutex.c] set q_name [file join $source_path os_q.c] set sem_name [file join $source_path os_sem.c] set task_name [file join $source_path os_task.c] set time_name [file join $source_path os_time.c] set tmr_name [file join $source_path os_tmr.c] set ucosii_name [file join $source_path ucos_ii.h] file copy -force $core_name $flag_name $mbox_name $mem_name $mutex_name $q_name $sem_name $task_name $time_name $tmr_name $ucosii_name ./src/ file copy -force $ucosii_name ../../include/ set port_path [xget_value $ucos_handle "PARAMETER" "OS_PORT_LOCATION"] set dbg_name [file join $port_path os_dbg.c] if { $proctype == "microblaze" } { if { $msr_instr != 1 } { set cpus_name [file join $port_path os_cpu_a.s] } else { set cpus_name [file join $port_path USE_MSR_INSTR/os_cpu_a.s] } } else { set cpus_name [file join $port_path os_cpu_a.S] } set cpuc_name [file join $port_path os_cpu_c.c] set cpuh_name [file join $port_path os_cpu.h] file copy -force $dbg_name $cpus_name $cpuc_name $cpuh_name ./src/ file copy -force $cpuh_name ../../include/ if {[xget_value $ucos_handle "PARAMETER" "PROBE_EN"] == 1} { set uclib_path [xget_value $ucos_handle "PARAMETER" "uCLIB_LOCATION"] set lib_mem [file join $uclib_path lib_mem.c] set lib_str [file join $uclib_path lib_str.c] set lib_memh [file join $uclib_path lib_mem.h] set lib_strh [file join $uclib_path lib_str.h] set lib_def [file join $uclib_path lib_def.h] file copy -force $lib_mem $lib_str $lib_memh $lib_strh $lib_def ./src/ file copy -force $lib_memh $lib_strh $lib_def ../../include/ set uccpu_path [xget_value $ucos_handle "PARAMETER" "uCCPU_LOCATION"] set cpu_def [file join $uccpu_path cpu_def.h] if { $proctype == "microblaze" } { set cpu_h [file join $uccpu_path MicroBlaze/GNU/cpu.h] set cpu_a [file join $uccpu_path MicroBlaze/GNU/cpu_a.s] } else { set cpu_h [file join $uccpu_path PPC405/GNU/cpu.h] set cpu_a [file join $uccpu_path PPC405/GNU/cpu_a.s] } file copy -force $cpu_def $cpu_h $cpu_a ./src/ file copy -force $cpu_def $cpu_h ../../include/ set probe_source [xget_value $ucos_handle "PARAMETER" "PROBE_COM_SOURCE_LOCATION"] set genericc_name [file join $probe_source Communication/Generic/Source/probe_com.c] set generich_name [file join $probe_source Communication/Generic/Source/probe_com.h]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -