# Analog Devices Blackfin simulator testsuite
+# Set a default CPU to satisfy bfin-elf-gcc requirements. BF537 should work
+# with all standard Blackfin toolchains.
+set CC_FOR_TARGET "[find_gcc] -mcpu=bf537"
sim_init
+unset CC_FOR_TARGET
if [istarget bfin-*-elf] {
# all machines
set all_machs "bfin"
- global objdir
-
- # See if we have a preprocessor available.
- if { [target_compile $srcdir/$subdir/usp.S $objdir/compilercheck.x "preprocess" \
- [list "incdir=$srcdir/$subdir"]] == "" } {
- set has_cpp 1
- } {
- verbose -log "Can't execute preprocessor"
- set has_cpp 0
- }
-
- # See if we have a compiler available.
- if { [target_compile $srcdir/$subdir/argc.c $objdir/compilercheck.x "executable" \
- [list "incdir=$srcdir/$subdir" "additional_flags=-msim"]] == "" } {
- set has_cc 1
- } {
- verbose -log "Can't execute C compiler"
- set has_cc 0
- }
-
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.\[csS\]]] {
- # If we don't have a compiler available, skip tests :(.
- if { $has_cpp == 0 && [string match "*.S" $src] } {
- untested $src
- continue
- }
- if { $has_cc == 0 && [string match "*.c" $src] } {
- untested $src
- continue
- }
-
# If we're only testing specific files and this isn't one of them,
# skip it.
if ![runtest_file_p $runtests $src] {
}
# Using target_compile, since it is less noisy,
-global objdir
-if { [target_compile $srcdir/$subdir/hello.c $objdir/compilercheck.x \
- "executable" "" ] == "" } {
- set has_cc 1
-
+global global_cc_works
+if { $global_cc_works == 1 } {
# Now check if we can link a program dynamically, and where
# libc.so is located. If it is, we provide a sym link to the
# directory (which must end in /lib) in [pwd], so /lib/ld.so.1 is
# replacing the board ldflags like below as we don't care about
# detrimental effects on the executable from the specs and
# -static in the board ldflags, we just add -Bdynamic.
+ global objdir
if [regexp "(.*/lib)/libc.so" \
- [target_compile $srcdir/$subdir/hello.c $objdir/compilercheck.x \
+ [target_compile $srcdir/lib/compilercheck.c $objdir/compilercheck.x \
"executable" \
"ldflags=-print-file-name=libc.so -Wl,-Bdynamic"] \
xxx libcsodir] {
verbose -log "Creating link to $libcsodir in [pwd]"
file link lib $libcsodir
}
-} {
- verbose -log "Can't execute C compiler"
- set has_cc 0
+ file delete $objdir/compilercheck.x
}
# Like istarget, except take a list of targets as a string.
}
# Note absence of CC in results, but don't make a big fuss over it.
- if { $has_cc == 0 } {
+ if { $global_cc_works == 0 } {
untested $testname
continue
}
--- /dev/null
+/* Used by the test harness to verify working compiler & preprocessor. */
+int main()
+{
+ return 0;
+}
# all simulators.
unset_currtarget_info ldscript
+ sim_init_toolchain
+
# Need to return an empty string. This tells dejagnu to *not* re-run us
# with the exact test that we're about to run.
return ""
}
+# Initialize the toolchain settings for this port.
+# Needs to be called once per-port.
+
+proc sim_init_toolchain {} {
+ global objdir
+ global srcdir
+ global global_cpp_works
+ global global_cc_works
+
+ # See if we have a preprocessor available.
+ set result [target_compile $srcdir/lib/compilercheck.c \
+ $objdir/compilercheck.x "preprocess" ""]
+ set global_cpp_works [string equal "" "$result"]
+
+ # See if we have a compiler available.
+ set result [target_compile $srcdir/lib/compilercheck.c \
+ $objdir/compilercheck.x "executable" ""]
+ set global_cc_works [string equal "" "$result"]
+
+ file delete $objdir/compilercheck.x
+}
+
# Print the version of the simulator being tested.
# Required by dejagnu.
global cpu_option
global cpu_option_sep
global SIMFLAGS_FOR_TARGET
+ global global_cpp_works
+ global global_cc_works
if ![file exists $sim_path] {
unsupported "$name: missing simulator $sim_path"
}
if [string match "*.c" $sourcefile] {
+ # If we don't have a compiler available, skip tests :(.
+ if { $global_cc_works == 0 } {
+ untested $subdir/$name
+ return
+ }
+
set comp_output [target_compile $sourcefile $objdir/${name}.x "executable" \
[list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options $c_ld_options $opts(cc,$mach)"]]
set method "compiling/linking"
} else {
if [string match "*.S" $sourcefile] {
+ # If we don't have a preprocessor available, skip tests :(.
+ if { $global_cpp_works == 0 } {
+ untested $subdir/$name
+ return
+ }
+
set comp_output [target_compile $sourcefile $objdir/${name}.o "object" \
[list "incdir=$srcdir/$subdir" "additional_flags=$c_as_options"]]
set method "compiling"