📄 application_development.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="clear"><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#application_development" class="toc">Application Development</a></span></div><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#new_vendor_target" class="toc">New Vendor/Target</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#divide_kernel_and_userland" class="toc">Divide Kernel and Userland</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#create_a_kernel_test_directory" class="toc">Create a Kernel Test Directory</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#create_a_user_test_directory" class="toc">Create a User Test Directory</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#use_kernel_modules" class="toc">Use Kernel Modules</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#ftp_target_transfer" class="toc">FTP Target Transfer</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#keep_working_configurations" class="toc">Keep Working Configurations</a></span></div></li></ul></li></ul></li></ul></div></div><h2><a name="application_development" id="application_development">Application Development</a></h2><div class="level2"><p> This section presents a framework for developing uClinux applications. For instructions on how to compile and run a simple “Hello World” example, please see <a href="simple_hello_world_application_example.html" class="wikilink1" title="simple_hello_world_application_example.html">this</a> section. Instructions on adding your application to the uClinux memory image can be found <a href="adding_user_applications.html" class="wikilink1" title="adding_user_applications.html">here</a>.</p><p>Here is a summary of the steps: </p><ul><li class="level1"><div class="li"> Create a new vendor/target in the Distribution</div></li><li class="level1"><div class="li"> Divide your application into Kernel and Userland Components</div></li><li class="level1"><div class="li"> Create a test directory for kernel experiments</div></li><li class="level1"><div class="li"> Create a user/test directory for userland experiments</div></li><li class="level1"><div class="li"> Use Modules for Kernel Experiemnts</div></li><li class="level1"><div class="li"> Use <acronym title="File Transfer Protocol">FTP</acronym> to transfer modules and user tasks to the Target</div></li><li class="level1"><div class="li"> Build test cases for all Kernel and User code</div></li><li class="level1"><div class="li"> Transfer to the final kernel and user land layout as the design progresses</div></li><li class="level1"><div class="li"> Keep in a very safe place all working configurations.</div></li></ul></div><!-- SECTION [1-914] --><h3><a name="new_vendor_target" id="new_vendor_target">New Vendor/Target</a></h3><div class="level3"><p> The uClinux Distribution contains a large number of different architectures, each architecture also defines different target systems. </p><p>The Development system automatically detects the vendors and target systems available by scanning the <strong>vendors</strong> directory. Simply creating a new vendor name as a subdirectory of <strong>uClinux-dist/vendors</strong> will create a new vendor choice in the first level menu. Each vendor will have a subdirectory for each different target system they offer.</p><p>To create your own system simple follow the instructions:</p><pre class="code">cd uClinux-distmkdir -p vendors/MySystem/MyTargetcp -a vendors/AnalogDevices/BF533-STAMP/* vendors/MySystem/MyTarget</pre><p>Then rerun <strong>make menuconfig</strong> to select the new vendor/target combination.</p></div><!-- SECTION [915-1696] --><h3><a name="divide_kernel_and_userland" id="divide_kernel_and_userland">Divide Kernel and Userland</a></h3><div class="level3"><p> When planning a project identify the components that will probably lie in kernel space and userland.</p><p>There may be some overlap in that applications could lie in either area at first.</p><p>Make a list and partition the project </p><table class="inline"> <tr> <td> Task </td><td class="rightalign"> Kernel </td><td> User </td> </tr> <tr> <td> Root File System </td><td> </td><td> * </td> </tr> <tr> <td> Kernel Config </td><td> * </td><td> </td> </tr> <tr> <td> High Speed Data Input </td><td> * </td><td> </td> </tr> <tr> <td> Data Source Config and Setup </td><td> </td><td> * </td> </tr> <tr> <td> Network Driver </td><td> * </td><td> </td> </tr> <tr> <td> Data Transfer </td><td> ? </td><td> ? </td> </tr></table><br /><p> You may use different project teams to design kernel and user code.</p><p>Define each task as small sub components </p><table class="inline"> <tr> <td> High Speed Data Input </td><td> Notes </td> </tr> <tr> <td> Define I/O Pins </td><td> Refer to HW diagram </td> </tr> <tr> <td> Dma Data to Memory </td><td> Write DMA Test Program </td> </tr> <tr> <td> Validate and Format Data </td><td> Part Kernel Part User Space</td> </tr> <tr> <td> Package Output Packet </td><td class="rightalign"> </td> </tr></table><br /></div><!-- SECTION [1697-2481] --><h3><a name="create_a_kernel_test_directory" id="create_a_kernel_test_directory">Create a Kernel Test Directory</a></h3><div class="level3"><p> Create a test directory for your initial kernel experiments:</p><pre class="code">cd uClinux-distmkdir linux-2.6.x/drivers/char/test </pre><p>Then add this directory to the <strong>drivers/char/Makefile</strong>:</p><pre class="code">CONFIG_CHAR_TEST = yobj-$(CONFIG_CHAR_TEST) += test/</pre><p>Then create a simple <strong>drivers/char/test/Makefile</strong>:</p><pre class="code">CONFIG_CHAR_TESTDMA = yobj-$(CONFIG_CHAR_TESTDMA) += test-dma.o</pre><p>This will automatically build the <strong>test-dma.c</strong> code into the kernel.</p></div><!-- SECTION [2482-2992] --><h3><a name="create_a_user_test_directory" id="create_a_user_test_directory">Create a User Test Directory</a></h3><div class="level3"><p> Create a test directory for your initial user experiment:</p><pre class="code">cd uClinux-distmkdir user/test </pre><p>Add your code ( hello.c for example ) into the <strong>uClinux-dist/user/test</strong> directory.</p><p> Copy the <strong>uClinux-dist/user/ping/Makefile</strong> into the <strong>uClinux-dist/user/test</strong> directory and modify it by replacing <strong>ping</strong> with <strong>hello</strong> ( in this example ):</p><pre class="code"># simple hello makefileEXEC = helloOBJS = hello.oall: $(EXEC)$(EXEC): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS$(LDLIBS_$@))romfs: $(ROMFSINST) /bin/$(EXEC)clean: -rm -f $(EXEC) *.elf *.gdb *.o</pre></div><!-- SECTION [2993-3645] --><h3><a name="use_kernel_modules" id="use_kernel_modules">Use Kernel Modules</a></h3><div class="level3"><p> Using Kernel Modules will speed up driver development. If you are careful in your system design you will be able to <strong>insmod</strong> and <strong>rmmod</strong> the module without having to reload and reboot the kernel. Changing the <strong>linux-2.6.x/drivers/char/Makefile</strong> to</p><pre class="code">CONFIG_CHAR_TESTDMA = mobj-$(CONFIG_CHAR_TESTDMA) += test-dma.o</pre><p>Will turn your test driver into a module.</p><p>The system <strong>make</strong> will automatically build modules and place them in the correct location in the target root file system.</p><p> <strong>Loadable Modules</strong> </p></div><!-- SECTION [3646-4279] --><h3><a name="ftp_target_transfer" id="ftp_target_transfer">FTP Target Transfer</a></h3><div class="level3"><p> You can send updates to the target using <strong><acronym title="File Transfer Protocol">FTP</acronym></strong> instead of always downloading a new image. On the target set up the ethernet device:</p><pre class="code">ifconfig eth0 192.168.1.200 </pre><p>On the host, start the ftp service. Use <strong>root</strong> as a login name and <strong>uClinux</strong> as a password:</p><pre class="code">ftp 192.168.1.200Connected to 192.168.1.200.220 blackfin FTP server (GNU inetutils 1.4.1) ready.Name (192.168.1.200:philwil): root331 Password required for root.Password:230-230- Welcome to:230- ____ _ _230- / __| ||_| _ _230- _ _| | | | _ ____ _ _ \ \/ /230- | | | | | | || | _ \| | | | \ /230- | |_| | |__| || | | | | |_| | / \230- | ___\____|_||_|_| |_|\____|/_/\_\230- |_|230-230- For further information see:230- http://www.uclinux.org/230- http://blackfin.uclinux.org/230-230 User root logged in.Remote system type is UNIX.Using binary mode to transfer files.ftp> </pre></div><!-- SECTION [4280-5291] --><h3><a name="keep_working_configurations" id="keep_working_configurations">Keep Working Configurations</a></h3><div class="level3"><p> Once you have something working use the option under <strong>make menuconfig</strong> to save the configuration settings:</p><pre class="code">Type "make menuconfig"Select **Kernel/Library/Defaults Selection --->**Select **[*] Update Default Vendor Settings**Then **exit-exit-yes**</pre><p>Then consider keeping an exact copy of the vendor target settings:</p><pre class="code">cd uClinux-distmkdir archivetar cvzf archive/MyTarget-09092005-1.tar.gz vendors/MySystem/MyTarget( change the date and version as needed )</pre></div><!-- SECTION [5292-] --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -