Saturday, March 5, 2011
Replace string in multiple files
$ find -E ./ -iregex '.*menu_.*\.(cpp|h)$' | xargs sed -E -i~ 's/ORG/NEW/g'
Multiple file name change
$ find -E ./ -iregex '.*menu_.*\.(cpp|h)$' > file.list
$ perl -w rename.pl file.list
-----------------------------------------
while($line = <>) {
if($line =~ m/.*(\bMenu_Setting.*)/i) {
# print "$1\n";
$old = $line;
$old =~ s/^\./\/home\/max\/src\/csu502 can\/acu-stm32-lcd/;
$old =~ s/\n//;
print "$old\n";
$newname = $old;
# replace file name
$newname =~ s/Menu_Setting_//;
print "$newname\n\n";
# use shell command: mv
system("mv", "$old", "$newname");
}
}
Tuesday, November 9, 2010
CSTACK & FreeRTOS
FreeRTOS V6.1.0
MCU: ARM Cortex-M3
Compiler: IAR 5.3
修改CSTACK的大小會當機!
如果當機的話,可以修改port.c.
---------------------------------------------------------------
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
/* Simulate the stack frame as it would be created by a context switch
interrupt. */
pxTopOfStack--; /* 將該行移除或加回,就可解決當機的問題 */
....
....
---------------------------------------------------------------
針對不同的CSTACK size, linker會把CSTACK排在不同的地方;可能是RAM的開頭或尾巴。
Friday, October 22, 2010
Test CAN-USB/2
Start-up device
% cd ../can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/iproute2/iproute2-2.6.31/ip
% ./ip link set can0 up type can bitrate 25000
Stop device
% ./ip link set can0 down
Reference: ..\can-usb2\SocketCAN\ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0\doc
Files: CAN-API_Part1_Function_Manual.pdf, page 90
Before starting the test, the start-up process isn't necessary.
Test: Show device info
% cd ../can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/cantest
% ./cantest
CAN Test Rev 2.9.11 -- (c) 1997-2010 esd electronic system design gmbh
Available CAN-Devices:
Net 60: ID=SocketCAN Dll=3.3.00 Driver=2.0.03 Firmware=1.0.06 S/N=GF000754
Hardware=1.0.00 Baudrate=00000004 Status=00000000 Features=0022
Timestamp=000493334fa504c2 TimestampFreq=1000000 Hz
Syntax: cantest test-Nr [net id-1st id-last count
txbuf rxbuf txtout rxtout baud testcount data0 data1 ...]
Test 0: canSend()
Test 1: canWrite()
Test 51: canWrite() with incrementing ids
Test 2: canTake()
Test 12: canTake() with time-measurement for 10000 can-frames
Test 22: canTakeT()
Test 32: canTake() in Object-Mode
Test 42: canTakeT() in Object-Mode
Test 3: canRead()
Test 13: canRead() with time-measurement for 10000 can-frames
Test 23: canReadT()
Test 4: canReadEvent()
Test 64: Retrieve bus statistics (every tx timeout)
Test 74: Reset bus statistics
Test 5: canSendEvent()
Test 8: Create auto RTR object
Test 9: Wait for RTR reply
Test 19: Wait for RTR reply without text-output
Comment
Baudrate=00000004, which representing baudrate is 250000bps
Reading Test
% ./cantest 23 60 1 100 20 20 20 20 20 4 50 50 4 22
Comment
test-Nr: 23
net: 60
id-1st: 1
last-id: 100
count: 20
txbuf: 20
rxbuf: 20
txtout: 20
rxtout: 20
baud: 4 (250000bps)
testcount: 22
Write Test
./cantest 51 60 1 100 20 20 20 20 20 4 50 50 4 22
Comment
test-Nr: 51
net: 60
id-1st: 1
last-id: 100
count: 20
txbuf: 20
rxbuf: 20
txtout: 20
rxtout: 20
baud: 4 (250000bps)
testcount: 22
Baudrate table
0: 1000 kbps
E *2) 800 kbps
1: 666.6 kbps
2: 500 kbps
3: 333.3 kbps
4: 250 kbps
5: 166 kbps
6: 125 kbps
7: 100 kbps
10 *2): 83.3 kbps
8: 66.6 kbps
9: 50 kbps
A: 33.3 kbps
B: 20 kbps
C: 12.5 kbps
D: 10 kbps
Thursday, October 14, 2010
CAN-USB/2 start-up process
Reference:
../can-usb2/SocketCAN/socketcan-trunk-r1110/kernel/2.6/Documentation/networking/can.txt 6.5.3
Install SocketCAN plugin
% cd ~max/src/can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/
% make
% ./install.sh
% cd iproute2/iproute2-2.6.31
% make
Start CAN-USB/2
% cd ~max/src/can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/iproute2/iproute2-2.6.31/ip
Start device
% ./ip link set can0 up type can bitrate 250000
Display device status-1
% ./ip -details -statistics link show can0
Display device status-2
% cd /sys/class/net/can0/statistics
Paths
/sys/class/net/can0
Documents
../can-usb2/SocketCAN/socketcan-trunk-r1110/kernel/2.6/Documentation/networking/can.txtDevice working status
#1
% cd /sys/class/net/can0
% cat operstate
#2
% ../can-usb2/SocketCAN/socketcan-trunk-r1110/test/canecho
Device properties
Reference:../can-usb2/SocketCAN/socketcan-trunk-r1110/kernel/2.6/Documentation/networking/can.txt
Chapter6
% cd ~max/src/can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/iproute2/iproute2-2.6.31/ip/
% ./ip link set can0 type can tq 16 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
% ./ip link set can0 type can bitrate 250000
% ./ip -details -statistics link show can0
% ./ip -details link show can0
Device operation
Start CAN interface
% ../can-usb2/SocketCAN/socketcan-trunk-r1110/etc/can_if start
Device testing
% ../can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/cantest/cantest
% ../can-usb2/SocketCAN/socketcan-trunk-r1110/can-utils/cangen interface
Programming reference
% ../can-usb2/SocketCAN/ntcanSckPlugin32-1.0.3-2.0.3-ntcan-3.3.0/doc
Wednesday, September 15, 2010
Command-Line Conventions
command的參數傳遞可分為兩種,以 "-" 加上一個單一字母或 "--" 加上一字串。
例如:如下兩個參數對於command來說皆相同。
-h
--help
Subscribe to:
Posts (Atom)