分类:linux

使用VS2017 开发Linux C应用

在工程添加了路径添加了.h 文件,尽管在include 时候VS2017已经能够自动补全,但是编译的时候还是提示找不到.h文件。

在编译机器发现对应的.h 并没有直接拷贝过来。

原来同以前的直接include 搜索不一样,.h 同样需要加入工程里面,不然VS不知道拷贝那些文件。

13:46 2018/6/29

对于系统/usr/include 路径下*.h 文件,VS2017 不知道是什么时候拷贝到到Windows的,每次添加新机器后会报错。

C:\Users\Mdp-Jay\AppData\Local\Microsoft\Linux\Header Cache\1.0 路径下文件夹为空。

测试发现原来此过程发生在选项->跨平台->连接管理器->远程标头 IntelliSense 管理器,会自动打包Linux 编译机器上面的/usr/include然后到Windows 解压。

动态链接库

属性页->链接->所有选项->库链接项

确定了Linux GDBServer版本

大概明白了流程,暂时地,VS2017 还不支持arm64架构,通过ssh获取调试的架构的(uname -m)时候得到aarch64显示Unkown。VSli...

Overview of the V4L2 driver framework

This text documents the various structures provided by the V4L2 framework and their relationships.

The V4L2 drivers tend to be very complex due to the complexity of the hardware: most devices have multiple ICs, export multiple device nodes in /dev, and create also non-V4L2 devices such as DVB, ALSA, FB, I2C and input (IR) devices.

Especially the fact that V4L2 drivers have to setup supporting ICs to do audio/video muxing/encoding/decoding makes it more complex than most. Usually these ICs are connected to the main bridge driver through one or more I2C busses, but other busses can also be used. S...

linux gpio libc

对linux c app里面的一个gpio操作云里雾里半天,是时候好好理理了。

主要是这gpio number是如何同pin number 一一对应的。

奇怪,今天发现sys/class/gpio 下面的gpio没有了。只剩下gpiochip了。原来需要在应用export 对应io number。

这里的export和unport以及之后对 io number value的read write 操作都是在gpiolibc 上实现的。

接下来需要理一理gpiolibc 的实现,gpiolibc 所有操作都是基于gpio_desc *desc 变量。改变量通过gpio_desc 结构体定义这里的数组。数组索引就对应我们这里的io number。

这个结构体的实现主要是是通过gpio_chip来操作的,例如gpiod_set_value 是通过gpio_desc 获取到gpio_chip 然后在通过gpio_chip->set() 实现IO的读写。

所以对于gpio_chip 的初始化就很重要了。然而我并没有找。

对于如上计算的bank 1-7依次对应 PB-PH。...

v4l2 driver framework code review

如上启动顺序

  • csi、cci、mipi 等外设初始化;
  • vfe控制 v4l2 启动;

    vfe在初始化 v4l2-device启动的时候已经同sub-device ov5640 通信,但是此时ov5640 启动还没有加载,这部分需要详细走读下代码;

  • sub-device camera sensor ov5640 加载;

  1. vfe模块加载,加载csi、mipi、isp、cci模块,同时从sys_config读出sensor的配置;
  2. 创建v4l2-device;
  3. ov5640 通过cci/i2c 向上注册sub-device(先前行为),此时vfe通过已经注册接口测试sensor是否激活。
  4. 创建video 设备节点 ;
  • libv4l2 源码可以通过sudo apt-get source libv4l2rds0 下载。

arm级vp9 编解码cpu概况

这里系统了解全志和海思的解码能力。

从Allwinner_H6_V200_User_Manual_V1.1_decrypted->Chapter 2 Overview->2.2.6. Video Engine ->2.2.6.1. Video Decoder

从User Manual 来看,能够达到4k@30fps的帧率,但是实际测试在6fps。

暂时无其他资料,等待供应商提供。

hi3798 区分M和C系列,现在看来hi3798c v100 支持vp8,hi3798cv200 支持vp9。

Hi3798C V200.pdf-> Key Specifications

了解下vp9的...

ramfs

Ramfs is a very simple FileSystem that exports Linux's disk cacheing mechanisms (the page cache and dentry cache) as a dynamically resizable ram-based filesystem.

ramfs 是一个基于linux缓存机制(page cache and dentry cache)的简易文件系统,基于ram,大小可动态调整。

Normally all files are cached in memory by Linux. Pages of data read from backing store (usually the ?block_device the filesystem is mounted on) are kept around in case it's needed again, but marked as clean (freeable) in case the Virtual Memory system needs the memory for something else. Similarly, data written to files is marked clean as soon as it has been writt...

a64 sdk pack tool

编译打包相关脚本文件。

  • 拷贝tools/pack/chips/sun50iw1p1/bin/boot0_sdcard_sun50iw1p1.bin到out/boot0_sdcard.fex

  • 通过sys_config.bin 更新boot0,最终生成boot0_sdcard.fex。

  • brandy/build.sh 会编译uboot并且将其拷贝到tools/pack/chips/sun50iw1p1/bin/u-boot-sun50iw1p1.bin。
  • tools/pack/pack 将其拷贝为u-boot.fex;

  • 通过sys_config更新uboot 文件头的元数据;

  • 合并monitor.fex、scp.fex、sunxi.fex

sys_config 是全志 sunxi的配置脚本,区别linux kernel的dts,但是会作用于dts,以下梳理其完整链路。

  • 应用sys_config.fex,通过dts生成sunxi.dtb;

  • 通过生成sys_config.bin 拷贝config.fex,sys_config.bin 用以后面的其他文件更新,config.fex暂时未发现使用;

  • 使用sys_config.bin 更新boot0、uboot、fes1、toc0。

  • 应用sys_config.fex 通过dts生成sunxi.dtb

  • 拷贝生成 sunxi.fex 合并到uboot

boot-resourc...

hi3798cv200 android 编译

  • sdk 百度云下载 密码:w11f
  • 开发环境搭建和初次编译参考Android 解决方案 开发指南.pdf- >开发环境配置
  • 烧写工具HiTool-STB-3.1.35.zip 会在成功编译镜像后自动拷贝到out文件夹。

参考ServerInstall.sh进行初始化环境,主要是包含java 、python、依赖库、gcc安装,然而很多依赖版本过低,所以必须要添加 ubuntu12.04或者14.04源安装。

当前 ubuntu 源已经放弃部分老版本的更新维护,所以没有办法直接降级到文章中的 bardy 08.04 源直接安装,对于java7的安装需要更改source源到到当前维护的最低版本precise、trusty等,即:

设置环境变量

交叉编译环境通过arm-hisiv200-linux.tar.bz2安装,解压后参考内根目录的安装脚本,主要包含建立软连接和配置环境变量。

配置环境变量

  • HiBurn 工具使用指南.pdf

uboot 烧写原理:HiBurn工具在开始烧写后,首选与bootrom 进行交互,工具DDR参数传送到传到bootrom,为uboot 下载阶段 5%处,然后初始化 DDR,再把uboot 传 输到DDR中,uboot 下载阶段 100%处表示传输完毕,再从 DDR启动uboot,uboot 启 动完成后,工具开始与uboot 进行交互,发送烧写命令,将 DDR中的ub...

flash partition fs overview

nand flash

对于NandFlash的认识尝试不做更多理解,只需要了解非易失存储、擦除寿命有限、通常是10K级别,同时写操作需要基于Page来。没有办法按照内存的存储基本单位字节来操作,由多个Page组成一个Block 每个 Page保留 一些字节用以 做ECC ( error correcting code )校验。

通常按照如下分布。

NandFlash 支持坏块管理,当上层应用通过逻辑块访问Flash的时候,驱动器控制器会把坏块重映射到好的物理块,基于此实现,FLash的一些块需要用来存储坏块信息。 或者系统会在上电时候读取出所有坏块信息存储到RAM。

绝大部分NAND 出厂就伴随着一些坏块信息,但是通常在出厂前都会进行一个坏块标记处理工序。

Partitioning

GUIP和MBR。

先说MBR,很熟悉了。早些年折腾系统装机就详细了解过,区分主分区+扩展分区。因为首先分区表文件大小512字节,所以 主分区数量 m ,0<m<=4,扩展分区数量 e, 0<=e<4, 扩展分区和主分区 总共 0<e+m<=4。扩展分区可以增加理论上的不限制数量的逻辑分析。

GUID 分区是 基于 Unified Extensible Firmware Interface 规范实现,通过GUID或UUID方式实现分区类型。

多个分区方便我们选择不...

Platform Devices and Drivers

See <linux/platform_device.h> for the driver model interface to the platform bus: platform_device, and platform_driver. This pseudo-bus is used to connect devices on busses with minimal infrastructure,like those used to integrate peripherals on many system-on-chip processors, or some "legacy" PC interconnects; as opposed to large formally specified ones like PCI or USB.

Platform devices are devices that typically appear as autonomous entities in the system. This includes legacy port-based devices and host bridges to peripheral buses, and most controllers integrated into system-on-chip p...