Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[Defcon Russia #29] Борис Савков - Bare-metal programming на примере Raspberry Pi

584 views

Published on

Докладчик покажет, как с помощью bare-metal programming подружить Raspberry Pi с GPIO, памятью и Ethernet, и пояснит, кому и зачем это может понадобиться.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

[Defcon Russia #29] Борис Савков - Bare-metal programming на примере Raspberry Pi

  1. 1. Bare-metal programming на примере Raspberry Pi 10/03/2017 DCG #7812 г. Санкт-Петербург
  2. 2. Who am i Ранее: • DC4919; • Bushwhackers; • BalalaikaCr3w. Сейчас: • Evil Dwarfs; • Безопасность АСУ ТП; • OWASP Russia; • jbfc; • It sec pro course; • ASP Labs. Defcon Russia (DCG #7812) 2
  3. 3. Bare-metal • Обучение http://www.cl.cam.ac.uk/freshers/raspberr ypi/tutorials/ http://wiki.osdev.org/Raspberry_Pi_Bare_Bo nes • Производительность • For fun! Defcon Russia (DCG #7812) 3
  4. 4. Raspberry pi Defcon Russia (DCG #7812) 4
  5. 5. Why raspberry pi • дёшево • много материалов (-RP 3) Defcon Russia (DCG #7812) 5
  6. 6. CPU RPi: • ARM1176GTZF RPi 2: • Cortex A7 RPi 3: • Cortex A53(Aarch-64) Defcon Russia (DCG #7812) 6
  7. 7. CPU RPi: • arm-none-eabi-gcc -O2 -mfpu=vfp -mfloat- abi=hard -march=armv6zk -mtune=arm1176jzf-s arm-test.c RPi 2: • arm-none-eabi-gcc -O2 -mfpu=vfp -mfloat- abi=hard -march=armv7-a -mtune=cortex-a7 arm- test.c RPi 3: • aarch64-elf-gcc (linaro cross gcc) (https://releases.linaro.org/components/toolchain/binaries/6.1- 2016.08/aarch64-elf/ ) *arm-none-eabi-objcopy kernel.elf -O binary kernel.img Defcon Russia (DCG #7812) 7
  8. 8. Cortex A53 Defcon Russia (DCG #7812) 8
  9. 9. How it works Defcon Russia (DCG #7812) 9 RAM 0 X00000000 ------------------- IO 0x3f0000000 or 0x20000000 ------------------- GPIO 0x3f0200000 or 0x20200000 ------------------- ... GPU CPU
  10. 10. Steps 1. Start GPU – Read SD 2. CPU – bootload.bin, start.elf, config 3. Start CPU cores – Run Kernel.img Defcon Russia (DCG #7812) 10
  11. 11. Files 1. bootloader.bin загружает start.elf 2. start.elf прошивка GPU которая стартует CPU 3. config.txt конфигурация 4. kernel.img OS или ваша программа Defcon Russia (DCG #7812) 11
  12. 12. config.txt Defcon Russia (DCG #7812) 12 Examples: arm_control=0x200 (запуск в x64) kernel_old=1 (загрузка с 0) disable_commandline_tags=1 kernel_old=1 disable_commandline_tags=1 kernel_address=0x06000000
  13. 13. Other files https://github.com/raspberrypi/firmware Defcon Russia (DCG #7812) 13
  14. 14. GPIO Defcon Russia (DCG #7812) 14 https://rawgit.com/msperl/rpi-registers/master/rpi-registers.html
  15. 15. UART Examples: https://github.com/gingold-adacore/rpi3- fosdem17 Defcon Russia (DCG #7812) 15
  16. 16. Blink Examples: http://www.valvers.com/open- software/raspberry-pi/step01-bare-metal- programming-in-cpt1/ (RPI, RPI 2) https://github.com/dwelch67/raspberrypi Defcon Russia (DCG #7812) 16
  17. 17. Wanna more Examples: https://github.com/PeterLemon/RaspberryPi https://www.raspberrypi.org/forums/viewtopic. php?t=72260 Defcon Russia (DCG #7812) 17
  18. 18. USB Examples: https://github.com/rsta2/uspi Defcon Russia (DCG #7812) 18
  19. 19. Free SCADA Defcon Russia (DCG #7812) 19
  20. 20. Q? Defcon Russia (DCG #7812) 20

×