Cómo pasamos de desarrollar firmware para cada cámara a crear un SDK universal para proveedores de cámaras

Hola, mi nombre es Oleg Gerasimov, soy el director del centro de competencia del clúster de TI de Rostelecom. Nuestro equipo, entre muchas tareas, desarrolla firmware de cámaras CCTV para servicios B2B y B2C. En el artículo anterior, conté cómo aprendimos cómo desarrollar de forma independiente software y firmware para cámaras IP, incluidas las económicas, y cómo conectarlas a la nube.



Desde entonces, las cámaras con nuestro firmware ya han aparecido en el mercado y, a juzgar por los datos de Yandex.Market, los precios en los estantes de las tiendas comienzan en 1,500 rublos. Y esto ya no es un "sin nombre" barato, sino cámaras de alta calidad de las principales marcas del mundo: Hikvision, Dahua y Uniview. En mi opinión, ¡este es un gran resultado!





, . .



, , , .



, , 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