1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
diff -urPN nios2-linux-test-dm/linux-2.6/arch/nios2/Makefile nios2-linux/linux-2.6/arch/nios2/Makefile
--- nios2-linux-test-dm/linux-2.6/arch/nios2/Makefile 2009-07-30 10:27:19.000000000 +0000
+++ nios2-linux/linux-2.6/arch/nios2/Makefile 2009-08-17 15:07:40.000000000 +0000
@@ -134,7 +134,8 @@
mkdir -p $(dir $(objtree)/$(HARDWARE_MK)); \
perl -I$(TOPDIR)/arch/$(ARCH)/scripts \
$(srctree)/arch/$(ARCH)/scripts/hwselect.pl $(SYSPTF) \
- $(objtree)/$(HARDWARE_MK)
+ $(objtree)/$(HARDWARE_MK) \
+ $(CPU_SELECTION) $(MEM_SELECTION)
endef
.PHONY: hwselect
diff -urPN nios2-linux-test-dm/linux-2.6/arch/nios2/scripts/hwselect.pl nios2-linux/linux-2.6/arch/nios2/scripts/hwselect.pl
--- nios2-linux-test-dm/linux-2.6/arch/nios2/scripts/hwselect.pl 2009-07-30 10:27:19.000000000 +0000
+++ nios2-linux/linux-2.6/arch/nios2/scripts/hwselect.pl 2009-08-17 15:05:45.000000000 +0000
@@ -14,6 +14,10 @@
my $index;
my $system;
+my $cpu_selection;
+my $cpu_index = -1;
+my $mem_selected;
+my $mem_index = -1;
#
# Subroutine: Prompt user for an answer
#
@@ -36,8 +40,12 @@
#
# Check for correct number of args
#
-
-if (scalar (@ARGV) != 2) {
+if (scalar (@ARGV) == 4) {
+ $ptf_filename = $ARGV[0];
+ $target_filename = $ARGV[1];
+ $cpu_index = $ARGV[2];
+ $mem_index = $ARGV[3];
+} elsif (scalar (@ARGV) != 2) {
print STDERR "ERROR: Invalid number of parameters.\n";
exit;
} else {
@@ -67,27 +75,37 @@
# Grab listing of Nios II processors and force user to select one:
#
-print "\n--- Please select which CPU you wish to build the kernel against:\n\n";
-
my @cpulist = $system->getCPUList ('altera_nios2');
-my %cpuinfo;
-
-$index = 1;
-foreach my $cpu (@cpulist) {
- my $cpu_module = $system->getCPU ($cpu);
- if ($cpu_module->isEnabled ()) {
- my $class = $cpu_module->getClass();
- my $type = $cpu_module->getWSAAssignment('cpu_selection');
- my $version = $cpu_module->getVersion();
-
- print "($index) $cpu - Class: $class Type: $type Version: $version\n";
+if( scalar(@cpulist) == 1 )
+{
+# Only one CPU to choose from...
+ $cpu_index = 1;
+}
+if (($cpu_index <= 0) || ($cpu_index > scalar(@cpulist))) {
+ print "\n--- Please select which CPU you wish to build the kernel against:\n\n";
+
+ my %cpuinfo;
+
+ $index = 1;
+ foreach my $cpu (@cpulist) {
+ my $cpu_module = $system->getCPU ($cpu);
+ if ($cpu_module->isEnabled ()) {
+ my $class = $cpu_module->getClass();
+ my $type = $cpu_module->getWSAAssignment('cpu_selection');
+ my $version = $cpu_module->getVersion();
+
+ print "($index) $cpu - Class: $class Type: $type Version: $version\n";
+ }
+ $index += 1;
}
- $index += 1;
-}
-print "\n";
+ print "\n";
-my $cpu_selection = $cpulist[request_answer (1, $index - 1) - 1];
+ $cpu_selection = $cpulist[request_answer (1, $index - 1) - 1];
+} else {
+ $cpu_selection = $cpulist[($cpu_index-1)];
+ print "Selected ($cpu_index) $cpu_selection as the main CPU";
+}
#
# Grab list of memory devices that $cpu_selection is hooked up to:
@@ -109,6 +127,7 @@
#
# Select program memory to execute kernel from:
#
+
print "\n--- Please select a device to execute kernel from:\n\n";
$index = 1;
@@ -119,7 +138,13 @@
}
my @memlist = keys (%meminfo);
-my $mem_selected = $memlist[request_answer (1, $index - 1) - 1];
+if( scalar(@memlist) == 1)
+{
+ $mem_index = 1;
+} elsif (($mem_index <= 0) || ($mem_index > scalar(@memlist))) {
+ $mem_index = request_answer (1, $index -1);
+}
+$mem_selected = $memlist[$mem_index - 1];
print "\n--- Summary using\n\n";
print "PTF: $ptf_filename\n";
|