导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    OK113i-S开发板-3测试实时系统

    飞凌嵌入式专区
    2
    2
    2297
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • B
      BSPlayer LV 3 最后由 BSPlayer 编辑

      前言
      OK113i-S开发板上测试实时linux系统的效果

      Linux下的实时系统有三种方案:这三种方案各有优缺点

      1.PREEMPT-RT:PREEMPT-RT是一个基于Linux内核的实时补丁,也被称为Real-Time(RT)补丁。它通过增加内核的可抢占性,使得Linux内核能够实现实时性能。PREEMPT-RT补丁提供了可配置的实时选项,可以根据应用程序的需求进行调整。这个版本跟内核的版本匹配很细致,几乎每一个内核的小版本都有配套的补丁。

      2.Xenomai:Xenomai提供了一个实时框架,为Linux操作系统添加了实时性能。它支持具有硬实时和软实时要求的应用程序,并通过分时多任务和抢占式调度来提供可预测性。
      这个系统就版本变化比较多,4之前是pipe,5后面是Dovetail,而且与内核版本匹配不太紧密,

      3.RTAI(Real-Time Application Interface):RTAI是一个开源实时应用程序接口,提供了类似API的接口和实时任务调度。它在Linux内核上运行,并通过插入抢占式调度器来实现实时性能。

      这里我们测试一下PREEMPT-RT的效果。

      编译desktop系统

      首先我们编译一个desktop的系统版本,官方提供的镜像是默认的PREEMPT-RT的。
      默认配置如下

      rt-low.png

      我们选择Desktop,

      rt-3.png
      选择Desktop,

      然后退出保存。

      Cp  ~/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig  ok-def
      Cp .config  ~/OK113i-linux-sdk/kernel/linux-5.4/arch/arm/configs/OK113I_linux_defconfig
      ~/OK113i-linux-sdk/build.sh kernel
      
      

      编译测试程序

      为了测试对比效果,我们还需要编译一个测试程序rt-test

      进入OK113i-linux-sdk/buildroot/buildroot-201902
      make menuconfig ARCH=arm
      
      选择
         Target packages
           Debugging,profileing and benchmark
      

      rt0.png

      然后OK113i-linux-sdk/buildroot/buildroot-201902/build.sh
      
      最后 ~/OK113i-linux-sdk/build.sh  pack
      Cp  ~/OK113i-linux-sdk/out/t113_i_linux_ok113i_uart0.img  t113-desk.img
      

      测试效果

      我们测试两个系统镜像,一个是desktop版本t113-desk.img,
      一个是PREEMPT-RT版本,下面是运行的测试结果

      我们这里就比较几个简单的命令coremark,和cyclictest
      cyclictest -t 5 -p 80 ,5个任务跑80个进程,计算时间

      ==============
      Desktop

      root@ok113i:/#uname -a
      Linux ok113i 5.4.61 #3 SMP Mon Dec 18 14:42:10 CST 2023 armv7l GNU/Linux
      
      root@ok113i:/# /usr/bin/coremark
      2K performance run parameters for coremark.
      CoreMark Size    : 666
      Total ticks      : 17257
      Total time (secs): 17.257000
      Iterations/Sec   : 3476.849974
      Iterations       : 60000
      Compiler version : GCC7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701]
      Compiler flags   : -O2   -lrt
      Memory location  : Please put data memory location here
                              (e.g. code in flash, data on heap etc)
      seedcrc          : 0xe9f5
      [0]crclist       : 0xe714
      [0]crcmatrix     : 0x1fd7
      [0]crcstate      : 0x8e3a
      [0]crcfinal      : 0xbd59
      Correct operation validated. See readme.txt for run and reporting rules.
      CoreMark 1.0 : 3476.849974 / GCC7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] -O2   -lrt / Heap
      
      root@ok113i:/# cyclictest -t 5 -p 80 
       //5个任务跑80个进程,计算时间
      # /dev/cpu_dma_latency set to 0us
      policy: fifo: loadavg: 1.09 0.80 0.38 2/70 1575
      policy: fifo: loadavg: 1.17 0.82 0.39 1/68 1576
      T: 0 ( 1517) P:80 I:1000 C:   9393 Min:     10 Act:   20 Avg:   15 Max:     152
      T: 0 ( 1517) P:80 I:1000 C:  11554 Min:     10 Act:   11 Avg:   15 Max:     754
      T: 1 ( 1518) P:80 I:1500 C:   7702 Min:     10 Act:   11 Avg:   14 Max:     140
      T: 2 ( 1519) P:80 I:2000 C:   5773 Min:     10 Act:   11 Avg:   16 Max:    4850
      T: 3 ( 1520) P:80 I:2500 C:   4619 Min:     10 Act:   12 Avg:   17 Max:    5174
      T: 4 ( 1521) P:80 I:3000 C:   3850 Min:     10 Act:   11 Avg:   16 Max:    4726
       Disable gpadc0
      policy: fifo: loadavg: 1.06 0.85 0.43 1/72 1634
      

      ===========
      PREEMPT-RT

      root@ok113i:/# coremark
      2K performance run parameters for coremark.
      CoreMark Size    : 666
      Total ticks      : 17200
      Total time (secs): 17.200000
      Iterations/Sec   : 3488.372093
      Iterations       : 60000
      Compiler version : GCC7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701]
      Compiler flags   : -O2   -lrt
      Memory location  : Please put data memory location here
                              (e.g. code in flash, data on heap etc)
      seedcrc          : 0xe9f5
      [0]crclist       : 0xe714
      [0]crcmatrix     : 0x1fd7
      [0]crcstate      : 0x8e3a
      [0]crcfinal      : 0xbd59
      Correct operation validated. See readme.txt for run and reporting rules.
      CoreMark 1.0 : 3488.372093 / GCC7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] -O2   -lrt / Heap
      
      root@ok113i:/# cyclictest -t 5 -p 80 
       //5个任务跑80个进程,计算时间
      # /dev/cpu_dma_latency set to 0us
      policy: fifo: loadavg: 1.00 0.67 0.30 1/79 1651
      
      T: 0 ( 1647) P:80 I:1000 C:  85352 Min:     13 Act:   16 Avg:   16 Max:      57
      T: 1 ( 1648) P:80 I:1500 C:  56901 Min:     13 Act:   16 Avg:   15 Max:      74
      T: 2 ( 1649) P:80 I:2000 C:  42671 Min:     13 Act:   16 Avg:   15 Max:      39
      T: 3 ( 1650) P:80 I:2500 C:  34136 Min:     13 Act:   20 Avg:   16 Max:      51
      T: 4 ( 1651) P:80 I:3000 C:  28447 Min:     13 Act:   16 Avg:   16 Max:      80
      

      =========

      可以看到 Total time相差不大,但是 cyclictest 的Max时间是大大减少的。 可看到Linux-RT内核与普通Linux内核相比,系统延时更加稳定,平均延时、最大延时更低,系统实时性更佳

      PREEMPT-RT和xenomai

      在buildroot里面,大家可以选择xenomai系统进行选择,对比效果

      微信截图_20231219163741.png

      这两个的测试结果就不太明显,因为我们的软件没有严格限制,这里就不详细介绍了。感兴趣的可以学习相关内容。

      附录
      实时系统镜像
      Dedktop系统镜像

      OK113i-S开发板体验-1开箱和基本使用
      OK113i-S开发板-2适配10寸LCD显示
      OK113i-S开发板-3测试实时系统
      OK113i-S开发板-4视频编解码测试

      1 条回复 最后回复 回复 引用 分享 3
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • Referenced by  B BSPlayer 
      • xiaogcc23333
        xiaogcc23333 LV 4 最后由 编辑

        @bsplayer 在 OK113i-S开发板-3测试实时系统 中说:

        2.Xenomai:Xenomai提供了一个实时框架,为Linux操作系统添加了实时性能。它支持具有硬实时和软实时要求的应用程序,并通过分时多任务和抢占式调度来提供可预测性。
        这个系统就版本变化比较多,4之前是pipe,5后面是Dovetail,而且与内核版本匹配不太紧密,

        大佬,T113-i可以打dovetail上xenomai3.0吗?我看到xenomai官方说至少5.10的内核就给我劝退了.. 尝试打ipipe上xenomai2.6,编译有个TSC的错误。求教...
        47103b96-5de4-484b-b018-0ed62eadda49-图片.png

        1 条回复 最后回复 回复 引用 分享 0
        • 1 / 1
        • First post
          Last post

        Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

        行为准则 | 用户协议 | 隐私权政策