+ All Categories
Home > Documents > liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf ·...

liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf ·...

Date post: 09-Apr-2018
Category:
Upload: hoangnga
View: 275 times
Download: 15 times
Share this document with a friend
217
liteSOM SDK
Transcript
Page 1: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

liteSOM SDK

Page 2: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

AGENDA

2

Piotr [email protected]

Page 3: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

AGENDA

● Linux on embedded devices.● How to cross-compile software.● Device tree – why?● Build systems overview.● How to use Buildroot.● How to integrate custom

software with Buildroot.

AGENDA

3

Page 4: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux system architecture

4

Userspace

Linux kernel

Bootloader

Page 5: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux system architecture

5

cURL Qt json-c Python

UserspaceOpenSLL systemd ALSA ncurses

openVPN Wget nginx SQLite

Scheduler Device drivers

Linux kernelNetwork Filesystems

3rd stage bootloader

Bootloader2nd stage bootloader

1st stage bootloader

Page 6: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux system architecture

6

cURL Qt json-c Python

UserspaceOpenSLL systemd ALSA ncurses

openVPN Wget nginx SQLite

Scheduler Device drivers

Linux kernelNetwork Filesystems

2nd stage bootloaderBootloader

1st stage bootloader

Page 7: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux system architecture

7

custom software

UserspacecURL Qt json-c Python

OpenSLL systemd ALSA ncurses

OpenVPN Wget nginx SQLite

Scheduler Device drivers

Linux kernelNetwork Filesystems

2nd stage bootloaderBootloader

1st stage bootloader

Page 8: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

1st stage bootloader

8

Page 9: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot - figures

9

● 16 architectures ● ARM● AVR32● m68k● Microblaze● MIPS● PowerPC● x86

Page 10: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot - figures

10

● 16 architectures● ~230 boards

● Raspberry Pi● BeagleBone● Amazon Kindle Fire● IMX6 Cubox-i● TP-LINK TL-WDR4300● Nokia N900● D-Link DNS-325

Page 11: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot - figures

11

● 16 architectures● ~230 boards

● Atmel AT91SAM9260● TI TMDSSK3358● Xilinx ZC706● Olimex MX23 Olinuxino● Intel Intel Galileo● NXP I.MX6 SABRE

Page 12: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot - figures

12

● 16 architectures● ~230 boards● 48 peripherals

● ADC converter● DMA● GPIO● I2C● Network● MMC● PWM● SPI● USB● Video

Page 13: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot - figures

13

● 16 architectures● ~230 boards● 48 peripherals● 9 filesystems

● coreboot ● cramfs● ext4● fat● JFFS2● ReiserFS● UBIFS● YAFFS2● ZFS

Page 14: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – customized boot order

14

eMMC

RESET

Page 15: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – customized boot order

15

eMMC SD

RESET RESET

Page 16: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – customized boot order

16

eMMC

eMMC

SD SD

RESET RESET RESET

Page 17: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – customized boot order

17

eMMC

eMMC

SD SD SD

LAN

RESET RESET RESET RESET

Page 18: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – real use case

18

NAND

UART

USB

LAN

RESET

Page 19: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – download source code

19

git clone git://git.freescale.com/imx/uboot-imx.git

Page 20: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot - compilation

20

git clone git://git.freescale.com/imx/uboot-imx.git

cd u-bootCROSS_COMPILE=arm-linux-gnueabihf- make liteboard_defconfigCROSS_COMPILE=arm-linux-gnueabihf- make

Page 21: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – installation on SD card

21

git clone git://git.freescale.com/imx/uboot-imx.git

cd u-bootCROSS_COMPILE=arm-linux-gnueabihf- make liteboard_defconfigCROSS_COMPILE=arm-linux-gnueabihf- make

dd if=u-boot.imx of=/dev/<sd-card> bs=1k seek=1sync

source: i.MX 6UltraLite Applications Processor Reference Manual

Page 22: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – running on liteboard

22

U-Boot 2015.04 (Sep 05 2016 – 12:34:38)

CPU: Freescale i.MX6UL rev1.0 at 396 MHzCPU: Temperature 42 CReset cause: PORBoard: Grinn liteBoardDRAM: 512 MiBMMC: FSL_SDHC: 0, FSL_SDHC: 1*** Warning - bad CRC, using default environment

In: serialOut: serialErr: serial

switch to partitions #0, OKmmc0 is current deviceNet: FEC0Error: FEC0 address not set.

Normal BootHit any key to stop autoboot: 0 switch to partitions #0, OKmmc0 is current deviceswitch to partitions #0, OKmmc0 is current device** No partition table - mmc 0 **** No partition table - mmc 0 **Booting from net …FEC0 Waiting for PHY auto negotiation to complete......... TIMEOUT !

Page 23: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

U-Boot – customization

23

Page 24: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux

24

Page 25: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux - figures

25

● 32-bit architectures

– ARM, AVR32, Blackfin, c6x, m68k, Microblaze, MIPS, S+core, SPARC,

● 64-bit architectures

– Alpha, ARM64, IA-64,

Page 26: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – lines of code

26

drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)

drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)

drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)

Page 27: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – lines of code

27

source: free-electrons.com

drivers (57%)arch (16%)fs (6%)sound (5%)net (4%)include (4%)documentation (3%)tools (1%)kernel (1%)firmware (>1%)lib (>1%)mm (>1%)scripts (>1%)crypto (>1%)security (>1%)block (>1%)

Page 28: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – download source code

28

git clone git://git.freescale.com/imx/linux-2.6-imx.git

Page 29: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – default configuration

29

git clone git://git.freescale.com/imx/linux-2.6-imx.git

cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig

Page 30: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – configuration

30

git clone git://git.freescale.com/imx/linux-2.6-imx.git

cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig

ARCH=arm CROSS_COMPILE=arm-linux- make menuconfig

Page 31: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – compilation

31

git clone git://git.freescale.com/imx/linux-2.6-imx.git

cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig

ARCH=arm CROSS_COMPILE=arm-linux- make menuconfig

ARCH=arm CROSS_COMPILE=arm-linux- make zImage

Page 32: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – modules

32

git clone git://git.freescale.com/imx/linux-2.6-imx.git

cd linuxARCH=arm CROSS_COMPILE=arm-linux- make imx_v7_defconfig

ARCH=arm CROSS_COMPILE=arm-linux- make menuconfig

ARCH=arm CROSS_COMPILE=arm-linux- make zImage

ARCH=arm CROSS_COMPILE=arm-linux- INSTALL_MOD_PATH=<dir>/ make modules_install

Page 33: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – installation on SD card

33

U-Bootu-boot.imx

LinuxzImage

rootfs

↑ 1 kB

↑8 MB

↑24 MB

Page 34: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – boot

34

U-Boot 2015.04 (Sep 05 2016 - 12:34:38)

CPU: Freescale i.MX6UL rev1.0 at 396 MHzCPU: Temperature 42 CReset cause: PORBoard: Grinn liteBoardDRAM: 512 MiBMMC: FSL_SDHC: 0, FSL_SDHC: 1*** Warning - bad CRC, using default environment

In: serialOut: serialErr: serialswitch to partitions #0, OKmmc0 is current deviceNet: FEC0Error: FEC0 address not set.

Normal BootHit any key to stop autoboot: 0 switch to partitions #0, OKmmc0 is current deviceswitch to partitions #0, OKmmc0 is current devicereading boot.scr** Unable to read file boot.scr **reading zImage6047040 bytes read in 280 ms (20.6 MiB/s)Booting from mmc ...reading imx6ul-liteboard.dtb** Unable to read file imx6ul-liteboard.dtb **Kernel image @ 0x80800000 [ 0x000000 - 0x5c4540 ]

Starting kernel ...

Page 35: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – installation on SD card

35

U-Bootu-boot.imx

Linuxzimage

device-tree

rootfs

↑ 1 kB

↑8 MB

↑24 MB

Page 36: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree

36

The devicetree is a data structure for describing hardware. Rather than hard coding every detail of a

device into an operating system, many aspects of the hardware can be described in a data structure that is

passed to the operating system at boot time.

source: www.devicetree.org

Page 37: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree

37

The devicetree is used by OpenFirmware, OpenPOWER Abstraction Layer (OPAL), Power Architecture Platform Requirements (PAPR) and in the standalone Flattened

Device Tree (FDT) form.

source: www.devicetree.org

Page 39: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree - example

39

&fec1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet1>;

phy-mode = "rmii"; phy-handle = <&ethphy0>; status = "okay"; }

mdio { ethphy0: ethernet-phy@0 { compatible = "smsc,lan8720"; reg = <0>; }

doc: Documentation/devicetree/bindings/net/fsl-fec.txt

doc: Documentation/devicetree/bindings/net/phy.txt

Page 40: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree - example

40

&fec1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet1>;

phy-mode = "rmii"; phy-handle = <&ethphy0>; status = "okay"; }

mdio { ethphy0: ethernet-phy@0 { compatible = "smsc,lan8720"; reg = <0>; }

pinctrl_enet1: enet1grp { fsl,pins = < MX6UL_PAD_GPIO1_IO07__ENET1_MDC 0x1b0b0 MX6UL_PAD_GPIO1_IO06__ENET1_MDIO 0x1b0b0 MX6UL_PAD_ENET1_RX_EN__ENET1_RX_EN 0x1b0b0 MX6UL_PAD__RX_ER__ENET1_RX_ER 0x1b0b0 MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0 MX6UL_PAD_ENET1_RX_DATA1__ENET1_RDATA01 0x1b0b0 MX6UL_PAD_ENET1_TX_EN__ENET1_TX_EN 0x1b0b0 MX6UL_PAD_ENET1_TX_DATA0__ENET1_TDATA00 0x1b0b0 MX6UL_PAD_ENET1_TX_DATA1__ENET1_TDATA01 0x1b0b0 MX6UL_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 0x4001b031 >; }

doc: Documentation/devicetree/bindings/net/fsl-fec.txt

doc: Documentation/devicetree/bindings/net/phy.txt

docs: Documentation/devicetree/bindings/pinctrl/fsl,imx6ul-pinctrl.txtdocs: Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt

Page 41: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – pinmux

41

MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0

Page 42: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – pinmux

42

MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0

1

1 0 1 1 0 1 0 1 1 0 0

source: i.MX 6UltraLite Applications Processor Reference Manual

Page 43: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – pinmux

43

MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0

1

1 0 1 1 0 1 0 1 1 0 0

source: i.MX 6UltraLite Applications Processor Reference Manual

Slow Slew Rate, Drive Strength 43Ω, Speed medium(100MHz), 100KΩ Pull Up Enabled, Hysteresis Enabled

Page 44: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – default output

44

chosen { stdout-path = &uart1; };

&uart1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "okay"; };

pinctrl_uart1: uart1grp { fsl,pins = < MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX 0x1b0b1 MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX 0x1b0b1 >; };

doc: Documentation/devicetree/bindings/chosen.txt

doc: Documentation/devicetree/bindings/serial/fsl-imx-uart.txt

docs: Documentation/devicetree/bindings/pinctrl/fsl,imx6ul-pinctrl.txtdocs: Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt

Page 45: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – peripheral configuration

45

uart1: serial@02020000 { compatible = "fsl,imx6ul-uart", "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_UART1_IPG>, <&clks IMX6UL_CLK_UART1_SERIAL>; clock-names = "ipg", "per"; status = "disabled"; };

source: i.MX 6UltraLite Applications Processor Reference Manual

Page 46: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – peripheral configuration

46

uart1: serial@02020000 { compatible = "fsl,imx6ul-uart", "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_UART1_IPG>, <&clks IMX6UL_CLK_UART1_SERIAL>; clock-names = "ipg", "per"; status = "disabled"; };

source: i.MX 6UltraLite Applications Processor Reference Manual

Page 47: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – peripheral configuration

47

uart1: serial@02020000 { compatible = "fsl,imx6ul-uart", "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6UL_CLK_UART1_IPG>, <&clks IMX6UL_CLK_UART1_SERIAL>; clock-names = "ipg", "per"; status = "disabled"; };

&uart1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "okay"; };

pinctrl_uart1: uart1grp { fsl,pins = < MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX 0x1b0b1 MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX 0x1b0b1 >; };

Page 48: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree - imx6ul-liteboard.dts

48

● USB OTG● PHY● UART● SD

imx6ul-litesom.dtsi

imx6ul.dtsi

skeleton.dtsi

imx6ul-liteboard.dts

Page 49: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree - imx6ul-litesom.dtsi

49

● DDR● eMMC● LDO

imx6ul-liteboard.dts

imx6ul.dtsi

skeleton.dtsi

imx6ul-litesom.dtsi

Page 50: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree - imx6ul.dtsi

50

● CPU● interrupts● clocks● peripherals● LDO

imx6ul-liteboard.dts

imx6ul-litesom.dtsi

skeleton.dtsi

imx6ul.dtsi

Page 51: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree - skeleton.dtsi

51

● skeleton device tree● the bare minimum

needed to boot

imx6ul-liteboard.dts

imx6ul-litesom.dtsi

imx6ul.dtsi

skeleton.dtsi

Page 52: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

skeleton.dtsi

Device tree – imx6u-liteboard.dtb

52

imx6ul-liteboard.dts

imx6ul-litesom.dtsi

imx6ul.dtsi

imx6ul-liteboard.dtb

Page 53: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Linux – installation on SD card

53

U-Bootu-boot.imx

Linuxzimage

device-treeimx6ul-liteboard.dtb

rootfs

↑ 1 kB

↑8 MB

↑24 MB

Page 54: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

First boot

54

Starting kernel ...

Booting Linux on physical CPU 0x0Linux version 4.1.15 (filug@gwork) (gcc version 4.9.3 (Buildroot 2016.08-git-gf51d8a9) ) #1 SMP PREEMPT Mon Sep 5 12:46:23 CEST 2016CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7dCPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cacheMachine model: Grinn i.MX6UL liteBoardReserved memory: created CMA memory pool at 0x8c000000, size 320 MiBReserved memory: initialized node linux,cma, compatible id shared-dma-poolMemory policy: Data cache writeallocPERCPU: Embedded 12 pages/cpu @8bb37000 s16960 r8192 d24000 u49152Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rwPID hash table entries: 2048 (order: 1, 8192 bytes)Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)Memory: 178704K/524288K available (8351K kernel code, 435K rwdata, 2896K rodata, 428K init, 450K bss, 17904K reserved, 327680K cma-reserved, 0K highmem)

reading zImage6047040 bytes read in 280 ms (20.6 MiB/s)Booting from mmc ...reading imx6ul-liteboard.dtb26282 bytes read in 20 ms (1.3 MiB/s)Kernel image @ 0x80800000 [ 0x000000 - 0x5c4540 ]## Flattened Device Tree blob at 83000000 Booting using the fdt blob at 0x83000000 Using Device Tree in place at 83000000, end 830096a9

Page 55: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

First boot

55

dhd_module_init insnvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01 18:09:38 UTC (65378)ALSA device list: No soundcards found.VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2): error -6Please append a correct "root=" boot option; here are the available partitions:0100 65536 ram0 (driver?)0101 65536 ram1 (driver?)0102 65536 ram2 (driver?)0103 65536 ram3 (driver?)0104 65536 ram4 (driver?)0105 65536 ram5 (driver?)0106 65536 ram6 (driver?)0107 65536 ram7 (driver?)0108 65536 ram8 (driver?)0109 65536 ram9 (driver?)010a 65536 ram10 (driver?)010b 65536 ram11 (driver?)010c 65536 ram12 (driver?)010d 65536 ram13 (driver?)010e 65536 ram14 (driver?)010f 65536 ram15 (driver?)b300 3813376 mmcblk0 driver: mmcblk b301 16384 mmcblk0p1 00000000-01b308 1875968 mmcblk1 driver: mmcblkb320 128 mmcblk1rpmb (driver?)b318 1024 mmcblk1boot1 (driver?)b310 1024 mmcblk1boot0 (driver?)Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)

Page 56: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – minimal rootfs

56

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides

replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc.

Page 57: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – configuration

57

Page 58: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – network utilities

58

Page 59: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – editors

59

Page 60: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – archival utilities

60

Page 61: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – archival utilities

61

Page 62: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – minimal rootfs

62

# ls -l /bin/total 641lrwxrwxrwx 1 root root 7 Sep 5 2016 ash -> busybox-rwsr-xr-x 1 root root 654012 Sep 5 2016 busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 cat -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 catv -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chattr -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chgrp -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chmod -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 chown -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 cp -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 cpio -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 date -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 dd -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 df -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 dmesg -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 dumpkmap -> busyboxlrwxrwxrwx 1 root root 7 Sep 5 2016 echo -> busybox

Page 63: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – compilation

63

git clone git://busybox.net/busybox.git

cd busybox

make defconfigmake menuconfig

CROSS_COMPILE=arm-linux-gnueabihf- make

CROSS_COMPILE=arm-linux-gnueabihf- install

Page 64: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – compilation output

64

_install/├── bin│   ├── ash -> busybox│   ├── base64 -> busybox│   ├── busybox… …│   └── zcat -> busybox├── linuxrc -> bin/busybox├── sbin│   ├── acpid -> ../bin/busybox… …│   └── zcip -> ../bin/busybox└── usr ├── bin │   ├── [ -> ../../bin/busybox … … │   └── yes -> ../../bin/busybox └── sbin ├── addgroup -> ../../bin/busybox … └── udhcpd -> ../../bin/busybox

Page 65: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – running

65

?

Page 66: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Busybox – running

66

?

missing

● shared libraries,● configuration files,● user accounts,● confiuration for

peripherials.

Page 67: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager

67

NetworkManager is a set of co-operative tools that make networking simple and

straightforward.

Whether WiFi, wired, 3G, or Bluetooth, NetworkManager allows you to quickly move

from one network to another.

Once a network has been configured and joined once, it can be detected and re-joined

automatically the next time it's available.

Page 68: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

68

networkmanager

Page 69: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

69

networkmanager

ppp

An implementation of the Point-to-point protocol.

Page 70: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

70

networkmanager

pppzlib

Standard (de)compression library.Used by things like gzip and libpng.

Page 71: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

71

networkmanager

mm pppzlib

ModemManager is a DBus-activated daemon whichcontrols mobile broadband (2G/3G/4G) devices and connections.

Page 72: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

72

libgudev

networkmanager

mm pppzlib

This library provides GObject bindings for libudev.

Page 73: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

73

dbus-glib

libgudev

networkmanager

mm pppzlib

GLib bindings for D-Bus.

Page 74: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

74

dbus-glib

libgudev

networkmanager

mm pppzlib

pcre

Perl Compatible Regular Expressions.

Page 75: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

75

dbus-glib

libgudev

networkmanager

mm pppzlib libffi

pcre

The libffi library provides a portable,high level programming interface to various calling conventions.

Page 76: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

76

dbus-glib

libndp libgudev

networkmanager

mm pppzlib libffi

pcre

This package contains a library which provides a wrapper for IPv6 Neighbor Discovery Protocol.

Page 77: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

77

dbus-glib readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre

The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in.

Page 78: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

78

dbus-glib readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurses

The Ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more.

Page 79: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

79

dbus-glib

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurses

Various useful/essential linux libraries and utilities.Things like mkfs, mkswap, swapon, fdisk, mount, dmesg, etc...

Page 80: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

80

dbus-glibwireless

tools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurses

A collection of tools to configure wireless lan cards.

Page 81: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

81

dbus-glib

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurses

GNU's basic cryptographic library.

Page 82: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

82

dbus-glib

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurseslibgpgerror

Libgpg-error is a small library with error codes anddescriptions shared by most GnuPG related software.

Page 83: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

83

dbus-glib gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurseslibgpgerror

Secure communications library implementingthe SSL and TLS protocols and technologies around them.

Page 84: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

84

libtasn1

dbus-glib gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurseslibgpgerror

ASN.1 (Abstract Syntax Notation One) library.

Page 85: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

85

libtasn1

dbus-glib gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurseslibgpgerror

nettle

Nettle is a cryptographic library that is designedto fit easily in more or less any context.

Page 86: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

86

libtasn1

gmp

dbus-glib gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurseslibgpgerror

nettle

GNU Multiple Precision Arithmetic Library.

Page 87: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

87

libtasn1

gmp

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib libffi

pcre ncurseslibgpgerror

nettle

A library for applications dealing with netlink socket.

Page 88: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

88

libtasn1

gmp

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib

libglib2

libffi

pcre ncurseslibgpgerror

nettle

Low-level core library that forms the basis of GTK+ and GNOME.

Page 89: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

89

libtasn1

gmp

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib

libglib2

libffi

pcre ncurseslibgpgerror

nettle

dbus

Message bus system.

Page 90: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

90

libtasn1

gmp

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib

libglib2

libffi

pcre ncurseslibgpgerror

nettle

dbus

expat

XML Parser.

Page 91: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

91

libtasn1

gmp

udev

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm pppzlib

libglib2

libffi

pcre ncurseslibgpgerror

nettle

dbus

expat

Device manager for the Linux kernel.

Page 92: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

92

libtasn1

gmp

udev

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm ppp

kmod

zlib

libglib2

libffi

pcre ncurseslibgpgerror

nettle

dbus

expat

Kernel modules handler.

Page 93: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager - dependencies

93

libtasn1

gmp

udev

dbus-glib

libnl

gnutls

libcrypt

wirelesstools

util-linux

readline

libndp libgudev

networkmanager

mm ppp

kmod

zlib

libglib2

libffi

pcre ncurseslibgpgerror

nettle

dbus

expat

1 Network manager + 24 additional packages

Page 94: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Network Manager – build guide

94

Page 95: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Build systems

95

● Open Embedded

● Buildroot

● OpenADK

● PTXdist

● Linux From Scratch

● Nard SDK

● LTIB

● OpenBricks

● Building Embedded Userlands

● Scratchbox

● OpenWRT

● Yocto Project

source: elinux.org

Page 96: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Build systems

96

● Open Embedded

● Buildroot

● OpenADK

● PTXdist

● Linux From Scratch

● Nard SDK

● LTIB

● OpenBricks

● Building Embedded Userlands

● Scratchbox

● OpenWRT

● Yocto Project

source: elinux.org

Page 97: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Build systems – build flow

97

downloading patching configuration

compilation

packing

Page 98: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

OpenWRT

98

source: public domain

● First device Linksys WRT54G,● First release Jan 2006,● ~1300 source packages,● ~3500 binary packages,● Package manager - opkg,● Web interface – LuCI,● IPv4, IPv6, TR-069, …

Page 99: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

OpenWRT – as a build system

99

● Based on modified Buildroot,● Configuration via kconfig,● Support for:

– automake, autoconf,– cmake,– SCons.

Page 100: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Yocto Project

100

source: freeelectrons.com

Page 101: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Yocto Project

101

source: www.yoctoproject.org

Page 102: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Yocto Project – key features

102

● Support for the major architectures: ARM, MIPS, PowerPC, x86,

● Well defined roles for core recipes and layers,● Separated configuration:

– distribution configuration,– machine configuration,– image recipe,

● Detection of configuration changes,● Possibility to exclude GPLv3 packages.

Page 103: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Yocto Project – drawbacks

103

● Steeper learning curve,● Recipes are written in a mix of bitbake specific

language, python and shell script,● Recommended 50 GB free space for each image,● Long build time.

Page 104: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot

104

● Started in 2001,● Supported architectures: ARC, ARM, Blackfin, m68k,

Microblaze, MIPS, Nios II, PowerPC, SPARC, x86, Xtensa,

● Support for > 1600 packages,● > 130 default configs,● support for ~ 70 boards.

Page 105: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

105

├ arch board├ boot├ configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain├

configuration for each supported architecture

Page 106: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

106

├ arch ├ board boot├ configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain├

configuration for each supported board

Page 107: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

107

├ arch ├ board ├ boot configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain├

bootloader packages

Page 108: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

108

├ arch ├ board ├ boot ├ configs doc├ fs├ linux├ packages├ support├ system├ toolchain├

default configs

for

supported boards

Page 109: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

109

├ arch ├ board ├ boot ├ configs ├ doc fs├ linux├ packages├ support├ system├ toolchain├

documentation

Page 110: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

110

├ arch ├ board ├ boot ├ configs ├ doc ├ fs linux├ packages├ support├ system├ toolchain├

tools to generate

target filesystem

Page 111: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

111

├ arch ├ board ├ boot ├ configs ├ doc ├ fs ├ linux packages├ support├ system├ toolchain├

tools to compile

Linux kernel

Page 112: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

112

├ arch ├ board

├ boot├ configs├ doc├ fs├ linux├ packages

support├ system├ toolchain├

tools to compile

all supported

packages

Page 113: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

113

├ arch├ board├ boot├ configs├ doc├ fs├ linux├ packages├ support

system├ toolchain├

utility tools

required by Busybox

Page 114: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

114

├ arch├ board├ boot├ configs├ doc├ fs├ linux├ packages├ support├ system

toolchain├

target rootfs skeleton

Page 115: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot - structure

115

├ arch├ board├ boot├ configs├ doc├ fs├ linux├ packages├ support├ system├ toolchain

cross-compiler configuration

Page 116: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – how to start

116

cd buildroot

make grinn_liteboard_defconfig

make menuconfig

make all

Page 117: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – output

117

buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ └ target/

Page 118: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – download directory

118

buildroot/├ dl/│ ├ autoconf-2.69.tar.xz│ ├ dosfstools-4.0.tar.xz│ ├ gcc-4.9.3.tar.bz2│ └ …└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ └ target/

Page 119: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – host tools

119

buildroot/├ dl/└ output/ ├ build/ ├ host/ │ ├ etc/ │ ├ sbin/ │ └ usr/ │ ├ arm-buildroot-linux... │ ├ bin/ │ ├ include/ │ ├ lib/ │ └ … ├ images/ ├ staging/ └ target/

Page 120: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – build directory

120

buildroot/├ dl/└ output/ ├ build/ │ ├ host-autoconf-2.69/ │ ├ host-fakeroot-1.20.2/ │ ├ glibc-2.23/ │ └ … ├ host/ ├ images/ ├ staging/ └ target/

Page 121: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – target sysroot

121

buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ │ ├ bin/ │ ├ etc/ │ ├ lib/ │ ├ lib32/ │ ├ sbin/ │ ├ usr/ │ └ var/ └ target/

Page 122: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – target root filesystem

122

buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ ├ staging/ └ target/ ├ bin/ ├ dev/ ├ etc/ ├ lib/ ├ lib32/ ├ linuxrc ├ media/ ├ mnt/ └ …

Page 123: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – target images, etc…

123

buildroot/├ dl/└ output/ ├ build/ ├ host/ ├ images/ │ ├ boot.vfat │ ├ imx6ul-liteboard.dtb │ ├ rootfs.ext2 │ ├ rootfs.ext4 │ ├ rootfs.tar │ ├ sdcard.img │ ├ u-boot.imx │ └ zImage ├ staging/ └ target/

Page 124: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Buildroot – deploying on SD card

124

sudo dd if=output/images/sdcard.img of=/dev/<sdcard> bs=4M

Page 125: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Sensor sandwich

125

IC sensors I2C address

U3: BME280 temperature, pressure, humidity 0x76

U4: LTR329 light 0x29

Page 126: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Sensor sandwich @ liteboard

126

sensor sandwich

liteboard

Page 127: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – enabling I2C1

127

&iomuxc {imx6ul-liteboard-ws {

pinctrl_i2c1: i2c1grp {fsl,pins = <

MX6UL_PAD_CSI_MCLK__I2C1_SDA 0x4001b8b0MX6UL_PAD_CSI_PIXCLK__I2C1_SCL 0x4001b8b0

>;};

};};

&i2c1 {clock-frequency = <100000>;pinctrl-names = "default";pinctrl-0 = <&pinctrl_i2c1>;status = "okay";

};

Page 128: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – result

128

# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --

Page 129: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – result

129

# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --

0x29 – LTR329,0x76 – BME280,

Page 130: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – result

130

# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --

0x29 – LTR329,0x76 – BME280,0x1C – MCP9808,0x19 – LIS3DHTR.

Page 131: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Device tree – result

131

# i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 19 -- -- 1c -- -- -- 20: 20 -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- 76 --

0x29 – LTR329,0x76 – BME280,0x1C – MCP9808,0x19 – LIS3DHTR.

0x18 – TLC320AIC,0x20 – MCP23008.

Page 132: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

BME280

132

The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles.

The sensor module is housed in an extremely compact metal-lid LGA package with a footprint of only 2.5 × 2.5 mm2 with a height of 0.93 mm.

Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules

or watches.

The BME280 is register and performance compatible to the Bosch Sensortec BMP280 digital pressure sensor.

source: BME280 Final data sheet

Page 133: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

BME280

133

source: BME280 Final data sheet

Page 134: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Enabling BME280 - driver

134

make linux-menuconfig

Page 135: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Enabling BME280 - driver

135

make linux-menuconfig

● Device Drivers● Industrial I/O support

● Pressure sensors● Bosch Sensortec BMP280 pressure sensor driver

Page 136: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Enabling BME280 - driver

136

make linux-menuconfig

● Device Drivers● Industrial I/O support

● Pressure sensors● Bosch Sensortec BMP280 pressure sensor driver

Page 137: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Enabling BME280 – device tree

137

&i2c1 { bme280: bme280@76 { compatible = "bmp280"; reg = <0x76>; };};

Page 138: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Rebuild

138

make linux-rebuild

make all

Page 139: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Rebuild

139

make linux-rebuild all

Page 140: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Result

140

?

Page 141: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Software development with Buildroot

141

Page 142: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Override file

142

BR2_PACKAGE_OVERRIDE_FILE

Buildroot reads an override file, which allows the user to tell Buildroot the location of the source for certain packages.

By default this override file is named local.mk and located in the top directory of the Buildroot source tree,

Page 143: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Override file – local.mk

143

<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources

Page 144: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Override file – local.mk

144

<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources

LINUX_OVERRIDE_SRCDIR = /home/bob/linux/BUSYBOX_OVERRIDE_SRCDIR = /home/bob/busybox/

Page 145: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Override file – local.mk

145

<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources

LINUX_OVERRIDE_SRCDIR = ../linux/

Page 146: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

BME230 userspace interface

146

# cd /sys/bus/iio/devices/iio:device0/# lsdev of_nodein_humidityrelative_input powerin_pressure_input subsystemin_temp_input ueventname

# cat in_humidityrelative_input

# cat in_pressure_input

# cat in_temp_input

Page 147: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LTR329

147

source: LTR-329ALS-01 DATA SHEET

The LTR-329ALS-01 is a low voltage I2C digital light sensor [ALS] in a low cost miniature chipled lead-free surface mount

package.

This sensor converts light intensity to a digital output signal capable of direct I2C interface.

It provides a linear response response over a wide dynamic range from 0.01 lux to 64k lux and is well suited to

applications under high ambient brightness.

There are altogether six gain settings (1X, 2X, 4X, 8X, 48X and 96X) available for user to configure.

Page 148: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LTR329 – block diagram

148

source: LTR-329ALS-01 DATA SHEET

Page 149: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LTR329 – measurement channels

149

source: LTR-329ALS-01 DATA SHEET

Page 150: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LTR329 – measurement channels

150

source: LTR-329ALS-01 DATA SHEET

Page 151: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LTR329 – measure current light

151

#!/bin/sh

I2C_BUS=0I2C_ADDR=0x29

LIGHT_RANGE=64000LIGHT_OFFSET=1

# Start measurementi2cset -fy ${I2C_BUS} ${I2C_ADDR} 0x80 0x01

# Read measured valueVALUE=`i2cget -fy 0 0x29 0x8a w`

VALUE_LUX=$((${VALUE}*${LIGHT_RANGE}/0xFFFF + ${LIGHT_OFFSET}))

echo ${VALUE_LUX}

Page 152: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Rootfs overlay

152

BR2_ROOTFS_OVERLAY

Specify a list of directories that are copied over the target root filesystem after the build has finished and

before it is packed into the selected filesystem images.

Page 153: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Rootfs overlay

153

Page 154: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Rootfs overlay

154

Page 155: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Rootfs overlay

155

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ usr/ └ bin/   ├ get-light └ get-light-loop

BR2_ROOTFS_OVERLAY=board/grinn/liteboard/rootfs-overlay

Page 156: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Display @ liteboard

156

Page 157: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Display @ liteboard

157

Page 158: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD_EN pin - driver

158

make linux-menuconfig

● Device Drivers● GPIO Support

● SPI GPIO expanders● Microchip MCP23xxx I/O expander

Page 159: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD_EN pin – device tree

159

&i2c1 { mcp23008: mcp230008@20 { compatible = "microchip,mcp23008"; gpio-controller; #gpio-cells = <2>; reg = <0x20>;

lcd_en { gpio-hog; gpios = <7 0>; output-high; line-name = "lcd-en"; }; };};

doc: Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt

Page 160: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD_EN pin – device tree

160

&i2c1 { mcp23008: mcp230008@20 { compatible = "microchip,mcp23008"; gpio-controller; #gpio-cells = <2>; reg = <0x20>;

lcd_en { gpio-hog; gpios = <7 0>; output-high; line-name = "lcd-en"; }; };};

doc: Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt

Page 161: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD - driver

161

make linux-menuconfig

● Device Drivers● Graphics support

● Frame buffer Devices● MXS LCD framebuffer support

Page 162: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD data pins

162

&iomuxc { imx6ul-liteboard-demo { pinctrl_lcdif_dat: lcdifdatgrp { fsl,pins = < MX6UL_PAD_LCD_DATA00__LCDIF_DATA00 0x79 MX6UL_PAD_LCD_DATA01__LCDIF_DATA01 0x79 MX6UL_PAD_LCD_DATA02__LCDIF_DATA02 0x79 MX6UL_PAD_LCD_DATA03__LCDIF_DATA03 0x79 MX6UL_PAD_LCD_DATA04__LCDIF_DATA04 0x79 MX6UL_PAD_LCD_DATA05__LCDIF_DATA05 0x79 MX6UL_PAD_LCD_DATA06__LCDIF_DATA06 0x79 MX6UL_PAD_LCD_DATA07__LCDIF_DATA07 0x79 MX6UL_PAD_LCD_DATA08__LCDIF_DATA08 0x79 ... MX6UL_PAD_LCD_DATA23__LCDIF_DATA23 0x79 >; }; };};

Page 163: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD control pins

163

&iomuxc { imx6ul-liteboard-demo { pinctrl_lcdif_ctrl: lcdifctrlgrp { fsl,pins = < MX6UL_PAD_LCD_CLK__LCDIF_CLK 0x79 MX6UL_PAD_LCD_ENABLE__LCDIF_ENABLE 0x79 MX6UL_PAD_LCD_HSYNC__LCDIF_HSYNC 0x79 MX6UL_PAD_LCD_VSYNC__LCDIF_VSYNC 0x79 >; }; };};

Page 164: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD display configuration

164

&lcdif { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_lcdif_dat &pinctrl_lcdif_ctrl>; display = <&display0>; status = "okay";}

Page 165: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Display configuration @ device-tree

165

+----------+-------------------------------------+----------+-------+| | ↑ | | || | |vback_porch | | || | ↓ | | |+----------#######################################----------+-------+| # ↑ # | || # | # | || hback # | # hfront | hsync || porch # | hactive # porch | len ||<-------->#<-------+--------------------------->#<-------->|<----->|| # | # | || # |vactive # | || # | # | || # ↓ # | |+----------#######################################----------+-------+| | ↑ | | || | |vfront_porch | | || | ↓ | | |+----------+-------------------------------------+----------+-------+| | ↑ | | || | |vsync_len | | || | ↓ | | |+----------+-------------------------------------+----------+-------+

source: Documentation/devicetree/bindings/video/display-timing.txt

Page 166: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Display configuration @ device-tree

166

+----------+-------------------------------------+----------+-------+| | ↑ | | || | | 46 lines | | || | ↓ | | |+----------#######################################----------+-------+| # ↑ # | || # | # | || 46 # | # 210 | 2 || pixels # | 800 pixels # pixels | pixels||<-------->#<-------+--------------------------->#<-------->|<----->|| # | # | || # | 480 pixels # | || # | # | || # ↓ # | |+----------#######################################----------+-------+| | ↑ | | || | | 22 lines | | || | ↓ | | |+----------+-------------------------------------+----------+-------+| | ↑ | | || | | 2 lines | | || | ↓ | | |+----------+-------------------------------------+----------+-------+

Page 167: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD display configuration

167

display-timings { native-mode = <&timing0>; timing0: timing0 { clock-frequency = <30000000>; hactive = <800>; vactive = <480>; hfront-porch = <210>; hsync-len = <2>; hback-porch = <46>; vfront-porch = <22>; vsync-len = <2>; vback-porch = <23>; hsync-active = <1>; vsync-active = <1>; de-active = <1>; pixelclk-active = <0>; };};

doc: Documentation/devicetree/bindings/video/display-timing.txt

Page 168: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Touchscreen - driver

168

make linux-menuconfig

● Device Drivers● Input device support

● Generic input layer● Touchscreens

● Freescale i.MX6UL touchscreen controller

Page 169: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Touchscreen – device tree

169

&tsc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_tsc>; status = "okay";

xnur-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>; measure_delay_time = <0xffff>; pre_charge_time = <0xfff>;};

doc: Documentation/devicetree/bindings/input/touchscreen/imx6ul_tsc.txt

Page 170: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD Backlight - driver

170

make linux-menuconfig

● Device Drivers● Graphics support

● Backlight & LCD device support● Lowlevel Backlight controls

● Generic PWM based Backlight Driver

Page 171: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

PWM - driver

171

make linux-menuconfig

● Device Drivers● Pulse-Width Modulation (PWM) Support

● i.MX PWM support

Page 172: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

LCD Backlight – device tree

172

/ { backlight { compatible = "pwm-backlight"; pwms = <&pwm2 0 5000000>; brightness-levels = <0 4 8 16 32 64 128 255>; default-brightness-level = <6>; status = "okay"; };};

doc: Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt

Page 173: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

PWM – device tree

173

&pwm2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_pwm2>; status = "okay"; clocks = <&clks IMX6UL_CLK_PWM2>, <&clks IMX6UL_CLK_PWM2>;};

&iomuxc { imx6ul-liteboard-demo { pinctrl_pwm2: pwm2 { fsl,pins = < MX6UL_PAD_GPIO1_IO09__PWM2_OUT 0x110b0 >; }; };};

doc: Documentation/devicetree/bindings/pwm/imx-pwm.txt

Page 174: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

How to test LCD panel?

174

cat /dev/urandom > /dev/fb0

hexdump /dev/input/event1

Page 175: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Touchscreen calibration - tslib

175

make menuconfig

● Target packages ● Libraries

● Hardware handling● tslib

Page 176: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Touchscreen calibration

176

ts_calibrate

Page 177: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Touchscreen calibration - verification

177

ts_test

Page 178: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Touchscreen calibration - customization

178

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ profile.d/   └ ts.sh

export TSLIB_TSDEVICE=/dev/input/event1

Page 179: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Calibration output file

179

/etc/pointercal

cat /etc/pointercal -14809 -664 58312948 745 -10548 34531164 65536 800 480

Page 180: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Calibration output file – during development

180

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ pointercal

Page 181: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Calibration output file – during development

181

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ pointercal

buildroot/└ output/ └ target/ └ etc/ └ pointercal

Page 182: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Calibration output file – during development

182

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ pointercal

buildroot/└ output/ └ target/ └ etc/ └ pointercalbuildroot/

└ board/ └ grinn/ └ liteboard/ └ post-image.sh

cp SRC ${TARGET_DIR}/etc/pointercal

Page 183: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Qt library - history

183

● 1995 – first release,● 1997 – KDE is using Qt,● 2000 – Qt/Embedded has been released,● 2005 – Qt released as GPL software,● 2008 – Qt acquired by Nokia, ● 2008 – Qt released as LGPL software,● 2010 – Qt as based framework for Symbian^4,● 2012 – Qt acquired by Digia.

Page 184: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Qt library - releases

184

● 1995 – Qt 0.9,● 1996 – Qt 1.0,● 1999 – Qt 2.0,● 2001 – Qt 3.0,● 2005 – Qt 4.0, ● 2012 – Qt 5.0.

Page 185: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Qt as SDK - QtCreator

185

Page 186: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

186

Page 187: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

187

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

QCustomPlot

source: qcustomplot.com

Page 188: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

188

QCustomPlot

source: qcustomplot.com

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

Page 189: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

189

QCustomPlot

source: qcustomplot.com

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

Page 190: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

190

QCustomPlot

source: qcustomplot.com

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

Page 191: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

191

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

#!/bin/sh## Start the QT GUI#

case "$1" in start) echo "Starting QT GUI ..." export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0 export QT_QPA_FB_TSLIB=1 /usr/bin/wsgui & ;; stop) printf "Stopping QT GUI ..." killall -9 wsgui ;; restart|reload) "$0" stop "$0" start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1esac

exit $?

Page 192: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

192

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

Page 193: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI

193

demoqt/├ 3rdParty/│ └ qcustomplot/│ ├ changelog.txt│ ├ GPL.txt│ ├ qcustomplot.cpp│ └ qcustomplot.h├ init/│ └ S50demoqt├ src/│ ├ Activity.cpp│ ├ Activity.h│ ├ activity.ui│ └ main.cpp├ CMakeLists.txt├ LICENSE└ README

Page 194: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI – integration with Buildroot

194

BR2_EXTERNAL

BR2_EXTERNAL is an environment variable that can be used to point to a directory that contains Buildroot customizations.

It can be passed to any Buildroot make invocation. It is automatically saved in the hidden .br-external file in the output

directory.

Thanks to this, there is no need to pass BR2_EXTERNAL at every make invocation. It can however be changed at any time by passing

a new value, and can be removed by passing an empty value.

Page 195: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI – integration with Buildroot

195

buildroot-ext/└ package/ └ demoqt/ ├ Config.in └ demoqt.mk

config BR2_PACKAGE_DEMOQT bool "QT5 based Demo GUI for liteboard" depends on BR2_PACKAGE_QT5

help This will build GUI application able to measure temperature, pressure, humidity and light.

Each parameter history is presented on LCD as separate plot.

Page 196: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI – integration with Buildroot

196

buildroot-ext/└ package/ └ demoqt/ ├ Config.in └ demoqt.mk

################################################################################## DemoQT#################################################################################

DEMOQT_VERSION = aa48c8298a9d3e05001bd7059413f43b65c45747DEMOQT_SITE_METHOD = gitDEMOQT_SITE = [email protected]:litesom-example/demoqt.git

DEMOQT_LICENSE = GPLv3DEMOQT_LICENSE_FILES = LICENSE

DEMOQT_INSTALL_STAGING = NODEMOQT_INSTALL_TARGET = YES

DEMOQT_DEPENDENCIES = qt5base

define DEMOQT_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(@D)/init/S50demoqt ${TARGET_DIR}/etc/init.d/S50demoqtendef

$(eval $(cmake-package))

Page 197: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI – integration with Buildroot

197

################################################################################## DemoQT#################################################################################

DEMOQT_VERSION = aa48c8298a9d3e05001bd7059413f43b65c45747DEMOQT_SITE_METHOD = gitDEMOQT_SITE = [email protected]:litesom-example/demoqt.git

DEMOQT_LICENSE = GPLv3DEMOQT_LICENSE_FILES = LICENSE

DEMOQT_INSTALL_STAGING = NODEMOQT_INSTALL_TARGET = YES

DEMOQT_DEPENDENCIES = qt5base

define DEMOQT_INSTALL_INIT_SYSV $(INSTALL) -D -m 0755 $(@D)/init/S50demoqt ${TARGET_DIR}/etc/init.d/S50demoqtendef

$(eval $(cmake-package))

Page 198: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI – integration with Buildroot

198

make BR2_EXTERNAL=../buildroot-ext menuconfig

Page 199: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

QPA - Qt Platform Abstraction Layer

199

QPA is the platform abstraction layer for Qt 5 and replaces QWS and the platform ports from Qt 4.

There is currently little documentation for QPA. The best approach for developing a new platform plugin is to look

at the other plugins and see how they implement the APIs in question.

Page 200: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

QPA - Qt Platform Abstraction Layer

200

There are multiple platform plugins that are potentially usable on Embedded Linux systems: EGLFS, LinuxFB,

KMS, DirectFB, Wayland.

The availability of these depend on the configuration of Qt. The default platform plugin is also device-specific.

For instance, on many boards eglfs is chosen as the default one.

source: doc.qt.io/qt-5/embedded-linux.html

Page 201: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

QPA - Qt Platform Abstraction Layer

201

If the default is not suitable, the QT_QPA_PLATFORM environment variable parameter can be used to request

another plugin.

source: doc.qt.io/qt-5/embedded-linux.html

Page 202: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Qt with liteboard display

202

source: doc.qt.io/qt-5/embedded-linux.html

LinuxFB

This plugin writes directly to the framebuffer. Only software-rendered content is supported. Note that on some setups the display performance is expected to be limited.

The linuxfb plugin allows specifying additional settings by passing them in the QT_QPA_PLATFORM environment variable or -platform command-line option.

For example, QT_QPA_PLATFORM=linuxfb:fb=/dev/fb1 specifies that the framebuffer device /dev/fb1 must be used instead of the default fb0. Multiple settings can be specified by separating them with a colon.

Page 203: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Qt with liteboard touchpanel

203

source: doc.qt.io/qt-5/embedded-linux.html

Touch

For some resistive, single-touch touch screens it may be necessary to fall back to using tslib instead of relying on the Linux multi-touch protocol and the event devices. For modern touch screens this is not necessary.

tslib support can be enabled by setting the environment variable QT_QPA_EGLFS_TSLIB or QT_QPA_FB_TSLIB to 1.

To change the device, set the environment variable TSLIB_TSDEVICE or pass the device name on the command-line.

Note that the tslib input handler generates mouse events and supports single touch only, as opposed to evdevtouch which generates true multi-touch QTouchEvent events too.

Page 204: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Demo GUI - configuration

204

export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0export QT_QPA_FB_TSLIB=1

demoqt/└ init/ └ S50demoqt

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ └ profile.d/   └ qt5.sh

Page 205: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

WEB interface

205

demoweb/├ cgi-bin/│ ├ get-humidity│ ├ get-light│ ├ get-pressure│ └ get-temp├ scripts/│ ├ exporting.js│ ├ highcharts.js│ └ jquery-3.1.0.min.js└ src/ └ index.html

#!/bin/sh

echo "Content-type: text/html"echo ""

cat /sys/bus/iio/devices/iio:device0/in_humidityrelative_input

Page 206: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

WEB interface

206

demoweb/├ cgi-bin/│ ├ get-humidity│ ├ get-light│ ├ get-pressure│ └ get-temp├ scripts/│ ├ exporting.js│ ├ highcharts.js│ └ jquery-3.1.0.min.js└ src/ └ index.html

Page 207: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

WEB interface

207

demoweb/├ cgi-bin/│ ├ get-humidity│ ├ get-light│ ├ get-pressure│ └ get-temp├ scripts/│ ├ exporting.js│ ├ highcharts.js│ └ jquery-3.1.0.min.js└ src/ └ index.html

<!DOCTYPE html><html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="/scripts/jquery-3.1.0.min.js"></script>

Page 208: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

DHCP server

208

make busybox-menuconfig

● Networking Utilities● udhcp server (udhcpd)

Page 209: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

DHCP server – config file

209

make busybox-menuconfig

● Networking Utilities● udhcp server (udhcpd)

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ ├ etc/ │ ├ udhcpd.conf │ └ init.d/ │ └ S50dhcpd └ network/ └ interfaces

Page 210: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

HTTP server

210

make busybox-menuconfig

● Networking Utilities● httpd

Page 211: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

HTTP server - configuration

211

make busybox-menuconfig

● Networking Utilities● httpd

buildroot/└ board/ └ grinn/ └ liteboard/ └ rootfs-overlay/ └ etc/ ├ init.d/ │ └ S51httpd └ httpd.conf

Page 212: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Graphs – build time

212

make graph-build

Page 213: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Graphs – dependencies

213

make graph-depends

Page 214: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Graphs – package size on target filesystem

214

make graph-size

Page 215: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Legal info

215

make legal-info

output/├ legal-info/│ ├ host-licenses│ ├ host-sources│ ├ licenses│ └ sources└ README

Page 216: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Workshop summary

216

● How to build software for embedded device,● How to configure dedicated hardware,● How to modify open source software,● How to develop embedded software on PC,● How to build custom and open source software

together,● How to prepare materials for lawyers.

Page 217: liteSOM SDK - Grinnwiki.litesom.grinn-global.com/images/1/1d/LiteSOM_training.pdf · piotr.figlarek@grinn-global.com. AGENDA Linux on embedded devices. How to cross-compile software.

Contact

Robert OtrebaMobile: +48 509 618 007r.otreba@grinn-global .com

GrinnWagonowa 2 53 – 609 WroclawPolandTel + 48 71 716 40 99

www.grinn-global.com

If you are interested in our electronics design services please contact:

THANK YOU FOR YOUR TIME


Recommended