Pjsip Porting to Hisilicon SOC

1)HiSilicon Compiler

arm-himix100-linux.tgz or arm-himix100-linux.tgz

#Installation instructions are included in the compiler package

There is three files in the folder: arm-himix100-linux.tar.bz2, runtime_uclibc.tgz and arm-himix100-linux.install.
The arm-himix100-linux.install is a shell script to install the arm-himix100-linux toolchain.
You can use
    source ./arm-himix100-linux.install
command line to install toolchain in /opt/hisi-linux/x86-arm.

Or you can use
    source ./arm-himix100-linux.install dirname
command line to install toolchain in the "dirname" which you Specified.

For now, you can use toolchain like arm-himix100-linux-xxx in everywhere.

#After installation, if the compiler is not recognized, you need to add the following environment variables.
export PATH=/opt/hisi-linux/x86-arm/arm-himix100-linux/bin:$PATH
export PATH=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin:$PATH

 

2)pjsip cross-compile

https://www.pjsip.org/

https://www.alsa-project.org/wiki/Main_Page

_build.sh

#compiler setup
if [[ $1 = 'arm' ]]; then
compiler=`CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++`
host=arm-linux-gnueabihf
elif [[ $1 = 'himix100' ]]; then
compiler=`CC=arm-himix100-linux-gcc CXX=arm-himix100-linux-g++`
host=arm-himix100-linux
elif [[ $1 = 'himix200' ]]; then
compiler=`CC=arm-himix200-linux-gcc CXX=arm-himix200-linux-g++`
host=arm-himix200-linux
else
:
fi

#Preinstalled directory
install=${HOME}/_install

#Delete installed directory
rm -rf ${install}

#library path
pkg_config=${install}/lib/pkgconfig
lib_config=`CPPFLAGS=-I${install}/include CFLAGS=-I${install}/include LDFLAGS=-L${install}/lib`

#Delete compiled directory
for i in `ls .`
    do
    if [ -d $i ];then
    rm -rf $i
    fi
done

tar xvf alsa-lib-*
cd alsa-lib-*
./configure ${compiler} --prefix=${install} --host=${host}
make && make install
cd ..

tar xvf alsa-utils-*
cd alsa-utils-*
./configure ${compiler} --prefix=${install} --host=${host} PKG_CONFIG_PATH=${pkg_config} ${lib_config} --enable-static --enable-shared --disable-alsamixer --disable-xmlto
touch ./alsaconf/po/t-ja.gmo
touch ./alsaconf/po/t-ru.gmo
make && make install
cd ..

tar xvf pjproject-*
cd pjproject-*
./configure ${compiler} --prefix=${install} --host=${host} PKG_CONFIG_PATH=${pkg_config} ${lib_config} --enable-static --enable-shared --disable-libwebrtc
make dep
make && make install
cd ..

export PATH=$PATH:${install}/bin
export LD_LIBRARY_PATH=${install}/lib:$LD_LIBRARY_PATH
export ALSA_CONFIG_PATH=${install}/share/alsa/alsa.conf

dong@ubuntu:~/pjsip$ su
Password:
root@ubuntu:/home/dong/pjsip# ./_install.sh arm
root@ubuntu:~# tar cvf _install.tar.gz _install/
root@ubuntu:~# mv _install.tar.gz ${HOME}
dong@ubuntu:~$ sudo chmod 777 _install.tar.gz

 

4)#Compiling samples with library files

#simpleua

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${HOME}/_install/lib/pkgconfig
export PKG_CONFIG_PATH
gcc -g simpleua.c -o simpleua `pkg-config libpjproject alsa --libs --cflags`

 

#siprtp (sip + rtp)

gcc -g siprtp.c -o siprtp `pkg-config libpjproject alsa --libs --cflags`

 USAGE:
   siprtp [options]        => to start in server mode
   siprtp [options] URL    => to start in client mode

 Program options:
   --count=N,        -c    Set number of calls to create (default:1)
   --gap=N           -g    Set call gapping to N msec (default:0)
   --duration=SEC,   -d    Set maximum call duration (default:unlimited)
   --auto-quit,      -q    Quit when calls have been completed (default:no)
   --call-report     -R    Display report on call termination (default:yes)

 Address and ports options:
   --local-port=PORT,-p    Set local SIP port (default: 5060)
   --rtp-port=PORT,  -r    Set start of RTP port (default: 4000)
   --ip-addr=IP,     -i    Set local IP address to use (otherwise it will
                           try to determine local IP address from hostname)

 Logging Options:
   --log-level=N,    -l    Set log verbosity level (default=5)
   --app-log-level=N       Set app screen log verbosity (default=3)
   --log-file=FILE         Write log to file FILE
   --report-file=FILE      Write report to file FILE

 

server:

root@ubuntu:/home/dong/pjsip_example# ./siprtp -i 172.16.23.86
22:36:26.981         os_core_unix.c !pjlib 2.9 for POSIX initialized
22:36:26.981               siprtp.c  SIP UDP listening on 172.16.23.86:5060
22:36:27.030               siprtp.c  Ready for incoming calls (max=1)

Enter menu character:
  s    Summary
  l    List all calls
  h    Hangup a call
  H    Hangup all calls
  q    Quit

>>> 22:36:40.698               siprtp.c  ..Call #0 connected in 2 ms
l
List all calls:
Call #0: CONFIRMED [duration: 00:00:26.777]
   To: <sip:172.16.23.241>;tag=PKcMBzp6yhIZQG-du1TsYkW1MPmX6L5V
   Signaling quality: got 1st response in 1 ms, connected after: 2 ms
   Stream #0: audio PCMU@8000Hz, 20ms/frame, 8.00KB/s (9.06KB/s +IP hdr)
              RX stat last update: 00h:00m:02.350s ago
                 total 1.03K packets 213.02KB received (255.09KB +IP hdr)
                 pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
                       (msec)    min     avg     max     last
                 loss period:   0.000   0.000   0.000   0.000
                 jitter     :   0.000   0.451   0.750   0.500
              TX stat last update: 00h:00m:04.450s ago
                 total 1.03K packets 213.02KB sent (255.09KB +IP hdr)
                 pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
                       (msec)    min     avg     max     last
                 loss period:   0.000   0.000   0.000   0.000
                 jitter     :   0.250   0.406   0.625   0.250
             RTT delay      :   0.595   0.686   0.793   0.793

>>> 

client:

root@ubuntu:/home/dong/pjsip_example# ./siprtp -i 172.16.23.241 sip:172.16.23.86
22:36:40.719         os_core_unix.c !pjlib 2.9 for POSIX initialized
22:36:40.719               siprtp.c  SIP UDP listening on 172.16.23.241:5060
22:36:40.746               siprtp.c  Making 1 calls to sip:172.16.23.86..
22:36:40.748               siprtp.c  ....Call #0 connected in 2 ms

Enter menu character:
  s    Summary
  l    List all calls
  h    Hangup a call
  H    Hangup all calls
  q    Quit

>>> l
List all calls:
Call #0: CONFIRMED [duration: 00:00:45.817]
   To: sip:172.16.23.86;tag=PKcMBzp6yhIZQG-du1TsYkW1MPmX6L5V
   Signaling quality: got 1st response in 1 ms, connected after: 2 ms
   Stream #0: audio PCMU@8000Hz, 20ms/frame, 8.00KB/s (9.06KB/s +IP hdr)
              RX stat last update: 00h:00m:00.480s ago
                 total 2.02K packets 365.06KB received (438.07KB +IP hdr)
                 pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
                       (msec)    min     avg     max     last
                 loss period:   0.000   0.000   0.000   0.000
                 jitter     :   0.000   0.427   0.875   0.250
              TX stat last update: 00h:00m:04.337s ago
                 total 2.02K packets 365.06KB sent (438.07KB +IP hdr)
                 pkt loss=0 (0.0%), dup=0 (0.0%), reorder=0 (0.0%)
                       (msec)    min     avg     max     last
                 loss period:   0.000   0.000   0.000   0.000
                 jitter     :   0.375   0.446   0.625   0.375
             RTT delay      :   0.488   0.673   0.793   0.686

>>> 

 

5)#_install environment variables
export PATH=$PATH:$(pwd)/_install/bin
export LD_LIBRARY_PATH=$(pwd)/_install/lib:$LD_LIBRARY_PATH
export ALSA_CONFIG_PATH=$(pwd)/_install/share/alsa/alsa.conf

 

6)#hi3516 mpp environment variables
export LD_LIBRARY_PATH=$(pwd)/_install/mpp/lib/:$LD_LIBRARY_PATH

 

7)#nfs to ubuntu
1. mount /dev/sda3 /root/disk
2. minicom
3. nfs

pc:
sudo vi /etc/exports
/home/dong/_install *(rw,sync,no_root_squash,no_subtree_check)
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/rpcbind restart
sudo ifconfig eth0 172.16.23.157 broadcast 172.16.23.254 netmask 255.255.255.0


board:
ifconfig eth0 up
udhcpc -i eth0

#172.16.23.158

ifconfig eth0 172.16.23.158 broadcast 172.16.23.254 netmask 255.255.255.0
mount -t nfs -o nolock 172.16.23.157:/home/dong/_install /root/_install

 

8)loader soc driver

cd /_install/mpp/ko

chmod +x *

~/_install/mpp/ko # ./load3516ev300                                             
mmz_start: 0x42000000, mmz_size: 96M                                            
Usage:  ./load3516ev300 [-option] [sensor_name]                                 
options:                                                                        
    -i                       insert modules                                     
    -r                       remove modules                                     
    -a                       remove modules first, then insert modules          
    -sensor sensor_name      config sensor type [default: imx307]               
    -h                       help information                                   
Available sensors: imx307 imx327 sc4236 etc.                                    
for example: ./load3516ev300 -i -sensor imx307 -osmem 32M -board demo -yuv0 0   
                                                                                
~/_install/mpp/ko # ./load3516ev300 -i -sensor imx307 -osmem 32M -board demo -yuv0 0                                                                            
sh: 32M: bad number                                                             
mmz_start: 0x42000000, mmz_size: 96M                                            
sys_config: loading out-of-tree module taints kernel.                           
==== online_flag=0, cmos_yuv_flag=0, sensor=imx307, chip=hi3516ev300, board=dem=
==== g_quick_start_flag=0 ====                                                  
sysconfig init success!                                                         
Module himedia: init ok                                                         
Hisilicon Media Memory Zone Manager                                             
hi_osal 1.0 init success!                                                       
hi3516ev200_base: module license 'Proprietary' taints kernel.                   
Disabling lock debugging due to kernel taint                                    
load sys.ko for Hi3516EV200...OK!                                               
load tde.ko for HI3516EV200...OK!                                               
load region.ko for Hi3516EV200...OK!                                            
load vgs.ko for Hi3516EV200...OK!                                               
load vi.ko for Hi3516EV200...OK !                                               
ISP Mod init!                                                                   
load vpss.ko for Hi3516EV200...OK!                                              
load vo.ko for Hi3516EV200...OK!                                                
load hifb.ko OK!                                                                
load chnl.ko for Hi3516EV200...OK!                                              
load vedu.ko for Hi3516EV200...OK!                                              
load rc.ko for Hi3516EV200...OK!                                                
load venc.ko for Hi3516EV200...OK!                                              
load h264e.ko for Hi3516EV200...OK!                                             
load h265e.ko for Hi3516EV200...OK!                                             
load jpege.ko for Hi3516EV200...OK!                                             
load ive.ko for Hi3516EV200...OK!                                               
Load sensor_spi.ko for Hi3516EV200...OK !                                       
load hi_piris.ko OK!!                                                           
insert audio                                                                    
load mipi_rx driver successful!                                                 
~/_install/mpp/ko #

9)enable soc audio pin

audio_enable.sh

cd /sys/class/gpio
echo 8 > export
cd gpio8
echo out > direction
sleep 1
echo 1 > value 

 

10)mpp sample

cd /root/_install/mpp/sample/audio

./sample 0 48000

 

posted @ 2019-02-22 11:25  dong1  阅读(992)  评论(0编辑  收藏  举报