The purpose of testing the Linux kernel is to ensure each part of the released image, such as the system calls, IPC mechanism, file system, network, device drivers, memory management is stable and robust, so that it can support various applications running well.
To test the Linux kernel, a host system and Blackfin target are required. The host system is where the Linux source code is downloaded and built. The Blackfin target enables tests to be run on the real processor platform ensuring that the Linux kernel image can take control from uboot, initialize the processor and peripherals, and operate the whole system properly. For now, the following types of target boards covered in this test: BF533-STAMP, BF537-STAMP, BF533-EZKIT, BF561-EZKIT, BF548-EZKIT, BF527-EZKIT, BF538-EZKIT,BF526-EZBRD, BF518-EZBRD, BF609-EZKIT. For the detailed coverage info, see Linux_test_coverage.
Besides, in current release there are two versions of toolchain released, and each of it support compiling both elf and flat format applications. As a result, four kinds of kernel image could be generated in the host environment of Suse linux, flat format image by 4.1 toolchain, flat format image by 4.3 toolchain, elf format image by 4.1 toolchain, elf format image by 4.3 toolchain. Also it needs to test the linux image built in the host environment of COLINUX.
The tests below would been carried out on kernel built by either 4.1 or 4.3 toolchain with various kernel configuration(flat format application). As to the elf toolchain, since the format just referrs to applications, only application related testcases would be executed. And there is also some difference for certain cases to run on different boards, the following part would describe in detailed ways.
In order to secure the kernel performance at all the working frequencies, the Linux kernel testing is needed to take at various system clock and core clock. The working range for the boards is about 30~120Mhz System Clock and 30~600Mhz Core Clock.
The Linux Test Project(LTP) is a collection of tools for testing the Linux kernel and related features with a goal to deliver test suites to the open source community that validate the reliability, robustness, and stability of Linux. It helps to improve the Linux kernel by bringing test automation to the kernel testing effort. And its test covers almost all the parts of Linux, such as system calls, file system, device driver, IPC, memory managent, and timer, etc. For detailed information on LTP project, refer to the LTP page.
Since the LTP project is intented for desktop linux system, which has some difference from the Linux system here. It is required to port this project to make it run. So far, the system call, pthread and file system test cases are adopted in this test, approximately about 600 cases. The LTP testing is carried out on the RAM system of the target board, while the testcases are stored on host machine and transferred to the target by rcp in the process of testing. In this way, we can possible to test on the target that has no big SDRAM, for the whole size of the test cases can total to about 40M. In the end, there is a summary log tells the number and the names of passed cases, failed cases, the warning, broken, crashing ones and which is not run.
You can get LTP source code from LTP website or get from our Linux svn. There are several versions of ltp source code in svn. Please checkout out the latested one.
svn ls svn://firewall-sources.blackfin.uclinux.org:80/svn/ltp/trunk svn co svn://firewall-sources.blackfin.uclinux.org:80/svn/ltp/trunk/ltp-full-20071031 ltp-full-20071031
Enter the folder named ltp, there is a prog directory which is ported for our blackfin testing.
cd ltp-full-20071031/ make uclinux make uclinux_install
All these steps to run the cases are automated into an expect script, ltp_auto_test.exp which can keep the ltp test cases always running. For certain cases would sometimes crash the kernel and put the target board out of order, there is a wire connection to restart from the host parallel port 2.
By default, we run LTP test cases under /home/test/work/cruise/checkouts/uclinux-dist/testsuites/ltp folder. You need to specify your test running directories before execution the script and make sure a usable toolchain path is exported to environment variable $PATH. Run the following script to go through all the ltp testcases:
echo $PATH /opt/uClinux/bfin-elf/bin:/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/jvm/jre/bin cd /home/test/work/cruise/checkouts/uclinux-dist/testsuites/ltp ./ltp_auto_test.exp /dev/ttyS0 2
The log and summary file are produced and given out at the end.
As to the Linux kernel that ltp cases is running on, there are two policies for the board cache configuration,write through(WT) and write back(WB). With the kernel built in each case, ltp cases will all be run through to see if there is some difference and issues involved. For kernel with SMP support, only WT is supported. Except for above WB/WT polices, we also enable another round of LTP test with high resolution timer and preempt support.
under Customize Kernel Settings
== Select Device Drivers ==
== Select Sound ==
== Select Sound card support ==
== Select Advanced Linux Sound Architecture==
Enable Sequencer support
Enable Advanced Linux Sound Architecture
Enable OSS Mixer API
Enable OSS PCM (digital audio) API
== Select ALSA blackfin devices==
Enable 1836 Audio support for BF53x
== Select 5.1 Channels or 3 seperate Stereos ==
Enable 3 stereos
== System on Chip audio support ==
Disable ALSA for SoC audio support
under Customize Vendor/User Settings
== Select Miscellaneous Applications ==
Enable vplay
Enable vrec
== Select Blackfin build Options ==
Select FDPIC Binaryformat
under Customize Kernel Settings
== Select Device Drivers ==
== Select Sound ==
== Select Sound card support ==
== Select Advanced Linux Sound Architecture==
Enable Sequencer support
Enable Advanced Linux Sound Architecture
Enable OSS Mixer API
Enable OSS PCM (digital audio) API
== Select ALSA blackfin devices==
Disable 1836 Audio support for BF53x
Enable AD73311L Audio support for BF53x
== System on Chip audio support ==
Disable ALSA for SoC audio support
The application selection is the same as that for ad1836 testing above.
under Customize Kernel Settings
== Select Blackfin processor Options ==
== Select Enable DMA Support ==
select Uncached SDRAM region (Enable 2M DMA region) -> Enable 2M DMA region
== Select Device Drivers ==
== Select Sound ==
== Select Sound card support ==
== Select Advanced Linux Sound Architecture==
Enable Sequencer support
Enable Advanced Linux Sound Architecture
Enable OSS Mixer API
Enable OSS PCM (digital audio) API
== Select ALSA blackfin devices==
Disable 1836 Audio support for BF53x
Disable AD73311L Audio support for BF53x
Select Cascaded AD73322 Audio support for BF53x
(2)Blackfin Audio SPORT port(0 for sport0, 1 for sport1 ,2 for both ports)
== System on Chip audio support ==
Disable ALSA for SoC audio support
The application selection is the same as that for ad1836 testing above.
J9: Top - Center / LFE; Down - Front Left / Right J10: Rear Left / Right
Green: Front Left / Right Yellow: Center / LFE Black: Rear Left / Right
under Customize Vendor/User Settings == Select Blackfin test programs == Enable netperf test tool
Build the kernel,there would be netperf in the romfs/bin folder. Extract the netperf.tgz under testscripts/ethernet. Copy netperf_script to romfs, then rebuild kernel and copy the newly-built image to /tftpboot directory. After that run the netserver_x86 in background on host and run netperf_script on target system. It will generate two log files netperf_tcp_rr and netperf_tcp_stream to tell the result.
under Customize Kernel Settings
== Select Device Drivers ==
== Select Network device support ==
Select Ethernet (10 or 100 Mbit)
Disable Use L1 memory for rx/tx packets
set Number of transmit buffer packets 100
set Number of receive buffer packets 500
under Customize Vendor/User Settings
== Select Blackfin test programs ==
Enable netperf test tool
under Customize Kernel Settings
== Select Device Drivers ==
== Select Character devices ==
Enable Blackfin Power Management Support
under Customize Vendor/User Settings
== Select Blackfin test programs ==
Enable DPMC test program
under Customize Kernel Settings
== Select Device Drivers ==
== Select GPIO Support ==
Enable /sys/class/gpio/...(sysfs interface)
under Customize Kernel Settings
== Select Device Drivers ==
== Select Input device support ==
Enable Generic input layer (needed for keyboard, mouse, ...)
Enable Event interface
Enable Keyboards
Disable AT keyboard
Enable GPIO Buttons
==Select Hardware I/O ports ==
Disable Serial I/O support
under Customize Vendor/User Settings
== Select Blackfin test programs ==
Enable Input event device test program
under Customize Vendor/User Settings == Select Blackfin test programs == Enable RTC test program
under Customize kernel Settings == Select Blackfin Proccessor Options == == Select Clock Settings == == Select Timer frequency 100 HZ( 250 HZ or 1000 HZ)==
BF533-STAMP: JP1 set 15-16
BF537-STAMP: JP1 set 15-16 BF609-EZKIT: JP1 set 15-16 BF548-EZKIT: JP1 set 9-10 BF527-EZKIT: JP1 set 9-10
For BF527 board jumper “STAMP_ENABLE” must be shorted to turn on the TWI signal. It's JP7 on 2.x board and JP3 on 1.x board.
under Customize kernel Settings
== Select Device Drivers ==
== Select I2C support ==
Enable I2C support
Enable I2C device interface
== Select I2C Hardware Bus support ==
Enable Blackfin TWI I2C support
== Select Input device support ==
Enable Generic input layer (needed for keyboard,mouse,...)
Disable Mouse interface
Enable Joystick interface
Enable Event interface
Disable Keyboards
Disable Mice
Enable Miscellaneous devices
Enable Analog Devices AD714x Capacitance Touch Sensor
Enable support I2C bus connection
Enable support SPI bus connection
under Customize Vendor/User Settings
== Select Blackfin test programs ==
Enable input event device test
== Flash Tools ==
Select mtd-utils
Enable eraseall
Enable mkfs.jffs2
These tools will be used in the test case.
== Select Device Drivers ==
== Select Memory Technology Devices (MTD) ==
Select - Self-contained MTD device drivers
Enable – Support for M25 SPI Flash
JP1: open JP2: set 1-2 JP3: set 1-2, set 3-4 JP4: open JP5: open
Board Type Serial Port irtty-sir BF537-STAMP UART0 UART1 BF533-STAMP UART0* UART0 BF548-EZKIT UART1 UART3 BF527-EZKIT UART1 UART0 * only a UART0. Serial Port needs to be disabled before using irtty-sir on UART0.
under Customize Kernel Settings
== Select Device Drivers ==
== Select Character devices ==
== Select Serial drivers ==
Enable UART0 // For bf537
Enable UART0 hareware flow control
Enable UART1 // For bf548
Enable UART1 hareware flow control
under Customize Vendor/User Settings
== Select Blackfin test programs==
Enable RTS/CTS test program
minicom -s Serial port setup F - Hardware Flow Control: Yes
rtscts_test ttyBF0 -t
it would prevent any input from outside to be output at shell prompt for 5 seconds. Then print all at once at the end of the test programe.
rtscts_test ttyBF0 -d // disable RTS on /dev/ttyBF0 cat /proc/kallsyms > /dev/ttyBF0
Connect the CTS pin to 3V, it can withhold the output message from being print on serial console(don't look at the telnet console, it is through ethernet); disconnect CTS from 3V , it continues to output.
If the two cases go like this, it counts as passed, otherwise fails.
under Customize Kernel Settings
== Select Device Drivers ==
== Select Character devices ==
== Select Watchdog Cards ==
Enable Watchdog Timer Support
Enable Blackfin Watchdog Timer
under Customize Vendor/User Settings
== Select Blackfin test programs==
Enable Kernel Panic (test Watchdog)
== Select Blackfin app programs==
Enable watchdog simple deamon
under Customize Kernel Settings
== Select Device Drivers ==
== Select Network device support ==
Select Ethernet (10 or 100 Mbit)
Enable ENC28J60 support
under Customize Vendor/User Settings
== Select Blackfin test programs ==
Enable netperf test tool
The device is registered as eth1 and we test it with netperf. Once the connection through eth1 is ok and produce the data, the case is passed, otherwise fails.
under Customize Kernel Settings
== Select Device Drivers ==
== Select character devices ==
Select Serial drivers
Enable Blackfin SPORT emulate UART
Enable Console on Blackfin sport emulated uart
Index: /home/bob/uclinux-dist2/linux-2.6.x/arch/blackfin/mach-bf537/boards/stamp.c
===================================================================
--- /home/bob/uclinux-dist2/linux-2.6.x/arch/blackfin/mach-bf537/boards/stamp.c (revision 9424)
+++ /home/bob/uclinux-dist2/linux-2.6.x/arch/blackfin/mach-bf537/boards/stamp.c (working copy)
@@ -1037,8 +1037,8 @@
/* the modalias must be the same as spi device driver name */
.modalias = "m25p80", /* Name of spi_driver for this device */
.max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
- .bus_num = 0, /* Framework bus number */
- .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
+ .bus_num = 1, /* Framework bus number */
+ .chip_select = GPIO_PF14, /* Framework chip select. On STAMP537 it is SPISSEL1*/
.platform_data = &bfin_spi_flash_data,
.controller_data = &spi_flash_chip_info,
.mode = SPI_MODE_3,
@@ -1579,7 +1579,7 @@
/* SPORT SPI controller data */
static struct bfin5xx_spi_master bfin_sport_spi0_info = {
- .num_chipselect = 1, /* master only supports one device */
+ .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS, /* master only supports one device */
.enable_dma = 0, /* master don't support DMA */
.pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
under Customize Kernel Settings
== Select Device Drivers ==
== Select SPI support ==
Enable emulate SPI bus with Blackfin SPORT
After that, proceed with specific spi flash test steps.
under Customize Kernel Settings
== Select Device Drivers ==
== Select Character devices ==
Blackfin SPORT driver for direct raw access
under Customize Vendor/User Settings
== Select Library Configuration ==
Enable Build libZ
Enable Build libpng
== Select Miscellaneous Applications ==
Enable gnuplot
== Select Blackfin canned demos==
Networked Software Defined Storage Oscilloscope /dev/sport
or Enable Networked Arbitrary Waveform Genertor
(Don't use NDSO_IIO. Please select AWG or NDSO and disable the other, as kernel image may be too big.)
Build this kernel and use it to boot the target board, configure the Ethernet card at kernel prompt:
#ifconfig eth0 10.100.4.50
Then start test application:
#ndso & (for ndso test) #awg & (for awg test)
Open the web browser on host system, such as Mozilla, Firefox, IE. Enter in the URL target ip address:
http://10.100.4.50
For ndso test, hit Acquire button on the left, the picture sampled by the ADC converter can now be seen on website. For awg test, choose any waveform on website and it should be seen on oscilloscope.
Character devices --->
<*> Blackfin Userspace DMA Interface
Blackfin test programs --->
[*] bfin-dma test
Character devices --->
<*> Blackfin hardware CRC driver
Miscellaneous --->
[*] bfin CRC test
simple_timer_test -m 5 -b 537(or -b 609) cat /proc/bfin_simple_timer
under Customize Kernel Settings
== Select Loadable module support ==
Enable Enable loadable module support
Enable Module unloading
Enable Automatic kernel module loading
== Select Device Drivers ==
== Select Network device support ==
== Select Ethernet (10 or 100Mbit) ==
Select M SMC 91C9x/91C1xxx support (BF533-STAMP,BF533-EZKIT,BF561-EZKIT)
Select M Blackfin 527/536/537 on-chip mac support (BF537-STAMP,BF527-EZKIT)
Select M SMSC LAN911x/LAN921x families embedded ethernet support (BF548-EZKIT)
insmod /lib/modules/2.6.12.1/kernel/drivers/net/smc91x.ko lsmod ifconfig eth0 10.100.4.50 ping 10.100.4.174 rmmod
under Customize Vendor/User Settings == Select Blackfin test programs== Enable Pthread lib test
under Customize Vendor/User Settings == Select Blackfin app programs== Enable strace
under Customize Kernel Settings
== Select Profiling support ==
Enable Profiling support
Enable OProfile system Profiling
under Customize Vendor/User Settings
== Select Blackfin app programs ==
== Select oprofile ==
EXT2_BLOCKS = 18432
bfin-uclinux-gcc -o libhelloworld.so helloworld.c -shared -mfdpic bfin-uclinux-gcc -o test_dll test_dll.c -mfdpic -ldl rcp libhelloworld.so root@10.100.4.50:/lib rcp test_dll root@10.100.4.50:/
The test_dll.c is as following:
#include <dlfcn.h>
int main(int argc, char* argv[])
{
void *handle;
char *error;
int (*helloworld)(char *str);
int r;
handle = dlopen("libhelloworld.so", RTLD_NOW);
if (!handle) {
fprintf (stderr, "%s\n", dlerror());
exit(1);
}
dlerror(); /* Clear any existing error */
helloworld = dlsym(handle, "helloworld");
if ((error = dlerror()) != NULL) {
fprintf (stderr, "%s\n", error);
exit(1);
}
r = helloworld("hello\n");
printf("get %d\n", r);
dlclose(handle);
return 0;
}
under Customize Kernel Settings
== Select Board customizations ==
Kernel load address for booting
--> Change from 0x1000 to user-defined address(for example 0x2000)
file: trunk/testsuites/dmacopy/src/dmacopy.c
#include <bfin_sram.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr)) static inline void show_diff(int first, int last) { printf(" %i", first); if (first != last) printf("...%i", last); } static void dump_diff(char *ptr_a, char *ptr_b, int len) { int i, first = -1, last; printf("\toffsets differ:"); for (i = 0; i < len; ++i) { if (ptr_a[i] != ptr_b[i]) { if (first == -1) first = i; last = i; } else if (first != -1) { show_diff(first, last); first = last = -1; } } if (first != -1) show_diff(first, last); printf("\n"); } /* Make sure dma_memcpy() does not over/under flow the buffers given to it. * We do this by padding each buffer with a canary at the start and end. So * the actual allocation looks like: * [size][canary][ ... buffer ... ][canary] * The canary used is the pointer returned by malloc so we know we have a * unique value at all times. If dma_memcpy() does anything bad, the canaries * will get killed in the process. */ #define canary_size sizeof(char *) static void *xmalloc(size_t size) { char *ret = malloc(size + (canary_size * 2) + sizeof(size)); char *canary, *canary1, *canary2; if (!ret) { printf("FAIL: malloc(%zu) failed\n", size); exit(10); } canary = (void *)&ret; canary1 = ret + canary_size; canary2 = canary1 + canary_size + size; memcpy(ret, &size, sizeof(size)); memcpy(canary1, canary, canary_size); memcpy(canary2, canary, canary_size); return ret + sizeof(size) + canary_size; } static void xfree(void *ptr) { char *ret; char *canary, *canary1, *canary2; size_t size; ret = (char *)ptr - sizeof(size) - canary_size; canary = (void *)&ret; memcpy(&size, ret, sizeof(size)); canary1 = ret + canary_size; canary2 = canary1 + canary_size + size; if (memcmp(canary, canary1, canary_size)) printf("FAIL: leading canary was killed {%i,%i,%i,%i} vs {%i,%i,%i,%i}!\n", canary1[0], canary1[1], canary1[2], canary1[3], canary[0], canary[1], canary[2], canary[3]); if (memcmp(canary, canary2, canary_size)) printf("FAIL: trailing canary was killed {%i,%i,%i,%i} vs {%i,%i,%i,%i}!\n", canary2[0], canary2[1], canary2[2], canary2[3], canary[0], canary[1], canary[2], canary[3]); free(ret); } int is_l1_inst(void *paddr) { unsigned long addr = (unsigned long)paddr & 0xfff00000; if (addr == 0xffa00000 || addr == 0xff600000) return 1; else return 0; } /* Do the actual test: * - set buffers to values known to be different * - copy src to chk * - copy chk to dst * - compare src and dst */ int _do_test(char *src_desc, char *dst_desc, char *src, char *dst, char *chk, int size) { static int test_num = 1; int ret = 0, i; void *ptr; memset(src, 's', size); memset(dst, 'd', size); __builtin_bfin_ssync(); if (!is_l1_inst(chk)) memset(chk, 'c', size); ptr = dma_memcpy(chk, src, size); if (ptr) printf("PASS: dma_memcpy %s[s] to %s[c]\n", src_desc, dst_desc); else printf("FAIL: dma_memcpy %s[s] to %s[c]\n", src_desc, dst_desc), ++ret; if (!is_l1_inst(chk)) { i = memcmp(chk, src, size); if (!i) printf("PASS: dma_memcpy(chk, src) test case %i, memcmp result is %d\n", test_num, i); else { printf("FAIL: dma_memcpy(chk, src) test case %i, memcmp result is %d\n", test_num, i), ++ret; dump_diff(chk, src, size); } } ptr = dma_memcpy(dst, chk, size); if (ptr) printf("PASS: dma_memcpy %s[c] to %s[d]\n", dst_desc, src_desc); else printf("FAIL: dma_memcpy %s[c] to %s[d]\n", dst_desc, src_desc), ++ret; if (!is_l1_inst(chk)) { i = memcmp(dst, chk, size); if (!i) printf("PASS: dma_memcpy(dst, chk) test case %i, memcmp result is %d\n", test_num, i); else { printf("FAIL: dma_memcpy(dst, chk) test case %i, memcmp result is %d\n", test_num, i), ++ret; dump_diff(dst, chk, size); } } i = memcmp(dst, src, size); if (!i) printf("PASS: dma_memcpy(dst, src) test case %i, memcmp result is %d\n", test_num, i); else { printf("FAIL: dma_memcpy(dst, src) test case %i, memcmp result is %d\n", test_num, i), ++ret; dump_diff(dst, src, size); } ++test_num; return ret; } /* * test case 1 - dma_memcpy from src(SDRAM) to sram(SRAM) and sram(SRAM) to dst(SDRAM), then compare * src(SDRAM) and dst(SDRAM) to make sure that copy into or from SRAM is ok. * also check that 8/16/32 bit transfers work by mucking with alignment. */ int sram_test(int size, char *sram_desc, int flags) { int ret = 0; char *src = xmalloc(size); char *dst = xmalloc(size); char *sram = sram_alloc(size, flags); printf("TEST: --- SRAM (%s) <-> SDRAM w/%i bytes ---\n", sram_desc, size); if (!sram) { printf("FAIL: sram_alloc(%i) failed\n", size); return 1; } if ((ulong)src % 4 != 0 || (ulong)dst % 4 != 0 || (ulong)sram % 4 != 0 || size % 4 != 0) { printf("FAIL: SRAM src/dst/size are not 32bit aligned to start:\n" "\t%p / %p / %p / %i\n", src, dst, sram, size); return 1; } ret += _do_test("SDRAMx32", "SRAMx32", src, dst, sram, size); ret += _do_test("SDRAMx16", "SRAMx16", src+2, dst+2, sram+2, size-2); ret += _do_test("SDRAMx8", "SRAMx8", src+1, dst+1, sram+1, size-1); xfree(src); xfree(dst); sram_free(sram); return ret; } /* * test case 2 - dma_memcpy from src(SDRAM) to dst(SDRAM), memcmp of src and dst, * make sure that dma_memcpy in SDRAM is ok * also check that 8/16/32 bit transfers work by mucking with alignment. */ int sdram_test(int size) { int ret = 0; char *src = xmalloc(size); char *dst = xmalloc(size); char *chk = xmalloc(size); printf("TEST: --- SDRAM <-> SDRAM w/%i bytes ---\n", size); if ((ulong)src % 4 != 0 || (ulong)dst % 4 != 0 || (ulong)chk % 4 != 0 || size % 4 != 0) { printf("FAIL: SDRAM src/dst/size are not 32bit aligned to start\n" "\t%p / %p / %p / %i\n", src, dst, chk, size); return 1; } ret += _do_test("SDRAMx32", "SDRAMx32", src, dst, chk, size); ret += _do_test("SDRAMx16", "SDRAMx16", src+2, dst+2, chk+2, size-2); ret += _do_test("SDRAMx8", "SDRAMx8", src+1, dst+1, chk+1, size-1); xfree(src); xfree(dst); xfree(chk); return ret; } int has_l2(void) { /* if the part does not have L2, then don't try to use it */ return WEXITSTATUS(system("grep -qs '^L2 SRAM[[:space:]]*:[[:space:]]*[1-9]' /proc/cpuinfo")) == 0; } /* * Setup some "background noise" and really stress the hell out of the DMA * memcpy code. We do this by forking off a bunch of children and each child * continuously does small random memcpy's over and over. If the kernel * locking is safe, then there should be no problem processing all these * small children as well as the large buffers the main test does. */ pid_t children[20]; void maybe_run_child(int argc, char *argv[]) { if (argc != 2 || strcmp(argv[1], "child")) return; srandom(time(0)); while (1) { char src[256], dst[256]; dma_memcpy(src, dst, random() % 256); } } bool spawn_children(int argc, char *argv[]) { size_t i; maybe_run_child(argc, argv); for (i = 0; i < ARRAY_SIZE(children); ++i) { children[i] = vfork(); if (children[i] < 0) { perror("vfork() failed"); return false; } else if (!children[i]) { execlp(argv[0], argv[0], "child", NULL); perror("execlp() failed"); return false; } } return true; } void kill_children(void) { size_t i; for (i = 0; i < ARRAY_SIZE(children); ++i) kill(children[i], SIGKILL); } #define TEST_RANGE(range, func, args...) \ for (i = 0; i < ARRAY_SIZE(range##_range); ++i) \ ret += func(range##_range[i], ## args) int main(int argc, char *argv[]) { int ret = 0, i; int sml_range[] = { 4, 0x10, 0x1000 }; int mid_range[] = { 4, 0x10, 0x1000, 0x10000, 0x12340 }; int lrg_range[] = { 4, 0x10, 0x1000, 0x10000, 0x12340, 0x22340, 0x32340, 0x42340, 0x54320, 0x323450 }; if (!spawn_children(argc, argv)) return -1; TEST_RANGE(sml, sram_test, "L1 INST", L1_INST_SRAM); TEST_RANGE(sml, sram_test, "L1 DATA", L1_DATA_SRAM); if (has_l2()) TEST_RANGE(mid, sram_test, "L2", L2_SRAM); TEST_RANGE(lrg, sdram_test); if (ret) printf("SUMMARY: %i tests failed\n", ret); else printf("SUMMARY: all tests passed\n"); kill_children(); return ret; }
Kernel hacking --->
[*] Catch NULL pointer reads/writes
#include <stdio.h>
int main ()
{
int * p = NULL;
printf("No null point check: *p is %d\n", *p);
return 0;
}
set bootargs root=/dev/mtdblock0 rw mem=32M max_mem=64M
It would reserve 32M memory from the whole 64M memory space for user applications.
under Customize Kernel Settings
== Select Blackfin Processor Options ==
==Select Board customization==
Enable Re-program Clocks while kernel boots
Set VCO Multiplier 16
Set Core Clock Divider 1
Set System Clock Divider 5
== Blackfin Processor Options ==
Disable Enable RAM RootFS attached to the Kernel image(linux)
== Select Device Drivers ==
== Memory Technology Devices(MTD) ==
== Mapping drivers for chip access
Disable Generic Linux RAM/ROM filesystem support
Then we can get a kernel-only linux. Use this image to boot the STAMP board from SDRAM using jffs2 file system.
under Customize Kernel Settings
== Select Kernel hacking ==
Disable Compiled-in Kernel Boot Parameter
== Select Networking ==
Enable Networking Support
== Select Networking options ==
Enable IP: kernel level autoconfiguration
== Select File systems ==
== Select Network File System ==
Enable NFS file system support
Enable Root file system on NFS
Set uboot environment variable rootpath to the nfs access directory that is set in the host machine.
stamp> set rootpath=/home/test/checkouts/uclinus-dist/romfs
Make a console device in this romfs under /dev folder.
root:~> mknod console c 5 1
Then boot the previously built kernel, you can see it mount the nfs export directory of the host machine.
/etc/init.d/smb start
smbpasswd -a test
fs-test.sh script can start the test.under Customize Vendor/User Settings == Select Library Configuration programs == == Select Build sqlite == == Select Blackfin test programs == == Select Sqlite test program ==
cd /usr sqlite3 wishlist.db < wishlist.sql sqlite3 wishlist.db ".dump" sqlite_test "foo"
It should print out one record from the database.
find /sys/kernel/debug/blackfin/ -type f -print -exec cat '{}' \;
Blackfin app programs --->
[*] EDN's DSP benchmark
root:/> edn
The requirements of a host system are those necessary to build the Linux kernel. The general information about installation of the Linux kernel and uClinux diststribution can be found by checking out at
.
For example purposes, the host system described in this document is composed as follows:
The Blackfin target system must have the following features:
For example purposes, the ADDS-BF533-STAMP and ADDS-BF537-STAMP board will be used for these tests. This board includes:
The target must be connected to the host with:
The following needs to be pre-configured on the machine, which is out of the scope of this document:
The test scripts to run the above cases are placed in /testsuites folder under uClinux-dist kernel source tree which can be downloaded from our svn server. Each case has an unique subfolder which includes the script to build the function kernel and the steps to test it. There is a script named kernel_test which knows what cases to run on each board and takes turns to run them. To use it, you just need pass the right board name, etc, as parameter into the script to run the right set of cases.
These test cases fall into two parts, automated ones and manual cases.
Here are the steps to follow to test the Linux kernel:
cd ~/checkouts/kernel/ svn checkout svn://firewall-sources.blackfin.uclinux.org:80/svn/uclinux-dist/trunk .
export PATH=/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin:/opt/uClinux/bfin-elf/bin:$PATH
sudo ifconfig eth1 10.100.4.174
minicom
set ipaddr 10.100.4.50
set serverip 10.100.4.174
set bootfile linux
set bootcmd run tftp_boot
set tftp_boot 'tftpboot 0x2000000 linux;bootelf 0x2000000'
save
run tftp_boot
cd ~/test_suites/uclinux-dist
./run_kernel_test
It will print out removing and checking out cvs infomation, and the messages from building and testing the kernel. The test result files can be found at the same directory as the scripts, and would be collected to the folder test-scripts/uclinux-dist/logs/2008_xxx_xx_xx_xx of the host machine.
Total Pass Fail Broken Warning Crash Skipped NA ============================================================================ * gcc 4.1, FLT bf533-stamp-wt 702 554 6 3 0 1 13 125 bf533-stamp-wb 702 554 6 3 0 1 13 125 bf533-ezkit-wt 702 552 7 3 0 2 13 125 bf533-ezkit-wb 702 552 7 3 0 2 13 125 bf537-stamp-wt 702 554 6 3 0 1 13 125 bf537-stamp-wb 702 554 6 3 0 1 13 125 bf561-ezkit-wt 702 554 5 3 0 1 14 125 bf561-ezkit-wb 702 555 5 3 0 1 13 125
For details, please refer to blackfin website here
The kernel testing at various system clock and core clock is not carried out at the moment.