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

📄 ucos-ii_v2_1_0.tcl

📁 μC/OS-II and the Xilinx MicroBlaze
💻 TCL
📖 第 1 页 / 共 4 页
字号:
################################################################################
#                             uC/OS-II Tcl File
################################################################################
# uses xillib.tcl
proc ucosii_drc {os_handle} {    puts "uC/OS-II DRC ..."

    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"]


    switch $proctype {	"microblaze" {             set procver [xget_value $hw_proc_handle "PARAMETER" "HW_VER"]            if { [mb_has_exceptions $procver] } {                set extable_handle [xget_handle $os_handle "ARRAY" "microblaze_exception_vectors"]                set elements [xget_handle $extable_handle "ELEMENTS" "*"]                                # UNALIGNED_EXCEPTIONS                set entry [lindex $elements 0]                set ee [xget_value $hw_proc_handle "PARAMETER" "C_UNALIGNED_EXCEPTIONS"]                set eh [xget_value $entry "PARAMETER" "handler"]                if { $ee == 0 && $eh != "default" } {                    error "PARAMETER C_UNALIGNED_EXCEPTIONS is not enabled in Microblaze but a handler is specified in the MSS!" "" "libgen_error"                        }                                # ILLEGAL_OPCODE_EXCEPTION                set entry [lindex $elements 1]                set ee [xget_value $hw_proc_handle "PARAMETER" "C_ILL_OPCODE_EXCEPTION"]                set eh [xget_value $entry "PARAMETER" "handler"]                if { $ee == 0 && $eh != "XNullHandler" } {                    error "PARAMETER C_ILL_OPCODE_EXCEPTION is not enabled in Microblaze but a handler is specified in the MSS!" "" "libgen_error"                        }                                # IOPB_BUS_EXCEPTION                set entry [lindex $elements 2]                set ee [xget_value $hw_proc_handle "PARAMETER" "C_IOPB_BUS_EXCEPTION"]                set eh [xget_value $entry "PARAMETER" "handler"]                if { $ee == 0 && $eh != "XNullHandler" } {                    error "PARAMETER C_IOPB_BUS_EXCEPTION is not enabled in Microblaze but a handler is specified in the MSS!" "" "libgen_error"                        }                                # DOPB_BUS_EXCEPTION                set entry [lindex $elements 3]                set ee [xget_value $hw_proc_handle "PARAMETER" "C_DOPB_BUS_EXCEPTION"]                set eh [xget_value $entry "PARAMETER" "handler"]                if { $ee == 0 && $eh != "XNullHandler" } {                    error "PARAMETER C_DOPB_BUS_EXCEPTION is not enabled in Microblaze but a handler is specified in the MSS!" "" "libgen_error"                        }                                # DIV_ZERO_EXCEPTION                set entry [lindex $elements 4]                set ee [xget_value $hw_proc_handle "PARAMETER" "C_DIV_ZERO_EXCEPTION"]                set eh [xget_value $entry "PARAMETER" "handler"]                if { $ee == 0 && $eh != "XNullHandler" } {                    error "PARAMETER C_DIV_ZERO_EXCEPTION is not enabled in Microblaze but a handler is specified in the MSS!" "" "libgen_error"                        }		                # FPU_EXCEPTION                if { [mb_has_fpu_exceptions $procver] } {                    set entry [lindex $elements 5]                    set ee [xget_value $hw_proc_handle "PARAMETER" "C_FPU_EXCEPTION"]                    set eh [xget_value $entry "PARAMETER" "handler"]                    if { $ee == 0 && $eh != "XNullHandler" } {                        error "PARAMETER C_FPU_EXCEPTION is not enabled in Microblaze but a handler is specified in the MSS!" "" "libgen_error"                            }                }            } 	    	            }        "default" {         }    }

    set source_path [xget_value $os_handle "PARAMETER" "OS_SOURCE_LOCATION"]
    set core_name [file join $source_path os_core.c]
    if {[file exists $core_name] == 0} {
        error "Unable to find uC/OS-II source file, os_core.c" "" "libgen_error" 
    }
    set flag_name [file join $source_path os_flag.c]
    if {[file exists $flag_name] == 0} {
        error "Unable to find uC/OS-II source file, os_flag.c" "" "libgen_error" 
    }
    set mbox_name [file join $source_path os_mbox.c]
    if {[file exists $mbox_name] == 0} {
        error "Unable to find uC/OS-II source file, os_mbox.c" "" "libgen_error" 
    }
    set mem_name [file join $source_path os_mem.c]
    if {[file exists $mem_name] == 0} {
        error "Unable to find uC/OS-II source file, os_mem.c" "" "libgen_error" 
    }
    set mutex_name [file join $source_path os_mutex.c]
    if {[file exists $mutex_name] == 0} {
        error "Unable to find uC/OS-II source file, os_mutex.c" "" "libgen_error" 
    }
    set q_name [file join $source_path os_q.c]
    if {[file exists $q_name] == 0} {
        error "Unable to find uC/OS-II source file, os_q.c" "" "libgen_error" 
    }
    set sem_name [file join $source_path os_sem.c]
    if {[file exists $sem_name] == 0} {
        error "Unable to find uC/OS-II source file, os_sem.c" "" "libgen_error"
    }
    set task_name [file join $source_path os_task.c]
    if {[file exists $task_name] == 0} {
        error "Unable to find uC/OS-II source file, os_task.c" "" "libgen_error"
    }
    set time_name [file join $source_path os_time.c]
    if {[file exists $time_name] == 0} {
        error "Unable to find uC/OS-II source file, os_time.c" "" "libgen_error"
    }
    set tmr_name [file join $source_path os_tmr.c]
    if {[file exists $tmr_name] == 0} {
        error "Unable to find uC/OS-II source file, os_tmr.c" "" "libgen_error"
    }
    set ucosii_name [file join $source_path ucos_ii.h]
    if {[file exists $ucosii_name] == 0} {
       error "Unable to find uC/OS-II header file, ucos_ii.h" "" "libgen_error"
    }

    set port_path [xget_value $os_handle "PARAMETER" "OS_PORT_LOCATION"]
    set dbg_name [file join $port_path os_dbg.c]
    if {[file exists $dbg_name] == 0} {
        error "Unable to find uC/OS-II port file, os_dbg.c" "" "libgen_error"
    }
    if { $proctype == "microblaze" } {
        set cpus_name [file join $port_path os_cpu_a.s]
        if {[file exists $cpus_name] == 0} {
            error "Unable to find uC/OS-II port file, os_cpu_a.s" "" "libgen_error"
        }
    } else {
        set cpus_name [file join $port_path os_cpu_a.S]
        if {[file exists $cpus_name] == 0} {
            error "Unable to find uC/OS-II port file, os_cpu_a.S" "" "libgen_error"
        }
    }
    set cpuc_name [file join $port_path os_cpu_c.c]
    if {[file exists $cpuc_name] == 0} {
        error "Unable to find uC/OS-II port file, os_cpu_c.c" "" "libgen_error"
    }
    set cpuh_name [file join $port_path os_cpu.h]
    if {[file exists $cpuh_name] == 0} {
        error "Unable to find uC/OS-II port file os_cpu.h" "" "libgen_error"
    }

    set bsp_path [xget_value $os_handle "PARAMETER" "BSP_LOCATION"]
    set bspc_name [file join $bsp_path bsp.c]
    if {[file exists $bspc_name] == 0} {
        error "Unable to find bsp file, bsp.c" "" "libgen_error"
    }
    set bsph_name [file join $bsp_path bsp.h]
    if {[file exists $bsph_name] == 0} {
        error "Unable to find bsp file, bsp.h" "" "libgen_error"
    }

    set app_path [xget_value $os_handle "PARAMETER" "APP_LOCATION"]
    set app_cfg_file [file join $app_path app_cfg.h]
    if {[file exists $app_cfg_file] == 0} {
        error "Unable to locate app_cfg.h" "" "libgen_error"
    }
    set include_file [file join $app_path includes.h]
    if {[file exists $include_file] == 0} {
        error "Unable to locate includes.h" "" "libgen_error"
    }

    if {[xget_value $os_handle "PARAMETER" "OS_VIEW_MODULE"] == 1} {
        set view_source [xget_value $os_handle "PARAMETER" "OS_VIEW_SOURCE_LOCATION"]
        
        set sourcec_name [file join $view_source OS_VIEW.c]
        if {[file exists $sourcec_name] == 0} {
            error "Unable to find uC/OS-View source file, OS_VIEW.c" "" "libgen_error"
        }

        set sourceh_name [file join $view_source OS_VIEW.h]
        if {[file exists $sourceh_name] == 0} {
            error "Unable to find uC/OS-View source file, OS_VIEW.h" "" "libgen_error"
        }

        set view_port [xget_value $os_handle "PARAMETER" "OS_VIEW_PORT_LOCATION"]

        set portc_name [file join $view_port OS_VIEWc.c]
        if {[file exists $portc_name] == 0} {
            error "Unable to find uC/OS-View port file, OS_VIEWc.c" "" "libgen_error"
        }

        set porth_name [file join $view_port OS_VIEWc.h]
        if {[file exists $porth_name] == 0} {
            error "Unable to find uC/OS-View port file, OS_VIEWc.h" "" "libgen_error"
        }
    }

    set prochandle [xget_processor]
    set msr_opt [xget_value $prochandle "PARAMETER" "C_USE_MSR_INSTR"]
    if {$msr_opt == 0} {
        puts "WARNING:  C_USE_MSR_INSTR is 0; it must be changed to '1' or the uC/OS-II critical section routines will need to be defined"
     }}

################################################################################                            Tcl procedure generate###############################################################################
proc generate {os_handle} {    global env    # 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"]
    set enable_sw_profile [xget_value $os_handle "PARAMETER" "enable_sw_intrusive_profiling"]    set mb_exceptions false    # proctype should be "microblaze" or "ppc405" or "ppc405_virtex4"    set mbsrcdir "./src/microblaze"    set ppcsrcdir "./src/ppc405"    switch $proctype {	"microblaze" {             set procver [xget_value $hw_proc_handle "PARAMETER" "HW_VER"]            foreach entry [glob -nocomplain [file join $mbsrcdir *]] {		if { [string first "exception" $entry] == -1 || [mb_has_exceptions $procver] } {		    # Copy over only files that are not related to exception handling. All such files have exception in their names

⌨️ 快捷键说明

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