Porting Linux on an ARM Board
Total Page:16
File Type:pdf, Size:1020Kb
Porting Linux on an ARM board Porting Linux on an ARM board free electrons © Copyright 2015-2016, free electrons. Creative Commons BY-SA 3.0 license. Latest update: April 18, 2016. free electrons Corrections, suggestions, contributions and translations are welcome! Send them to [email protected] Embedded Linux Experts free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 1/220 Alexandre Belloni I Embedded Linux engineer at free electrons I Embedded Linux expertise I Development, consulting and training I Strong open-source focus I Open-source contributor I Maintainer for the Linux kernel RTC subsystem I Co-Maintainer of kernel supportfree electrons for Atmel ARM processors Embedded Linux Experts I Contributing to kernel support for Marvell ARM (Berlin) processors free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 2/220 Free Electrons Mission free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 3/220 Free Electrons at a glance I Engineering company created in 2004 (not a training company!) I Locations: Orange, Toulouse, Lyon (France) I Serving customers all around the world See http://free-electrons.com/company/customers/ I Head count: 11 Only Free Software enthusiasts! I Focus: Embedded Linux, Linux kernel, Android Free Software / Open Source for embedded and real-time systems. I Activities: development, training, consulting, technical support. I Added value: get the best of the user and development community and the resources it offers. free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 4/220 Free Electrons on-line resources I All our training materials: http://free-electrons.com/docs/ I Technical blog: http://free-electrons.com/blog/ I Quarterly newsletter: http://lists.free- electrons.com/mailman/listinfo/newsletter I News and discussions (Google +): https://plus.google.com/+FreeElectronsDevelopers I News and discussions (LinkedIn): http://linkedin.com/groups/Free-Electrons-4501089 I Quick news (Twitter): http://twitter.com/free_electrons I Linux Cross Reference - browse Linux kernel sources on-line: http://lxr.free-electrons.com free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 5/220 Course content Course content free electrons © Copyright 2004-2016, Free Electrons. Creative Commons BY-SA 3.0 license. free electrons Corrections, suggestions, contributions and translations are welcome! Embedded Linux Experts free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 6/220 Porting linux Porting Linux includes a number of steps, starting even before software is involved: I SoC selection I SoM, SBC selection or board conception I Bootloader selection I Bootloader port I Linux kernel version selection I Linux port I Root filesystem integration free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 7/220 ARM Ecosystem ARM Ecosystem free electrons © Copyright 2004-2016, Free Electrons. Creative Commons BY-SA 3.0 license. free electrons Corrections, suggestions, contributions and translations are welcome! Embedded Linux Experts free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 8/220 ARM Ecosystem ARM SoCs free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 9/220 ARM platforms I ARM (the company) designs CPU cores: instruction set, MMU, caches, etc. I They don’t sell any hardware I Silicon vendors buy the CPU core design from ARM, and around it add a number of peripherals, either designed internally or bought from third parties I Texas Instruments, Atmel, Marvell, Freescale, Qualcomm, Nvidia, etc. I They sell System-on-chip or SoCs I System makers design an actual board, with one or several processors, and a number of on-board peripherals free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 10/220 Schematic view of an ARM platform free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 11/220 System on Chip A System on Chip is typically composed of: TST0-TST1 Reset and I NRST Test ARM920T Core TSYNC One or multiple CPU cores TCLK ICE JTAGSEL ETM TDI PIO TPS0 - TPS2 TDO JTAG Scan Instruction Cache MMU Data Cache TPK0 - TPK15 TMS 16K bytes 16K bytes TCK NTRST I BMS D0-D15 A bus FIQ A0/NBS0 AIC Fast SRAM Address A1/NBS2/NWR2 IRQ0-IRQ6 PIO 16K bytes Decoder EBI A2-A15/A18-A22 A16/BA0 PCK0-PCK3 CompactFlash A17/BA1 Abort NAND Flash NCS0/BFCS PLLRCB PLLB Status SmartMedia NCS1/SDCS Fast ROM NCS2 I PLLRCA PLLA NCS3/SMCS 128K bytes Misalignment NRD/NOE/CFOE Oscillators and PLL XIN PMC NWR0/NWE/CFWE Detector OSC NWR1/NBS1/CFIOR XOUT NWR3/NBS3/CFIOW Peripheral Bus SDCK Bridge Arbiter SDCKE SDRAM RAS-CAS System Controller SDWE SDA10 I Timer Peripheral BFRDY/SMOE Timers DMA BFCK Controller Memory Burst BFAVD Controller BFBAA/SMWE XIN32 Flash BFOE OSC RTC Controller BFWE XOUT32 PIO A23-A24 A25/CFRNW Static NWAIT I DRXD NCS4/CFCS DBGU Memory NCS5/CFCE1 Memory controller DTXD PDC Controller NCS6/CFCE2 NCS7 PIO D16-D31 PIOA/PIOB/PIOC/PIOD Controller HDMA I DMA FIFO HDPA FIFO USB Host HDMB Interrupt controller Transceiver DDM HDPB DDP USB Device Transceiver DMA FIFO ETXCK-ERXCK-EREFCK I ETXEN-ETXER MCCK ECRS-ECOL MCCDA Multiple peripherals: ERXER-ERXDV MCDA0-MCDA3 MCI MCCDB Ethernet MAC 10/100 ERX0-ERX3 MCDB0-MCDB3 ETX0-ETX3 PDC EMDC EMDIO RXD0 EF100 I TXD0 APB TF0 SCK0 USART0 TK0 UART RTS0 TD0 CTS0 PDC SSC0 RD0 RK0 RXD1 RF0 TXD1 PDC I SCK1 TF1 RTS1 TK1 RTC CTS1 USART1 TD1 DSR1 SSC1 RD1 DTR1 PIO PIO RK1 DCD1 PIO RF1 I RI1 PDC PDC TF2 SPI RXD2 TK2 TXD2 TD2 SCK2 USART2 SSC2 RD2 RTS2 RK2 CTS2 PDC PDC RF2 I RXD3 TXD3 TCLK0 I2C Timer Counter TCLK1 SCK3 USART3 RTS3 TCLK2 CTS3 PDC TIOA0 TC0 TIOB0 TIOA1 I NPCS0 TC1 TIOB1 NPCS1 TIOA2 ADC NPCS2 TC2 TIOB2 NPCS3 SPI MISO TCLK3 MOSI Timer Counter TCLK4 I SPCK PDC TCLK5 TIOA3 USB controller TC3 TIOB3 TWD TIOA4 TWI TC4 TIOB4 TWCK TIOA5 I ... TC5 TIOB5 free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 12/220 ARM cores The Linux kernel supports a wide range of ARM based architectures, starting with ARMv4T: ARM family ARM architecture ARM Core ARM7T ARMv4T ARM7TDMI ARM720T ARM740T ARM9T ARMv4T ARM9TDMI ARM920T ARM922T ARM925T ARM926T ARM940T ARM9E ARMv5TE ARM946E-S ARM10E ARMv5TE ARM1020T ARM1020E ARM1022E ARMv5TEJ ARM1026EJ-S ARM11 ARMv6Z ARM1176JZF-S ARMv6K ARM11MPCore Cortex-M ARMv7-M Cortex-M3, Cortex-M4, Cortex-M7 Cortex-A (32-bit) ARMv7-A Cortex-A5, Cortex-A7 Cortex-A8, Cortex-A9, Cortex-A12, Cortex-A15, Cortex-A17 Cortex-A (64-bit) ARMv8-A Cortex-A53, Cortex-A57, Cortex-A72 free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 13/220 ARM cores Third parties can also license the instruction set and create their own cores: ARM ISA Third party core ARMv4 Faraday FA256, StrongARM SA-110, SA-1100 ARMv5TE Xscale ARMv5 Marvell PJ1, Feroceon ARMv7-A Broadcom Brahma-B15, Marvell PJ4, PJ4B, Qualcomm Krait, Scorpion ARMv8-A Cavium Thunder, Nvidia Denver, Qualcomm Kryo free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 14/220 ARM SoCs To create an SoC, the silicon vendor integrates: I one or multiple ARM cores (not necessarily homogeneous, big.LITTLE configurations exist) I its own peripherals I third party peripherals (usually from DesignWare, Cadence, PowerVR, Vivante, ...) I ROM and ROM code I sometimes one or multiple DSP, FPGA, micro-controller cores free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 15/220 ARM SoCs vendors ARM SoC vendors with good mainline kernel support include: I Allwinner I Atmel I Freescale I Marvell I Rockchip I Samsung I ST Micro I TI (sitara and OMAP families) I Xilinx However, be careful when needing certain features like GPU acceleration. free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 16/220 ARM SoMs System on Module manufacturer then create modules integrating: I an SoC I RAM I Storage I sometimes the PHYs for some interfaces like Ethernet, HDMI,... I a connector for the baseboard They also often manufacture Single-board computers (SBC) based on those SoM. free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 17/220 ARM SoMs manufacturers I ACME I Boundary Devices I Congatec I DataModul I Olimex I Phytec I Seco I Toradex I Variscite free electrons - Embedded Linux, kernel, drivers and Android - Development, consulting, training and support. http://free-electrons.com 18/220 Community boards A good way to create a prototype is to use a community board which is usually inexpensive