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

📄 adeos.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><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="level1"><div class="li"><span class="li"><a href="#xenomai_adeos_porting_for_bf533_stamp" class="toc">Xenomai/Adeos porting for BF533 STAMP</a></span></div><ul class="toc"><li class="level2"><div class="li"><span class="li"><a href="#real-time_on_linux" class="toc">Real-time on Linux</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#adeos_and_xenomai" class="toc">Adeos and Xenomai</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#enable_adeos_and_xenomai_on_bf533" class="toc">Enable Adeos and Xenomai on BF533</a></span></div><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#prepare_kernel_source_toolchain_and_patches" class="toc">Prepare kernel source, toolchain and patches</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#apply_adeos_and_xenomai_kernel_patch_to_the_blackfin-uclinux_kernel" class="toc">Apply Adeos and Xenomai kernel patch to the blackfin-uclinux kernel</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#build_image_and_run_test_cases" class="toc">Build image and run test cases</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#details_about_the_latency_test_case" class="toc">Details about the latency test case</a></span></div></li></ul></li><li class="level2"><div class="li"><span class="li"><a href="#links_to_adeos_and_xenomai" class="toc">Links to Adeos and Xenomai</a></span></div></li><li class="level2"><div class="li"><span class="li"><a href="#other_resources" class="toc">Other resources</a></span></div></li></ul></li></ul></div></div><h1><a name="xenomai_adeos_porting_for_bf533_stamp" id="xenomai_adeos_porting_for_bf533_stamp">Xenomai/Adeos porting for BF533 STAMP</a></h1><div class="level1"></div><!-- SECTION [1-53] --><h2><a name="real-time_on_linux" id="real-time_on_linux">Real-time on Linux</a></h2><div class="level2"><p>There are usually two approaches to make Linux real-time.</p><ul><li class="level1"><div class="li"> Using a sencond kernel to schedule real-time tasks: solutions include Xenomai/ADEOS and RTLinux, RTAI, etc.</div></li><li class="level1"><div class="li"> Improve Linux kernel itself with regards to preemption, low latency, etc. See the real-time preemption patch: <a href="http://people.redhat.com/~mingo/realtime-preempt/" class="urlextern" title="http://people.redhat.com/~mingo/realtime-preempt/"  rel="nofollow">http://people.redhat.com/~mingo/realtime-preempt/</a>.</div></li></ul></div><!-- SECTION [54-420] --><h2><a name="adeos_and_xenomai" id="adeos_and_xenomai">Adeos and Xenomai</a></h2><div class="level2"><p> The purpose of Adeos is to provide a flexible environment for sharing hardware resources among multiple operating systems, or among multiple instances of a single <acronym title="Operating System">OS</acronym>. It has been ported to BF533 STAMP board based on blackfin-uclinux 2005R4 release. ADEOS delievers system events (e.g. interrupts, execptions) in a timely and prioritized manner, along a &ldquo;pipe line&rdquo; of domains.</p><p>Xenomai is a real-time development framework cooperating with the Linux kernel, in order to provide a pervasive, interface-agnostic, hard real-time support to user-space applications, seamlessly integrated into the GNU/Linux environment. Xenomai is based on Adeos. Xenomai real-time nucleus and Linux kernel are in two ADEOS domains.</p><p>This chapter will guide you through the steps to run Xenomai on BF533 STAMP.</p></div><!-- SECTION [421-1242] --><h2><a name="enable_adeos_and_xenomai_on_bf533" id="enable_adeos_and_xenomai_on_bf533">Enable Adeos and Xenomai on BF533</a></h2><div class="level2"></div><!-- SECTION [1243-1289] --><h3><a name="prepare_kernel_source_toolchain_and_patches" id="prepare_kernel_source_toolchain_and_patches">Prepare kernel source, toolchain and patches</a></h3><div class="level3"><ol><li class="level1"><div class="li"> Download Adeos patch. The <a href="http://download.gna.org/adeos/patches/v2.6/blackfin/adeos-ipipe-2.6.12-bf533-1.2-00.patch" class="urlextern" title="http://download.gna.org/adeos/patches/v2.6/blackfin/adeos-ipipe-2.6.12-bf533-1.2-00.patch"  rel="nofollow">most recent patch</a> is based on blackfin-uclinux 2005R4 release.</div></li><li class="level1"><div class="li"> Download Xenomai. We use the <a href="http://download.gna.org/xenomai/stable/xenomai-2.1.tar.bz2" class="urlextern" title="http://download.gna.org/xenomai/stable/xenomai-2.1.tar.bz2"  rel="nofollow">most recent release v2.1</a>.</div></li><li class="level1"><div class="li"> Download blackfin-uclinux source. We use the <a href="http://blackfin.uclinux.org/frs/download.php/771/uClinux-dist-R05R4-RC2.tar.bz2" class="urlextern" title="http://blackfin.uclinux.org/frs/download.php/771/uClinux-dist-R05R4-RC2.tar.bz2"  rel="nofollow">2005R4-RC2 release</a>. </div></li><li class="level1"><div class="li"> Download blackfin-uclinux toolchain. We use the <a href="http://blackfin.uclinux.org/frs/download.php/793/bfin-binary-05r4-6.tar.gz" class="urlextern" title="http://blackfin.uclinux.org/frs/download.php/793/bfin-binary-05r4-6.tar.gz"  rel="nofollow">2005R4-RC1 release</a>. Add the install path of toolchain to the PATH environment variable.</div></li></ol><p> After downloading, unzip the patch and kernel source.</p></div><!-- SECTION [1290-2082] --><h3><a name="apply_adeos_and_xenomai_kernel_patch_to_the_blackfin-uclinux_kernel" id="apply_adeos_and_xenomai_kernel_patch_to_the_blackfin-uclinux_kernel">Apply Adeos and Xenomai kernel patch to the blackfin-uclinux kernel</a></h3><div class="level3"><p>In the following example, $xenomai-root is the path of the xenomai.</p><p>$adeos-patch-dir is the path of the Adeos patch.</p><p>$uClinux-dist is the path of of blackfin-uclinux release, for example: /home/test/uClinux-dist</p><p>$linux-tree is the path of the blackfin-uclinux kernel source, for example: /home/test/uClinux-dist/linux-2.6.x </p><ul><li class="level1"><div class="li"> Run the Xenomai configuration script to apply the kernel patch:</div></li></ul><pre class="code">    adam@linux&gt; $xenomai-root/scripts/prepare-kernel.sh --arch=blackfin \                --adeos=$adeos-patch-dir/adeos-ipipe-2.6.12-bf533-1.2-00.patch \                --linux=$linux-tree</pre><p>When the patches successfully applied, there is message showing &ldquo;Build system ready&rdquo;</p><ul><li class="level1"><div class="li"> Configure and build kernel</div></li></ul><pre class="code">    adam@linux&gt; cd $uClinux-dist    adam@linux&gt; make menuconfig</pre><p> Select BF533-STAMP and save. </p><pre class="code">    Vendor/Product Selection  ---&gt;       [*](BF533-STAMP) AnalogDevices Products</pre><ul><li class="level1"><div class="li"> After exiting from &ldquo;make menuconfig&rdquo;, select the default configuration for Xenomai (just return at each promption).</div></li></ul><pre class="code">    *    * Real-time sub-system    *    Xenomai (XENOMAI) [Y/n] (NEW) Y      Nucleus (XENO_OPT_NUCLEUS) [Y/n] (NEW) Y    ... ...</pre><pre class="code">  adam@linux&gt; cd $linux-tree  adam@linux&gt; make menuconfig</pre><p> Keep the default configuration as:</p><pre class="code">[*] Interrupt pipeline (NEW)[ ]   Collect statistics (NEW)Real-time sub-system  ---&gt;[*] Xenomai (NEW)[*]   Nucleus (NEW)[*]     Pervasive real-time support in user-space (NEW)[*]     Message pipes (NEW)(32)      Number of pipe devices (NEW)(128)   Size of the system heap (Kb) (NEW)[ ]     Interrupt shield support (NEW)[*]     Statistics collection (NEW)[ ]     Debug support (NEW)[ ]     Watchdog support (NEW)        Scalability  ---&gt;         Machine  ---&gt;                Interfaces  ---&gt;     Drivers  ---&gt;  </pre></div><!-- SECTION [2083-4024] --><h3><a name="build_image_and_run_test_cases" id="build_image_and_run_test_cases">Build image and run test cases</a></h3><div class="level3"><ul><li class="level1"><div class="li"> Build uclinux kernel and applications:</div></li></ul><pre class="code">    adam@linux&gt; cd $uClinux-dist    adam@linux&gt; make</pre><ul><li class="level1"><div class="li"> Build Xenomai applications and install the applications to uclinux romfs directory</div></li></ul><p>    $build-root is a directory to build xenomai application.</p><pre class="code">    adam@linux&gt; mkdir $build-root     adam@linux&gt; cd $build-root    adam@linux&gt; $xenomai-root/configure --build=i686-pc-linux-gnu \                 --host=bfinnommu-unknown-linux-gnu CC=bfin-uclinux-gcc CXX=bfin-uclinux-gcc \                 AR=bfin-uclinux-ar LD=bfin-uclinux-ld --disable-shared CFLAGS=-Wl,-elf2flt    adam@linux&gt; make install DESTDIR=$uClinux-dist/romfs    adam@linux&gt; cd $uClinux-dist    adam@linux&gt; make image</pre><p> &ldquo;&rsquo;&rdquo;&ldquo;&rdquo; image is created as $uClinux-dist/images/linux</p><ul><li class="level1"><div class="li"> Download the image to BF533 STAMP (make sure to use REV 1.2 board) and boot</div></li></ul><ul><li class="level1"><div class="li"> Run the sample test case on BF533 STAMP:</div></li></ul><pre class="code">    root: cd /usr/xenomai/testsuite/latency    root: ./latency -h</pre></div><!-- SECTION [4025-5285] --><h3><a name="details_about_the_latency_test_case" id="details_about_the_latency_test_case">Details about the latency test case</a></h3><div class="level3"><p>This &ldquo;latency&rdquo; example program features a periodic real-time thread measuring its scheduling latency over periods of 100 us. Each second, results are posted by the sampling thread to a display thread, which in turn outputs the latency figures to the screen using standard Linux services. This illustrates the seamless migration of Xenomai&rsquo;s real-time threads between the Xenomai and Linux schedulers, in order to perform every system call issued by xeno-enabled Linux tasks from the proper execution context. </p><ul><li class="level1"><div class="li"> The source code of this &ldquo;latency&rdquo; test case is in: src/testsuite/latency/latency.c</div></li><li class="level1"><div class="li"> The source code of &ldquo;timer benchmark driver&rdquo; is in: ksrc/drivers/benchmark/timerbench.c </div></li><li class="level1"><div class="li"> Tow kernel options affects the latency result. When programing a timers, bellow two values will be substracted from the timer expire period for calibration:</div><ul><li class="level2"><div class="li"> XENO_OPT_TIMING_TIMERLAT: for this test, we keep the default estimation: 100 CPU cycle<pre class="code">        &quot;Timer tuning latency (ns)&quot;        default 0        This parameter accounts for the time (in nanoseconds) needed        to program the underlying timer hardware in aperiodic        (one-shot) timing mode.        This value will be used to reduce the scheduling jitter induced        by the time needed to setup the timer for its next shot. A        default value of 0 (recommended) will cause this value to be        estimated by the nucleus at startup.</pre></div></li><li class="level2"><div class="li"> XENO_OPT_TIMING_SCHEDLAT: Here we set it as 1 ns, that is, ignore it.<pre class="code">        &quot;Scheduling latency (ns)&quot;        default 0        Scheduling latency is the time between the termination of an        interrupt handler and the execution of the first instruction        of the real-time thread this handler resumes. A default value        of 0 (recommended) will cause a pre-calibrated value to be        used.</pre></div></li></ul></li></ul></div><h4><a name="three_test_modes" id="three_test_modes">Three test modes</a></h4><div class="level4"><p>This test has three test modes, depending on the &ldquo;-t&rdquo; option.  <strong>These test result are based on BF533 with core clock (398MHz). But these data may <em class="u">NOT</em> be meaningful at all, since the measurement itself is proper or not is yet to be investigated. (E.g, how to give the SCHEDLAT a correct value to calibrate the time. The only purpose is to help you get started with Xenomai with uClinux on Blackfin platform. That is, please do <em class="u">NOT</em> be too serious about the test result ;)</strong></p></div><h5><a name="user_space_task" id="user_space_task">User space task</a></h5><div class="level5"><p>Real-time thread is created in user space, using the rt_task_create() function. </p><p>latency.c </p><pre class="code">     rt_task_create(&amp;latency_task,&quot;sampling&quot;,0,99,T_FPU); // Create a real-time task named &quot;sampling&quot;, with priority 99                                                          // and default stack size      rt_task_start(&amp;latency_task,&amp;latency,NULL); // start the real-time task, calling the &quot;latency()&quot; routine </pre><p>&ldquo;&rdquo; <acronym title="Application Programming Interface">API</acronym>&ldquo;&rdquo;<acronym title="Application Programming Interface">API</acronym> </p><p>The &ldquo;sampling&rdquo; thread calls  </p><pre class="code">int rt_task_set_periodic  (RT_TASK * task, RTIME idate, RTIME period)</pre><p> to &ldquo;Make a task periodic by programing its first release point and its period in the processor time line&rdquo;. In this case, by default, the timer expires every 100us.</p><p>Then &ldquo;sampling&rdquo; thread repeatly calls锛

⌨️ 快捷键说明

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