Summary of the invention
For solving the above-mentioned problems in the prior art, the invention provides a kind of emulation, debugging that can complete effectively, quickly and easily embedded software, the programming number of times of minimizing program, extend the Flash life-span, tempo of development is high, construction cycle is short, is not subject to the use WiFi of distance limit embedded software to be carried out to the method for artificial debugging in artificial debugging simultaneously.
For solving the problems of the technologies described above, the present invention adopts following technical scheme:
Use WiFi embedded software to be carried out to a method for artificial debugging, first on host and target machine, be respectively equipped with the WiFi transceiver matching, and be connected on same router by WiFi transceiver each other, realize WiFi wireless connections; Then on host, download, network file system(NFS) NFS is installed, and using a file on it as Shared Folders; Ideal machine is accessed this Shared Folders by network file system(NFS) NFS, and carries out emulation, debugging.
Further, institute's " emulation " specifically includes following steps:
A. host is restarted network file system(NFS) NFS;
B. the self-starting script of modifying target machine, allows it not want automatic carry;
C. carry out carry order, make target machine carry to the network file system(NFS) NFS of host;
D. target machine operation starts the order of gdbserver, sends signal to application program, and application program is stopped so that the signal that the gdb on host sends is debugged;
E. host sends debug command to the gdbserver on target machine, completes emulation.
Further, described " debugging " be mainly by insertion debug stake mode carry out, be specially by adding respectively some functional module in destination OS and debugger, the two exchanges information to debug.
Further, described debugger is Gdb Techniques of Cross Debugger, comprises GdbServer and Gdb two parts, and described GdbServer is arranged on target machine as debugging stake, and described Gdb is as residing in local Gdb debugger.
The invention has the beneficial effects as follows:
The present invention passes through technique scheme, can be effectively, convenient, complete quickly the emulation of embedded software, debugging, and by the directly file system on carry host on development board of network file system(NFS) NFS, the programming number of times of minimizing program, not only extend the life-span of Flash, also improve tempo of development, shorten the construction cycle, between target machine and host, adopt WiFi wireless connections simultaneously, allow the artificial debugging of some resource-constrained products become possibility, avoid the limited problem of artificial debugging middle distance, further improve development efficiency, the speed of having accelerated searching problem and having dealt with problems.
In addition, between target machine and host, adopt Gdb Techniques of Cross Debugger, in the time of artificial debugging, can realize effective tracking, the speed of also further having accelerated searching problem and having dealt with problems, development efficiency is higher.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
As shown in Figures 1 and 2,
A kind of WiFi of use described in the embodiment of the present invention carries out the method for artificial debugging to embedded software, first on host and target machine, be respectively equipped with the WiFi transceiver matching, and be connected on same router by WiFi transceiver each other, realize WiFi wireless connections; Then on host, download, network file system(NFS) NFS is installed, and using a file on it as Shared Folders; Ideal machine is accessed this Shared Folders by network file system(NFS) NFS, and carries out emulation, debugging.
Wherein, institute's " emulation " specifically includes following steps:
Steps A 1. hosts are restarted network file system(NFS) NFS;
The self-starting script of steps A 2. modifying target machines, allows it not want automatic carry;
Steps A 3. is carried out carry order, makes target machine carry to the network file system(NFS) NFS of host;
Steps A 4. target machine operations start the order of gdbserver, send signal to application program, and application program is stopped so that the signal that the gdb on host sends is debugged;
Steps A 5. hosts send debug command to the gdbserver on target machine, complete emulation.
Described " debugging " be mainly by insertion debug stake mode carry out, be specially by adding respectively some functional module in destination OS and debugger, the two exchanges information to debug, and debugger is Gdb Techniques of Cross Debugger, comprise GdbServer and Gdb two parts, described GdbServer is arranged on target machine as debugging stake, and described Gdb is as residing in local Gdb debugger.
Taking ubantu system as example, the method for artificial debugging of the present invention is described below.
Network file system(NFS) NFS:$ sudo apt-get install nfs-kernel-server nfs-common portmap is downloaded and installed to a1.ubantu main frame (host).A2. configure shared file: using a file/work/nfs_root on host as Shared Folders.A3. open configuration file: $ sudo gedit/etc/exports, and general/work/nfs_root * (rw, sync, no_root_squash) to be added on this file last, and between nfs_root and *, must have space, and No. * with just there is no space below; Wherein represent ip address (can be also a definite network segment) for No. *, * representative allows all network segment access, and rw is read-write authority, and preservation can be upgraded this file by sudo exportfs-rv.
A4. restart NFS service: sudo/etc/init.d/portmap restart, sudo/etc/init.d/nfs-kernel-server restart.
A5. test the NFS service of host no build whether correct: local test: $ sudo mount 192.168.1.1:/home/workspace/nfs/root/mnt; After execution, before can finding under mnt catalogue, shared catalogue builds successfully; The IP that wherein 192.168.1.1 is host.
A6. host is plugged wireless network card (host that carries wireless network card can be with the wireless network card carrying), be connected to that on a router, (target machine also must be connected on this router, be that host and target machine must be at the same network segments, could realize like this mutual of host and target machine).
A7. host is restarted NFS service: sudo/etc/init.d/portmap restart.
A8. (this file is an example to the self-starting script/nfs/etc/rcS.d/S01mount of modifying target machine, can be the different files in different path, must determine according to actual conditions), the order of automatic carry is commented out, to carry out ensuing carry order.
A9. carry out carry order: mount-t nfs-o tcp, nolock, rw 192.168.1.1:/home/workspace/nfs/root/app.
A10. the order of operation startup gdbserver on target machine: ./gdbserver 192.168.1.1:2345 ./app/out.elf starts.
A11. on host, move arm-linux-gdb ./app/out.elf target remote192.168.1.1:2345, the gdbserver on target machine sends debug command.
A12. target machine and host by destination OS and respectively GdbServer and the Gdb of Gdb Techniques of Cross Debugger mounted thereto exchange information, complete the debugging of functional module.
Like this, the method of embedded software being carried out to artificial debugging by use WiFi of the present invention gets final product effectively, convenient, complete quickly the emulation of embedded software, debugging, and by the directly file system on carry host on development board of network file system(NFS) NFS, the programming number of times of minimizing program, not only extend the life-span of Flash, also improve tempo of development, shorten the construction cycle, between target machine and host, adopt WiFi wireless connections simultaneously, allow the artificial debugging of some resource-constrained products become possibility, avoid the limited problem of artificial debugging middle distance, further improve development efficiency, the speed of having accelerated searching problem and having dealt with problems.
In addition, between target machine and host, adopt Gdb Techniques of Cross Debugger, in the time of artificial debugging, can realize effective tracking, the speed of also further having accelerated searching problem and having dealt with problems, development efficiency is higher.
The above is the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications are also considered as protection scope of the present invention.