⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run_java_application_on_stamp_board.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 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><h2><a name="run_java_application_on_stamp_board" id="run_java_application_on_stamp_board">Run Java application on stamp board</a></h2><div class="level2"><p>This  section will describe how to setup a java runtime environment to run your java application. Now we select kaffe JVM as our java runtime environment.You can visit its official website <a href="http://www.kaffe.org" class="urlextern" title="http://www.kaffe.org"  rel="nofollow">http://www.kaffe.org</a> to get more information.</p></div><h4><a name="step_by_step_instructions" id="step_by_step_instructions">Step by Step Instructions</a></h4><div class="level4"><ul><li class="level1"><div class="li"> First you want to make sure you have the latest sources from <acronym title="Concurrent Versions System">CVS</acronym> for the toolchain and the kernel.  For more information on this please refer to the <a href="version_control_systems.html#cvs_quickstart" class="wikilink1" title="version_control_systems.html">CVS Quickstart</a>.</div></li></ul><ul><li class="level1"><div class="li"> Next you must build and install the toolchain.  If you are unsure on how to do this please see <a href="toolchain_build_script.html" class="wikilink1" title="toolchain_build_script.html">Toolchain Build Script</a>.</div></li></ul><ul><li class="level1"><div class="li"> After the toolchain has finished building you must add the toolchain to your <strong>PATH</strong>.  Please refer to <a href="installing_the_blackfin_tool_chain.html#setting_the_path_environment_variable" class="wikilink1" title="installing_the_blackfin_tool_chain.html">Setting the PATH Environment</a> for more details.</div></li></ul><ul><li class="level1"><div class="li"> Next <em>cd</em> into the freshly downloaded kernel directory, <strong>uClinux-dist</strong>.</div></li></ul><pre class="code">user@linux:~/checkouts/kernel/uClinux-dist&gt; cd where/you/put/uClinux-dist</pre><ul><li class="level1"><div class="li"> Now enter the command:</div></li></ul><pre class="code">user@linux:~/checkouts/kernel/uClinux-dist&gt; make clean</pre><ul><li class="level1"><div class="li"> Next enter the following command to configure your kernel:</div></li></ul><pre class="code">user@linux:~/checkouts/kernel/uClinux-dist&gt; make menuconfig</pre><ul><li class="level1"><div class="li"> In the make menuconfig menu select some required options.In fact, kaffe is not depend any library and special kernel features.</div></li></ul><p>    </p><ul><li class="level1"><div class="li"> Now <strong>Save and Exit</strong></div></li></ul><ul><li class="level1"><div class="li"> When you get back to the command line. Issue a make to create the kernel image.</div></li></ul><pre class="code">user@linux:~/checkouts/kernel/uClinux-dist&gt;  make</pre><ul><li class="level1"><div class="li"> After the make finishes, copy the linux image to your tftp directory. (For more information setting up a tftp server please see <a href="setting_up_a_tftp_server.html" class="wikilink1" title="setting_up_a_tftp_server.html">Setting up a TFTP Server</a>.)</div></li></ul><pre class="code">user@linux:~/checkouts/kernel/uClinux-dist&gt; cp ./images/linux /tftpboot/linux</pre><ul><li class="level1"><div class="li"> Tftp the file to your target and boot the kernel using U-Boot. (For more information on using U-Boot please see <a href="das_u-boot_on_blackfin.html" class="wikilink1" title="das_u-boot_on_blackfin.html">Das U-Boot on Blackfin</a>.)</div></li></ul><pre class="code">stamp&gt; tftp 0x1000000 linuxstamp&gt; bootelf</pre><ul><li class="level1"><div class="li"> Because java library files is too large, we can not place the whole JVM into image.So we will transfer them by network after the uClinux is booted.You also can add some commands in /etc/rc script so that file transfer and enviorment setup can be executed automatically. </div></li></ul><p>.Now we assume the uClinux system is booted normally and network work very well. The following is about how to compile the kaffe.</p><ul><li class="level1"><div class="li"> Before we cross-compile the kaffe, we need to compile jikes and kaffe natively and jikes should be compiled before kaffe. Download them from <a href="http://jikes.sourceforge.net/" class="urlextern" title="http://jikes.sourceforge.net/"  rel="nofollow">http://jikes.sourceforge.net/</a> and <a href="http://www.kaffe.org.Use" class="urlextern" title="http://www.kaffe.org.Use"  rel="nofollow">http://www.kaffe.org.Use</a> your native compiler to compile them on your host.Assume we install them to /opt/jikes and /opt/kaffe separately. Download jikes-1.22.tar.bz2 package from jikes website,and extract the package, run following command:</div></li></ul><pre class="code">./configure --prefix=/opt/jikes/makemake installexport PATH=$PATH:/opt/jikes/bin</pre><pre class="code">  Download kaffe-1.1.6.tar.gz and extract the package,run the following command:</pre><pre class="code">./configure --prefix=/opt/kaffe/makemake installexport PATH=$PATH:/opt/kaffe/bin</pre><ul><li class="level1"><div class="li"> Then we can download kaffe source for blackfin from our <acronym title="Concurrent Versions System">CVS</acronym> repository(located at blkbfin-apps/kaffe).</div></li></ul><ul><li class="level1"><div class="li"> For build convience, we add a script named BUILD.bfin under top directory of kaffe source. You can modify some variables to meet your environment. Then enter kaffe source directory and run the script as the following:</div></li></ul><pre class="code">chmod +x BUILD.bfin./BUILD.bfinmake</pre><p> Then the whole build procedure begins.... After several minutes(due to the speed of your machine), kaffe compilation should be finished. At the same time, java class library is also compiled and located at libraries directory under kaffe source. For java application can run normally we should increase the stack size of kaffe-bin program. run the command: </p><pre class="code">bfin-uclinux-flthdr -s 1048576 -o kaffe.flt kaffe/kaffe/kaffe-bin</pre><p> Now we need to transfer some files required by java application to stamp board by ftp or rcp program. Now we take a simple example that classic helloworld application written by java can run on the stamp board. We write the helloworld java program named HelloWorldApp.java,its content as the following:</p><pre class="code">class HelloWorldApp {    public static void main(String[] args) {        //Display &quot;Hello World!&quot;        System.out.println(&quot;Hello World!&quot;);    }}</pre><p> Use any java compile to compile the program to java byte code file named HelloWorldApp.class.Take for an example by Sun java compiler in the following command: </p><pre class="code">javac HelloWorldApp.java</pre><p> Then transfer this class file to stamp board.Also we transfer the following files: </p><pre class="code">kaffe/kaffe/kaffe.flt from kaffe source of host machine to /bin of stamp boardlibraries/clib/native/.libs/libnative.a from kaffe source of host machine to /var/lib of stamp boardlibraries/clib/native/.libs/libnative.la from kaffe source of host machine to /var/lib of stamp boardlibraries/clib/nio/.libs/libnio.a from kaffe source of host machine to /var/lib of stamp boardlibraries/clib/nio/.libs/libnio.la from kaffe source of host machine to /var/lib of stamp boardlibraries/clib/io/.libs/libio.a from kaffe source of host machine to /var/lib of stamp boardlibraries/clib/io/.libs/libio.la from kaffe source of host machine to /var/lib of stamp boardlibraries/javalib/rt.jar from kaffe source of host machine to /var/lib of stamp boardlibraries/javalib/tools.jar from kaffe source of host machine to /var/lib/ of stamp board</pre><p>Then we need to setup some environment: </p><pre class="code">export KAFFELIBRARYPATH=/var/lib</pre><p> All these step is done, we can run our HelloWorld application by type the command: </p><pre class="code">kaffe.flt -Xbootclasspath:/var/lib/rt.jar HelloWorldApp</pre><p> You will see the output: </p><pre class="code">Hello World!</pre><p>Know issues:</p><p>* Not all the java testcases under kaffe/test can run.I tried HelloWorld and file operation related testcases run normally,but some cases maybe fail.</p><p>* Sometimes java application will hang, you can kill it by Ctrl+C.</p></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -