HelloDevice Super 110
Copyright 1998-2005, All rights reserved HelloDevice 210 ()137-130 Tel: (02) 573-5422 Fax: (02) 573-7710 E-Mail: support@senacom Website: http://wwwsenacom
Revision history Revision Date Name Description V001 2003-09-09 H Yeom Initial Draft V100 2003-09-22 H Yeom Initial Release V110 2004-01-12 H Yeom GDB
1 5 2 SDK ( ) 6 3 7 31 7 32 7 33 7 34 7 4 8 41 HTML 8 42 CGI 8 43 10 5 10 51 10 52 11 53 12 6 GDB 13 61 GDB 13
1 HelloDevice Super - RS-232/422/485 HelloDevice Super (SDK),,, FIFO (read/write), HelloDevice Super Linux OS, UNIX / Linux -
2 SDK ( ) HelloDevice Super SDK HelloDevice Super SDKPC CF HelloDevice Super SDK SDK,,, C SDK /mnt/flash bin Binary files can be executed gcc, ld, ar, as, include Header files for SS applications lib Library files for SS application sample web Sample C files for web customization filter Sample C files for filter customization
3 31 1) CF HelloDevice Super SDK 2) SS PCMCIA (PC ) SDK 3) PC, C HelloDevice Super CLI, PC Linux /mnt/flash/lib HelloDevice Super CLI PC,, HelloDevice Super - SCP - FTP - ( progacprogbc C prog ) # gcc o prog progac progbc # /prog
41 HTML HelloDevice Super HTML HTML /usr2/usrweb indexhtml HTML /usr2/usrweb, HTML 42 CGI 421 CGI CGI CGI /mnt/flash/sample/web/cgi/shellc 1 CGI # cd /mnt/flash/sample/web/cgi # make 2 CGI # cp shellcgi /usr2/cgi-bin/ 3, SS11 0/400/800
4 http://19216812/cgi-bin/shellcgi (HelloDevice Super IP 19216812 ) 422 CGI CGI /usr2/cgi-bin default CGI, Shellc Makefile CC = gcc BIN = shellcgi OBJS = shello util_cgio LDFLAG = -L/mnt/flash/lib BIN : $(OBJS) $(CC) -o $(BIN) $(OBJS) $(LDFLAG) co : $(CC) -c $< all : $(BIN) clean : rm -f $(BIN) $(OBJS) util_cgihutil_cgic Appendix A CGI /usr2/cgi-bin
43 CGI /usr2/usrweb 5 51 HelloDevice Super FIFO, FIFO (read/write) Remote Hosts Socket Read/Write App FIFOs Filter App FIFOs Serial port Read/Write App Serial Port FIFO, FIFO
1) /tmp/port_fifos/portx_f2sfifo (, X1 ) 2) /tmp/port_fifos/portx_f2efifo 3) /tmp/port_fifos/portx_s2ffifo FIFO 4) /tmp/port_fifos/portx_e2ffifo FIFO 5), FIFO 6), 7) /var/run/portx_filterpid PID(Process ID) (PID, (disable) ) 8) SIGTERM 52 /mnt/flash/sample/filter/ 1 # cd /mnt/flash/sample/filter # make 2 # cp data_conversion /usr2/sample_filter
3 : Thread, Thread Thread Thread ThreadThread, SIGTERM ThreadSIGTERM Thread / Thread - emptyc / / FIFO - periodic_commandc / / FIFO, - data_conversionc - data_calibrationc (:, ) - data_storingc (:, ) RAM (/tmp )
- data_event_handlingc (:, ) SNMP - cqc Circular queue 6 GDB HelloDevice Super SDKGNU GDB ( : GDB SDK v110 ) GDB :, GDBgdb, GDB quit GDB help GDB GDB GDB GDB, -g 61 GDB GDB, Web UIeditconf,
1 # cp /mnt/flash/sample/filter/makefile /usr2/ # cp /mnt/flash/sample/filter/data_conversionc /usr2/ # cp /mnt/flash/sample/filter/cqc /usr2/ # cp /mnt/flash/sample/filter/cqh /usr2/ 2 g Makefile g CFLAGS # cd /usr2/ # vi Makefile //CFLAGS = -pipe CFLAGS = -pipe g 3 GDB do_daemon() save_pid(portnum) GDB (foreground) # vi data_conversionc int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "\nusage: %s [portnumber] [echo no_echo]\n\n", get_program_name(argv[0])); return -1; } portnum = atoi(argv[1]); if (argc>2 &&!strcmp(argv[2], "no_echo")) echo_flag = 0; (void) signal(sigterm, handle_sigterm); (void) signal(sigpipe, handle_sigterm); // Remark following two lines to run this program on the foreground // do_daemon(); // save_pid(portnum); do_filter(); close_fifos(); return 0;
} 4 # make data_conversion 5 (ssport)tcp (sstcp) ssport, sstcptcp SS /bin 1 1 # ssport 1 # sstcp 1 # ps ef PID Uid Stat Command 1 root S init 2 root S [keventd] 3 root S [kswapd] 4 root S [kreclaimd] 5 root S [bdflush] 6 root S [kupdate] 8 root S [mtdblockd] 35 root S [jffs2_gcd_mtd5] 57 root S /sbin/cardmgr 80 root S dhcpcd eth0 87 root S /etc/rcd/rc2d/s19sslogger start 97 root S /usr/sbin/inetd 100 root S /usr/local/sbin/webs 110 root S /usr/local/sbin/snmpd -c /usr/local/share/snmp/snmpdconf 113 root S /bin/linkupchecker -c 1 118 root R /etc/rcd/rc2d/s53ss800mand start 126 root S /etc/rcd/rc2d/s53ss800mand start 128 root S /usr/sbin/cron 129 root S -bash 523 root S ssport 1 524 root S ssport 1 525 root S ssport 1 526 root S ssport 1 527 root S ssport 1 529 root S sstcp 1 530 root S sstcp 1 532 root S sstcp 1 533 root S sstcp 1 534 root S sstcp 1 535 root R ps -ef 6 GDB # /mnt/flash/bin/gdb data_conversion
7 GDB, GDB, GNU gdb 50 Copyright 2000 Free Software Foundation, Inc GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions Type "show copying" to see the conditions There is absolutely no warranty for GDB Type "show warranty" for details This GDB was configured as "powerpc-hardhat-linux" (gdb) set args 1 1 1 8, *e2s_thread, TCP (gdb) break *e2s_thread Breakpoint 1 at 0x10003054: file data_conversionc, line 255 r (gdb) r Starting program: /usr2/data_conversion 1 [New Thread 539 (manager thread)] [New Thread 538 (initial thread)] [New Thread 540] [New Thread 541] [Switching to Thread 541] Breakpoint 1, e2s_thread (arg=0x0) at data_conversionc:255 255 { (gdb) 9, *e2s_thread n ( ) e2s_thread (arg=0x0) at data_conversionc:257 257 int nread=0; 261 pthread_setcancelstate(pthread_cancel_enable, NULL); 262 pthread_setcanceltype(pthread_cancel_asynchronous, NULL); 10 274, SS 1 TCP, TeraTerm Pro Hyper Terminal
1, TCP 270 if (f2s_fd < 0) pthread_exit(null); 272 while(!exit_flag) { 274 nread = read(e2f_fd, buf, sizeof(buf)); 275 if (nread<=0) continue; (gdb) 11 275 buf[0], TCP (gdb) display buf[0] 1: buf[0] = 97 'a' (gdb) break 275 Breakpoint 2 at 0x10003160: file data_conversionc, line 275 277 if (echo_flag) { 1: buf[0] = 97 'a' (gdb) c Continuing Breakpoint 2, e2s_thread (arg=0x0) at data_conversionc:275 275 if (nread<=0) continue; 1: buf[0] = 50 '2' (gdb) c Continuing Breakpoint 2, e2s_thread (arg=0x0) at data_conversionc:275 275 if (nread<=0) continue; 1: buf[0] = 51 '3' (gdb) 12 GDB quit (gdb) quit The program is running Exit anyway? (y or n) y ssportsstcp, 5 # killall ssport # killall sstcp GDB GNU (http://wwwgnuorg/software/gdb/documentation/)