How we went from developing firmware for each camera to creating a universal SDK for camera vendors

Hi, my name is Oleg Gerasimov, I am the director of the competence center of the IT cluster of Rostelecom. Our team, among many tasks, develops CCTV camera firmware for B2B and B2C services. In the previous article, I told how we learned how to independently develop software and firmware for IP cameras, including inexpensive ones, and connect them to the cloud.



Since then, cameras with our firmware have already appeared on the market, and, judging by the data from Yandex.Market, prices on store shelves start at 1,500 rubles. And this is no longer a cheap "no-name", but high-quality cameras of the world's leading brands: Hikvision, Dahua and Uniview. In my opinion, this is a great result!





, . .



, , , .



, , SDK , . , . β€” , (Datasheet) . , , , , .



, , , . , . , , , .



. . , , .



β€” , , GPIO-, , , .. , / , , WI-FI .





. , -, .



- , : , , .



, β€” . . , ,

, . β€” Β«-Β» , .

, . : Wi-Fi, PTZ, .. , , .



, .

, . .





. : , .



: , , .



, , : SDK . :



  • SDK SoC. 10 Hisilicon, Ambarella, MStar Fullhan.
  • , . NDA, .
  • , , Git.
  • : , , SoC SDK .
  • , .
  • Β«-SoCΒ» , .
  • . , .





, , . , , . ( ) : , ...



: SDK , : , toolchain, uboot, (- uclibc, glibc). , . :



Linux gcc
Hisilicon 3516a/d 3.4.y gcc 4.9
Hisilicon 3518ev100 3.0.y gcc 4.4
Hisilicon 3518ev200 3.4.y gcc 4.9
Hisilicon 3516cv300 3.18.y gcc 4.9
Hisilicon 3518ev300/3516ev200/ev300 4.9.y gcc 6.3
Hisilicon 3516cv500/dv300 4.9.y gcc 6.3
mStar i3 3.18 gcc 4.8
mStar i6 4.9 gcc 8.2
Ambarella s2l 3.10 gcc 4.9
Ambarella s3l 3.10 gcc 5.2
Fullhan fh8632 3.0.y gcc 4.3


, : .



: , , 10+ SoC, . init-, .



, //makefile/ , " β†’ SoC β†’ ". SDK . , Megatech Hisilicon.





drivers 
+ megatech/             ->      'megatech'
| + hi3518ev200/        ->  hisilicon hi3518ev200
| | + 1421              ->       1421
| | | | + ipcdb.1421.yml ->  
| | | | + mpi/entry.1421.yml ->  
| | | | + ptz/entry.1421.yml ->  PTZ
| | + motor             ->    PTZ
| | | + bu24036_motor   ->      bu24036
| | | | gpio_motor      ->     GPIO 
| | + wlan              ->  wi-fi  
| | | + Makefile        ->   
| | + sensor            ->  
| | | + Makefile        ->   




kernel
+ megatech/
| + hi3518ev200/
| | + mmc_hotplug.patch
| | + kernel-config.patch


uboot



uboot
+ megatech/
| + hi3518ev200/
| | + uboot-mmc.patch
| | + uboot-spi.patch


YAML, , :



  • (GPIO, Wi-Fi, , , , ).


yaml
1421:
  vendor: megatech
  model: Model A
  soc: 3518ev2
  ethernet: 0
  wlan: rtl8188eu
  sensor: ov9732
  leds:            
    ir:            
      gpio: 23
      inverse: true
    red:           
      gpio: 10
    power:
      gpio: 10     
    green:
      gpio: 2
    net:
      gpio: 2
  keys:
    wps:
      gpio: 16
    reset:
      gpio: 16
  peri-out:
    pwdn:
      gpio: 1
      inverse: true
    ircut.p:
      gpio: 57
    ircut.n:
      gpio: 60
    wifi_pwr:
      gpio: 7
  flash: spi
  misc:
    microphone: true
    speaker: true
    mic_hpf_level: 3
    mic_anr_level: 4
  scripts:
    insert-sns:
      - himm 0x200f0040 0x2; # I2C0_SCL
      - himm 0x2003002c 0xc4001; # sensor unreset, clk 24MHz, VI 99MHz
    init-wlan:
      - insmod 8188eu.ko


  • ( , , , ).


yaml
1421:
  sensor:
    type: ov9732
    lib: libsns_ov9732.so
  resolutions:
    - targets: 
        - { width: 1280, height: 720, maxrate: 30 }
        - { width: 640, height: 480, maxrate: 30 }
        - { width: 640, height: 360, maxrate: 30 }
        - { width: 320, height: 240, maxrate: 30 }
      channels:
        - main
      source: { width: 1280, height: 720, rates: [30, 25] }

  combo_dev_attr:
    input_mode: CMOS_33V
  vi_dev_attr:
    interface_mode: DIGITAL_CAMERA
    component_mask: [67043328, 0]
    syn_cfg:
      vsync: field
      vsync_neg: high
      hsync: valid_signal
      hsync_neg: high
      vsync_valid: valid_signal
      vsync_valid_neg: high
      timing_blank: [ 370, 1280, 0, 6, 720, 6, 0, 0, 0 ]
  isp_image_attr:
    bayer_format: BGGR


  • PTZ ( , ).


yaml
1421:
  type: pan_controller_and_tilt_gpio_generic
  interrupt_gpio: 50
  absolute: true
  pan:
    park_ccw: false
    continuous: [-20, 20]
    relative: [-7.9, 7.9]
    absolute: [0, 355]
    channel: 0
    min_wait: 100
    max_step: 140
    max_speed: 375
    unity: 430
  tilt:
    park_ccw: true
    continuous: [-20, 20]
    relative: [-3.5, 3.5]
    absolute: [0, 90]
    max_step: 2000
    unity: 157


SDK . Docker , .

Docker , CI, .



. Docker- SDK CI Β«SoC-Β».



:



  • build-tools β€” Dockerfile, SoC SDK . CI Docker- .
  • vc-firmware β€” . git-submodule : , , ). CI .


SDK , vc-sdk, vc-firmware build-tools git-submodule. CI :



  • Docker- build-tools;
  • (, , );
  • ( , Wi-Fi ..)
  • ,




CI Docker-, .

registry , .



β€” . , . , Foliant. Β«Write the Docs MoscowΒ» (https://habr.com/ru/post/431210/).





8 SDK, . .



, β€” SDK β€” : . : .



, , . .




All Articles