概述
编译环境:Ubuntu16.04 64位
交叉编译工具:arm-himix200-linux-gcc
文章目录
- 1. SDK交叉编译安装
- 2. uboot编译
- 3. kernel编译
- 4. 文件系统制作
- 5. sample代码修改
1. SDK交叉编译安装
tar zxf Hi3519AV100_SDK_V2.0.1.0.tgz
cd Hi3519AV100_SDK_V2.0.1.0/
./sdk.unpack
tar zxf arm-himix200-linux.tgz
cd arm-himix200-linux/
chmod 777 arm-himix200-linux.install
sudo ./arm-himix200-linux.install
source /etc/profile
2. uboot编译
cp configs/hi3519av100_nand_defconfig .config
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- menuconfig
make ARCH=arm CROSS_COMPILE=arm-himix200-linux-
cp ../../../tools/pc/uboot_tools/reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- u-boot-z.bin
将生成可用的 u-boot-hi3519av100.bin 镜像文件
问题一:HiTool无法烧写uboot,提示“发送数据帧失败,请检查串口连接线是否正常”,但是串口读写均正常?
在“Demo单板使用指南”发现 :
BOOTROM 串口通信模式
0:直接从启动介质启动;
1:进入串口烧写 Flash 模式。
对应硬件BOOT_SEL2上拉,测试正常。
3. kernel编译
cp arch/arm/configs/hi3519av100_smp_defconfig .config
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- menuconfig
make ARCH=arm CROSS_COMPILE=arm-himix200-linux- uImage
问题二:串口烧写uboot成功后,uboot无法通过网口烧写kernel?
问题原因是demo板使用的RTL8211千兆,rgmii模式,phy地址1,我的底板使用的是RTL8201百兆,phy地址0,需要修改uboot,修改hi3519av100.h:
#define CONFIG_HIGMAC_PHY0_ADDR 0
#define CONFIG_HIGMAC_PHY0_INTERFACE_MODE 1 /* rgmii 2, rmii 1*/
修改寄存器配置xml:
IOCFG_REG110寄存器地址0x47e0050参数从0x71改为0x72,RMII_CLK,生成reg_info.bin,用来制作uboot,重新烧录uboot后,可以通过网口烧录kernel
问题三:内核修改为百兆网卡?
修改hi3519av100.dts:
&mdio {
ethphy: ethernet-phy@1 {
reg = <0>;
};
};
&higmac {
phy-handle = <ðphy>;
phy-mode = "rmii";
};
烧录后,内核打印“ETH: rmii, phy_addr=0”
问题四:添加串口设备?
hi3519av100.dtsi文件aliases项添加如下:
serial1 = &uart1;
serial2 = &uart2;
serial3 = &uart3;
hi3519av100.dts添加:
&uart1 {
status = "okay";
};
&uart2 {
status = "okay";
};
&uart3 {
status = "okay";
};
警告:uart3不要使用管脚DSI_D3N和DSI_D3P,建议硬件使用LCD_DATA0和LCD_DATA1
问题五:内核添加组播支持?
menuconfig配置
[*] Networking support --->
Networking options --->
[*]IP: multicasting
[*]IP: multicast routing
[*]IP: PIM-SM version 1 support
[*]IP: PIM-SM version 2 support
保存后.config会添加如下修改:
CONFIG_IP_MULTICAST=y
CONFIG_IP_MROUTE=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
注:部分路由器添加IGMP snooping,需要应用程序中使用IP_ADD_MEMBERSHIP加入组播组,否则路由器会不做转发。
4. 文件系统制作
基于SDK提供的rootfs,将SDK中ko目录拷贝到root目录下,并添加start.sh脚本如下:
#!/bin/sh
cd ko/ && ./load3519av100 -i -sensor0 bt1120 -sensor1 imx290 -offline
为什么这么写?
分析load3519av100脚本,insmod sys_config.ko对应的sensor参数,这里可以看SDK中的sys_config.c,结合我的硬件原理图,mipi0对接I2C1_SCL和I2C1_SDA,BT1120接cmos0,start.sh这样写正好满足相应的寄存器配置。
另外可以添加eth0网口配置如下,方便搭建nfs测试:
ifconfig eth0 192.168.1.100 up
route add default gw 192.168.1.1
telnetd &
mount -t nfs -o nolock 192.168.1.246:/home/jerry/work /tmp
#这里挂载的是我的ubuntu工作目录
执行命令生成镜像
./mkyaffs2image100 ./rootfs rootfs_test 1 4
参数可以看uboot串口打印和mkyaffs2image100的用法
5. sample代码修改
Makefile.param修改如下:
SENSOR0_TYPE ?= SONY_BT1120
SENSOR1_TYPE ?= SONY_IMX290_MIPI_2M
sample_comm_vi.c修改如下:
combo_dev_attr_t MIPI_BT1120_ATTR =
{
.devno = 0,
.input_mode = INPUT_MODE_BT1120,
.data_rate = MIPI_DATA_RATE_X1,
.img_rect = {0, 0, 1920, 1080},
{
}
};
combo_dev_attr_t MIPI_IMX290_ATTR =
{
.devno = 0,
.input_mode = INPUT_MODE_MIPI,
.data_rate = MIPI_DATA_RATE_X1,
.img_rect = {0, 0, 1920, 1080},
{
.mipi_attr =
{
DATA_TYPE_RAW_10BIT,
HI_MIPI_WDR_MODE_NONE,
{0, 1, 2, 3, -1, -1, -1, -1}
}
}
};
VI_DEV_ATTR_S DEV_ATTR_SONY_BT1120 =
{
VI_MODE_BT1120_STANDARD,
VI_WORK_MODE_1Multiplex,
{0xFF000000, 0xFF0000},
VI_SCAN_PROGRESSIVE,
{-1, -1, -1, -1},
VI_DATA_SEQ_UVUV,
{
/*port_vsync port_vsync_neg port_hsync port_hsync_neg */
VI_VSYNC_PULSE, VI_VSYNC_NEG_LOW, VI_HSYNC_VALID_SINGNAL, VI_HSYNC_NEG_HIGH, VI_VSYNC_VALID_SINGAL, VI_VSYNC_VALID_NEG_HIGH,
/*hsync_hfb hsync_act hsync_hhb*/
{0, 1920, 0,
/*vsync0_vhb vsync0_act vsync0_hhb*/
0, 1080, 0,
/*vsync1_vhb vsync1_act vsync1_hhb*/
0, 0, 0}
},
VI_DATA_TYPE_YUV,
HI_FALSE,
{1920, 1080},
{
{
{1920 , 1080},
},
{
VI_REPHASE_MODE_NONE,
VI_REPHASE_MODE_NONE
}
},
{
WDR_MODE_NONE,
1080
},
DATA_RATE_X1
};
VI_DEV_ATTR_S DEV_ATTR_IMX290_2M =
{
VI_MODE_MIPI,
VI_WORK_MODE_1Multiplex,
{0xFFF00000, 0x0},
VI_SCAN_PROGRESSIVE,
{-1, -1, -1, -1},
VI_DATA_SEQ_YUYV,
{
/*port_vsync port_vsync_neg port_hsync port_hsync_neg */
VI_VSYNC_PULSE, VI_VSYNC_NEG_LOW, VI_HSYNC_VALID_SINGNAL,VI_HSYNC_NEG_HIGH,VI_VSYNC_VALID_SINGAL,VI_VSYNC_VALID_NEG_HIGH,
/*hsync_hfb hsync_act hsync_hhb*/
{0, 1280, 0,
/*vsync0_vhb vsync0_act vsync0_hhb*/
0, 720, 0,
/*vsync1_vhb vsync1_act vsync1_hhb*/
0, 0, 0}
},
VI_DATA_TYPE_RGB,
HI_FALSE,
{1920, 1080},
{
{
{1920 , 1080},
},
{
VI_REPHASE_MODE_NONE,
VI_REPHASE_MODE_NONE
}
},
{
WDR_MODE_NONE,
1080
},
DATA_RATE_X1
};
VI_PIPE_ATTR_S PIPE_ATTR_SONY_BT1120 =
{
VI_PIPE_BYPASS_NONE, HI_TRUE, HI_TRUE,
1920, 1080,
PIXEL_FORMAT_YVU_SEMIPLANAR_420,
COMPRESS_MODE_NONE,
DATA_BITWIDTH_8,
HI_FALSE,
{
PIXEL_FORMAT_YVU_SEMIPLANAR_420,
DATA_BITWIDTH_8,
VI_NR_REF_FROM_RFR,
COMPRESS_MODE_NONE
},
HI_FALSE,
{-1, -1}
};
VI_PIPE_ATTR_S PIPE_ATTR_IMX290_2M =
{
VI_PIPE_BYPASS_NONE, HI_FALSE,HI_FALSE,
1920, 1080,
PIXEL_FORMAT_RGB_BAYER_10BPP,
COMPRESS_MODE_NONE,
DATA_BITWIDTH_10,
HI_TRUE,
{
PIXEL_FORMAT_YVU_SEMIPLANAR_420,
DATA_BITWIDTH_8,
VI_NR_REF_FROM_RFR,
COMPRESS_MODE_NONE
},
HI_FALSE,
{-1, -1}
};
s32Ret = SAMPLE_COMM_VI_SetMipiHsMode(LANE_DIVIDE_MODE_3);
注意1:SAMPLE_COMM_VI_StartIsp中SONY_BT1120需要跳过ISP处理。
注意2:SAMPLE_COMM_VI_GetSensorInfo中需要注释掉pstViConfig->astViInfo[0].stSnsInfo.s32BusId = 1。
注意3:BT1120的devno为0,对应cmos0,MIPI的devno为0,对应mipi0。
注意4:其他部分代码也需要修改,根据宏参考比较接近的做修改。
附上执行./sample_venc0后的proc信息:
~ # cat /proc/umap/mipi_rx
Module: [MIPI_RX], Build Time[Nov 15 2018, 09:14:11]
-----MIPI LANE DIVIDE MODE---------------------------------------------------------------------------------------------
MODE LANE DIVIDE
3 4+8
-----MIPI DEV ATTR-----------------------------------------------------------------------------------------------------
Devno WorkMode DataRate DataType WDRMode ImgX ImgY ImgW ImgH
0 MIPI X1 RAW10 None 0 0 1920 1080
-----MIPI LANE INFO-----------------------------------------------------------------------------------------------------
Devno LaneID
0 0, 1, 2, 3, -1, -1, -1, -1
-----MIPI PHY DATA INFO------------------------------------------------------
PhyId LaneId PhyData MipiData LvdsData
0 0, 1, 2, 3 0x1a,0x10,0x8f,0x42 0x90,0x2f,0x2e,0x2e 0xcd,0x69,0xd1,0x06
1 4, 5, 6, 7 0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00
2 8, 9,10,11 0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00
-----MIPI DETECT INFO----------------------------------------------------
Devno VC width height
0 0 1920 1080
0 1 0 0
0 2 0 0
0 3 0 0
-----PHY CIL ERR INT INFO---------------------------------------------
PhyId Clk2TmOut ClkTmOut Lane0TmOut Lane1TmOut Lane2TmOut Lane3TmOut Clk2Esc ClkEsc Lane0Esc Lane1Esc Lane2Esc Lane3Esc
0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0
-----MIPI ERROR INT INFO 1-----------------------------------------------------------
Devno Ecc2 Vc0CRC Vc1CRC Vc2CRC Vc3CRC Vc0EccCorrct Vc1EccCorrct Vc2EccCorrct Vc3EccCorrct
0 0 0 0 0 0 0 0 0 0
-----MIPI ERROR INT INFO 2-----------------------------------------------------------
Devno Vc0Dt Vc1Dt Vc2Dt Vc3Dt Vc0FrmCrc Vc1FrmCrc Vc2FrmCrc Vc3FrmCrc
0 0 0 0 0 0 0 0 0
-----MIPI ERROR INT INFO 3-----------------------------------------------------------
Devno Vc0FrmSeq Vc1FrmSeq Vc2FrmSeq Vc3FrmSeq Vc0BndryMt Vc1BndryMt Vc2BndryMt Vc3BndryMt
0 0 0 0 0 0 0 0 0
-----MIPI ERROR INT INFO 4-----------------------------------------------------------
Devno DataFifoRdErr CmdFifoRdErr Vsync CmdFifoWrErr DataFifoWrErr
0 0 0 0 0 0
-----ALIGN ERROR INT INFO--------------------------------------
Devno FIFO_FullErr Lane0Err Lane1Err Lane2Err Lane3Err Lane4Err Lane5Err Lane6Err Lane7Err Lane8Err Lane9Err Lane10Err Lane11Err
0 0 0 0 0 0 0 0 0 0 0 0 0 0
~ # cat /proc/umap/vi
[VI] Version: [Hi3519AV100_MPP_V2.0.1.0 B0B0 Release], Build Time[Nov 15 2018, 09:08:39]
-------------------------------MODULE PARAM ---------------------------------------------------------------------------
DetectErrFrame DropErrFrame
0 0
-------------------------------VI MODE --------------------------------------------------------------------------------
Pipe0Mode Pipe1Mode Pipe2Mode Pipe3Mode Pipe4Mode Pipe5Mode
offline offline offline offline offline offline
-------------------------------VPSS MODE ------------------------------------------------------------------------------
Pipe0Mode Pipe1Mode Pipe2Mode Pipe3Mode Pipe4Mode Pipe5Mode
offline offline offline offline offline offline
-------------------------------VI STITCH GRP ATTR----------------------------------------------------------------------
StitchGrp bStitch Mode PipeNum PipeId
-------------------------------VI DEV ATTR1----------------------------------------------------------------------------
DevID DevEn BindPipe Width Height IntfM WkM ComMsk0 ComMsk1 ScanM
0 Y Y 1920 1080 MIPI 1Mux fff00000 0 P
3 Y Y 1920 1080 BT1120S 1Mux ff000000 ff0000 P
-------------------------------VI DEV ATTR2----------------------------------------------------------------------------
DevID AD0 AD1 AD2 AD3 Seq DataType DataRev BasW BasH HReph VReph WDRMode CacheLine DataRate
0 -1 -1 -1 -1 N/A RGB N 1920 1080 NONE NONE None 1080 X1
3 -1 -1 -1 -1 UVUV YUV N 1920 1080 NONE NONE None 1080 X1
-------------------------------VI BIND ATTR----------------------------------------------------------------------------
DevID PipeNum PipeId
0 1 0
3 1 3
-------------------------------VI DEV TIMING ATTR----------------------------------------------------------------------
DevID DevTimingEn DevFrmRate DevWidth DevHeight
-------------------------------VI PIPE ATTR1---------------------------------------------------------------------------
PipeID BypassMode YuvSkip IspBypass Width Height PixFmt BitWidth NrEn SharpenEn CompressMode
0 BypassNone N N 1920 1080 RAW10 10 Y N None
3 BypassNone Y Y 1920 1080 SP420 8 N N None
-------------------------------VI PIPE ATTR2---------------------------------------------------------------------------
DiscProPic SrcFRate DstFRate FrameSource RepeatMode VCNum
N -1 -1 DEV NONE 0
N -1 -1 DEV NONE 0
-------------------------------VI PIPE CROP ATTR-----------------------------------------------------------------------
PipeID CropEn CoorX CoorY Width Height
-------------------------------VI PIPE NR ATTR-------------------------------------------------------------------------
PipeID BitWidth CompressMode PixFmt RefSrc Intf Version OptMode
0 8 None SP420 RFR - - MANUAL
-------------------------------VI PIPE USER PIC ATTR-------------------------------------------------------------------
PipeID Enable ChnID Mode BgColor PicID Width Height Stride PixFmt PoolID PhyAddr
-------------------------------VI PIPE DUMP ATTR-----------------------------------------------------------------------
PipeID Enable Depth
-------------------------------VI PIPE BNR DUMP ATTR-------------------------------------------------------------------
PipeID Enable Depth
-------------------------------VI CHN ATTR1----------------------------------------------------------------------------
PipeID ChnID Width Height Mirror Flip SrcFRate DstFRate PixFmt VideoFmt DynamicRange
0 0 1920 1080 N N -1 -1 SP420 LINEAR SDR8
3 0 1920 1080 N N -1 -1 SP420 LINEAR SDR8
-------------------------------VI CHN ATTR2----------------------------------------------------------------------------
CompressMode Depth Align
None 0 0
None 0 0
-------------------------------VI EXTCHN ATTR1-------------------------------------------------------------------------
PipeID ChnID Source SrcChn Width Height SrcFRate DstFRate PixFmt DynamicRange CompressMode Depth
-------------------------------VI EXTCHN ATTR2-------------------------------------------------------------------------
Align
-------------------------------VI CHN EARLY INTERRUPT INFO-------------------------------------------------------------
PipeID ChnID Enable LineCnt
0 0 N 0
3 0 N 0
-------------------------------VI CHN LOW DELAY ATTR-------------------------------------------------------------------
PipeID ChnID Enable LineCnt Effect
0 0 N 0 N
3 0 N 0 N
-------------------------------VI CHN CROP INFO------------------------------------------------------------------------
PipeID ChnID CropEn CoorType CoorX CoorY Width Height TrimX TrimY TrimWid TrimHgt
0 0 N RIT 0 0 0 0 0 0 1920 1080
3 0 N RIT 0 0 0 0 0 0 1920 1080
-------------------------------VI CHN ROTATION INFO--------------------------------------------------------------------
PipeID ChnID Rotation
0 0 0
3 0 0
-------------------------------VI CHN LDC INFO-------------------------------------------------------------------------
PipeID ChnID Enable Aspect XRatio YRatio XYRatio XOffset YOffset DistortionRatio
0 0 N N 0 0 0 0 0 0
3 0 N N 0 0 0 0 0 0
-------------------------------VI CHN ROTATIO_EX INFO------------------------------------------------------------------
PipeID ChnID Enable ViewType Angle XOffset YOffset Width Height
0 0 N ALL 0 0 0 0 0
3 0 N ALL 0 0 0 0 0
-------------------------------VI CHN SPREAD INFO----------------------------------------------------------------------
PipeID ChnID Enable OutW OutH Coef
0 0 N 0 0 0
3 0 N 0 0 0
-------------------------------VI EXTCHN FISHEYE ATTR------------------------------------------------------------------
PipeID ChnID Enable MntMode RgnNum BgEnable BgColor LMF HOffset VOffset TCoef FStrength
-------------------------------VI EXTCHN FISHEYE REGION ATTR-----------------------------------------------------------
PipeID ChnID RgnIndex ViewMode InRadius OutRadius Pan Tilt HorZoom VerZoom OutX OutY OutW OutH
-------------------------------VI DIS CONFIG INFO1---------------------------------------------------------------------
PipeID ChnID Mode Motion PdtType BufNum CropRatio FrmRate GyroRange GyroBitWidth CamSteady Scale
-------------------------------VI DIS ATTR INFO------------------------------------------------------------------------
PipeID ChnID DisChn Enable GdcBypass MovSub Roef Timelag ViewAngle bStillCrop HorLimit VerLimit
-------------------------------VI SNAP ATTR INFO-----------------------------------------------------------------------
PipeID Type bLoadCCM FrameCnt rptTimes bZSL FrmDepth RollbaskMs Interval
-------------------------------VI SNAP STATUS INFO---------------------------------------------------------------------
Status bDoublePipe VideoPipe SnapPipe VcNum ProDelayInt
-------------------------------VI CHN OUTPUT RESOLUTION----------------------------------------------------------------
PipeID ChnID Enable Mirror Flip Width Height PixFmt VideoFmt DynamicRange CompressMode FrameRate
0 0 Y N N 1920 1080 SP420 LINEAR SDR8 None 25
3 0 Y N N 1920 1080 SP420 LINEAR SDR8 None 25
-------------------------------VI PIPE STATUS--------------------------------------------------------------------------
PipeID Enable IntCnt FrameRate LostFrame VbFail Width Height
0 Y 1051 25 0 0 1920 1080
3 Y 1052 25 1 0 1920 1080
-------------------------------VI CHN STATUS---------------------------------------------------------------------------
PipeID ChnID Enable FrameRate LostFrame VbFail Width Height
0 0 Y 25 0 0 1920 1080
3 0 Y 25 0 0 1920 1080
-------------------------------VI PIPE Statistic-----------------------------------------------------------------------
PipeID RecvPic LostCnt BufCnt CurSoftTm MaxSoftTm CurTaskTm MaxTaskTm LowBandWidth BeBufNum
0 1049 0 0 90 99 4533 4615 0 0
3 1049 0 0 53 87 5255 6589 1 0
-------------------------------VI HW STATISTIC-------------------------------------------------------------------------
ProcIdx HWCostTm MaxHWCostTm CycleCnt MaxCycleCnt
0 3529 5705 2076107 2283357
-------------------------------VI PROC OFFLINE IRQ STATISTIC----------------------------------------------------------
ProcIdx SubmitCnt IntCnt ListCnt TmOutCnt BusErrCnt DcmpErrCnt StartErrCnt NodeIdErrCnt
0 2098 2098 2098 0 0 0 0 0
-------------------------------VI PROC ONLINE IRQ STATISTIC-----------------------------------------------------------
ProcIdx IntCnt FrmStartCnt FrmErrCnt FrmFlowCnt BusErrCnt DcmpErrCnt CfgLossCnt
0 0 0 0 0 0 0 0
-------------------------------VI PROC COST TIME STATISTIC-----------------------------------------------------------
ProcIdx IntCntPerSec MaxIntCntPerSec CurIntCostTm MaxIntCostTm TotalIntCostTm IntTmPerSec MaxIntTmPerSec
0 50 50 236 281 473410 11856 11856
-------------------------------VI DEV DETECT INFO----------------------------------------------------------------------
DevID ValidWidth ValidHeight TotalWidth
0 1920 1080 17777
3 1920 1080 2640
-------------------------------VI BAS DETECT INFO----------------------------------------------------------------------
DevID ValidWidth ValidHeight TotalWidth
0 1920 1080 17776
-------------------------------VI ISP DETECT INFO----------------------------------------------------------------------
ISPID ValidWidth ValidHeight TotalWidth
0 1920 1080 17776
3 1920 1080 10666
~ #
以上,正常出图,后续将3519A相关代码移植到我的项目中就好了,结束。
最后
以上就是飘逸皮皮虾为你收集整理的Hi3519A调试记录的全部内容,希望文章能够帮你解决Hi3519A调试记录所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复