I used the following Awk Script to run a Test on the Commands Speed of Awk,
by Clocking the Toggle of the GPIO14 LED.
I tweaked I=35700 in the two for() loops until I clocked the GPIO LED close to 1Hz.
Giving about 357000 Awk Commands per Second.
I wrote the Script into /tmp :
cd /tmp
vi gpioTmr
chmod 777 gpioTmr
/tmp/gpioTmr
And, the Script :
#!/usr/bin/awk -f
## Blink GPIO #14 LED at 1Hz :
## IPS = ( 35700 * 2 * (5 cmdsPerLoop) ) = 357000 Awk InstructionsPerSecond
BEGIN
{
P = 14;
CNT = 35700;
while(1)
{
for(I=0; I<35700; I++)
{
}
print 0 > "/sys/class/gpio/gpio" P "/value"
for(I=0; I<35700; I++)
{
}
print 1 > "/sys/class/gpio/gpio" P "/value"
}
}
The following Script shows the speed of using the ASH Shell.
I clocked it at about 61500 Instructions Per Second:
#!/bin/ash
## loopTmrAsh
## - 13 seconds
## IPS = (100000 * (8 CommandsPerLoop) / 13 seconds) = 61500 Hz InstructionsPerSecond
## * 77000 => 10 seconds
X=0
#while [ $X -le 100000 ]
while [ $X -le 77000 ]
do
# echo $X
X=$((X+1))
done
Below is a Script to Blink the LEDs as Counters:
#!/bin/ash
## loopLeds
echo "0" > /sys/class/gpio/gpio14/value
T=0
C14=0
while [ $T -le 77000 ]
do
# echo $T
T=$((T+1))
C14=$((C14+1))
if [ $C14 -eq 1000 ]; then
echo "1" > /sys/class/gpio/gpio14/value
fi
if [ $C14 -gt 2000 ]; then
echo "0" > /sys/class/gpio/gpio14/value
C14=0
fi
C15=$((C15+1))
if [ $C15 -eq 2000 ]; then
echo "1" > /sys/class/gpio/gpio15/value
fi
if [ $C15 -gt 4000 ]; then
echo "0" > /sys/class/gpio/gpio15/value
C15=0
fi
C16=$((C16+1))
if [ $C16 -eq 4000 ]; then
echo "1" > /sys/class/gpio/gpio16/value
fi
if [ $C16 -gt 8000 ]; then
echo "0" > /sys/class/gpio/gpio16/value
C16=0
fi
done
And an amusing Script to sweep the LEDs like a cylon:
#!/bin/ash
## ledsCylon
#echo "0" > /sys/class/gpio/gpio14/value
T=0
C14=0
while [ $T -le 77000 ]
do
# echo $T
T=$((T+1))
C14=$((C14+1))
if [ $C14 -eq 1000 ]; then
echo "0" > /sys/class/gpio/gpio14/value
echo "1" > /sys/class/gpio/gpio15/value
echo "0" > /sys/class/gpio/gpio16/value
fi
if [ $C14 -eq 2000 ]; then
echo "0" > /sys/class/gpio/gpio14/value
echo "0" > /sys/class/gpio/gpio15/value
echo "1" > /sys/class/gpio/gpio16/value
fi
if [ $C14 -eq 3000 ]; then
echo "0" > /sys/class/gpio/gpio14/value
echo "1" > /sys/class/gpio/gpio15/value
echo "0" > /sys/class/gpio/gpio16/value
fi
if [ $C14 -eq 4000 ]; then
echo "1" > /sys/class/gpio/gpio14/value
echo "0" > /sys/class/gpio/gpio15/value
echo "0" > /sys/class/gpio/gpio16/value
C14=0
fi
done
hello what test result does it indicate?
Well, the IPS are listed above, these are oly for the Scripts.
I would like to test C Code, but I need a GCC Compiler first.
I also want to test Python and Perl.
All I can find to use is SH and ASH and AWK.
No Perl or Python or GCC.
Anybody find anything else to Code in and/or Test ??
I tested SH which seems to run same speed as ASH.
Below SH Script blinks GPIO16 LED at about 1Hz:
#!/bin/sh
## blkTmrSh
X=0
C16=0
#while [ $X -le 100000 ]
while [ $X -le 77000 ]
do
# echo $X
X=$((X+1))
C16=$((C16+1))
if [ $C16 -eq 1500 ]; then
echo "1" > /sys/class/gpio/gpio16/value
fi
if [ $C16 -gt 3000 ]; then
echo "0" > /sys/class/gpio/gpio16/value
C16=0
fi
done
Task Complete !
I clocked the Compiled C code to 200 MIPS.
Supposed to be 400 MHz ?
- Maybe because of LONG int ? - or MultiTasking ?
Anyway - FAST enough for ME !
I used a Loop of 400,000,000 iterations, of probably 5 commands per loop - took 10 seconds.
> ((400000000 iterations * 5 cmdsPerLoop) / 10 seconds) = 200,000,000 = 200 MIPS
I downloaded YunGcc.tgz and UnTARred it onto my SDCard,
then compiled using GCC feom SD Card :
// testSpd.c : //
// - loop=400,000,000 => IPS = ((400000000 * 5) / 10 seconds) = 200 MIPS
#include <stdio.h>
void main()
{
long i;
printf("Start ..\n");
for(i=0;i<400000000;i++)
{
}
printf("Done !\n");
}
root@domino:/mnt/sda2/Code# gcc testSpd.c
/mnt/sda2/gcc/bin/ld: Warning: a.out uses -msoft-float (set by /mnt/sda2/gcc/bin/../lib/gcc/mips-openwrt-linux-uclibc/4.6.4/crtbegin.o), /tmp/cc80ZcyD.o uses -mhard-float
root@domino:/mnt/sda2/Code# ./a.out
Start ..
Done !
root@domino:/mnt/sda2/Code#
alzhao
10
so, you can compile c program on the board directly now? This is nice!
Just plug the SD Card into the USB Port with the GCC image.
I was using the PI.
But, I should be able to install a USB on the Core Board with minimal effort,
What GCC is capable of doing? Can it control OI?
Where can the GCC image be downloaded and how to install into the USB?