4 |
# Otherwise we search the build tree, then $PATH. |
# Otherwise we search the build tree, then $PATH. |
5 |
|
|
6 |
proc find_sim { target_alias sim_dir sim_name } { |
proc find_sim { target_alias sim_dir sim_name } { |
7 |
global tool_root_dir; |
global tool_root_dir |
8 |
global SIM |
global SIM |
9 |
|
|
10 |
if [info exists SIM] { |
if [info exists SIM] { |
13 |
|
|
14 |
if [is_remote host] { |
if [is_remote host] { |
15 |
if ![board_info host exists no_transform_name] { |
if ![board_info host exists no_transform_name] { |
16 |
return ${target_alias}-${sim_name}; |
return ${target_alias}-${sim_name} |
17 |
} else { |
} else { |
18 |
return ${sim_name}; |
return ${sim_name} |
19 |
} |
} |
20 |
} |
} |
21 |
|
|
22 |
# We have to search because tool_root_dir may actually point to that blasted |
# We have to search because tool_root_dir may actually point to that blasted |
23 |
# "target" subdirectory. |
# "target" subdirectory. |
24 |
set try [lookfor_file ${tool_root_dir} sim/${sim_dir}/${sim_name}]; |
set try [lookfor_file ${tool_root_dir} sim/${sim_dir}/${sim_name}] |
25 |
if { $try != "" } { |
if { $try != "" } { |
26 |
return $try; |
return $try |
27 |
} |
} |
28 |
return ${target_alias}-${sim_name}; |
return ${target_alias}-${sim_name} |
29 |
} |
} |
30 |
|
|
31 |
proc setup_sim { subdir_name } { |
proc setup_sim { subdir_name } { |
32 |
global target_alias; |
global target_alias |
33 |
global tool_root_dir; |
global tool_root_dir |
34 |
global board; |
global board |
35 |
|
|
36 |
if [info exists target_alias] { |
if [info exists target_alias] { |
37 |
set tmp $target_alias; |
set tmp $target_alias |
38 |
} else { |
} else { |
39 |
if [board_info $board exists target_install] { |
if [board_info $board exists target_install] { |
40 |
set tmp [lindex [board_info $board target_install] 0]; |
set tmp [lindex [board_info $board target_install] 0] |
41 |
} |
} |
42 |
} |
} |
43 |
|
|
44 |
if ![board_info $board exists sim] { |
if ![board_info $board exists sim] { |
45 |
set_board_info sim [find_sim $tmp $subdir_name run]; |
set_board_info sim [find_sim $tmp $subdir_name run] |
46 |
} |
} |
47 |
|
|
48 |
verbose "Using simulator [board_info $board sim]\n" |
verbose "Using simulator [board_info $board sim]\n" |
49 |
} |
} |
50 |
|
|
51 |
set_board_info is_simulator 1; |
set_board_info is_simulator 1 |