COM iMX25 Linux: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Christoph (talk | contribs)
Lzenz (talk | contribs)
 
(108 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==<br/>FAQ ==
<!-- ==<br/>FAQ == -->


==<br/>Virtual machine for development ==


* [http://www.vmware.com/go/get-player-de Get the VMware player]
== Linux virtual machine for development ==
* Please have a look at: '''[[Virtual Machine for Application Development]]'''


* [http://dl.dropbox.com/u/19433555/Debian%20Squeeze.zipx Debian Squeeze VMware Image (zipx Archiv)]
==Building your own Kernel ==


==<br/>Building your own Kernel ==
==== Sources for the iMX25 Linux Kernel v3.2.9 / v3.2.81: ====
* The latest Linux Kernel source code is available on GitHub: [https://github.com/dh-electronics/linux-imx25 https://github.com/dh-electronics/linux-imx25]
* We recommend to use on new projects the latest v3.2.81 Linux Kernel


=== Sources for the iMX25 Kernel: ===
==== How to build a kernel ====
Get sources from Github and build the linux kernel
{| class="wikitable"
|1. Start a terminal on Linux
|-
|2. <tt># ''git clone [https://github.com/dh-electronics/linux-imx25.git https://github.com/dh-electronics/linux-imx25.git]''</tt>
|-
|3. <tt># ''git checkout BRANCH''<br/>(BRANCH=dev/3.2.9_dhcom or BRANCH=dev/3.2.81_dhcom)</tt>
|-
|4. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make imx25_dhcom_defconfig''</tt>
|-
|5. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|}
* Your new <tt>uImage</tt> file is available in <tt>arch/arm/boot</tt>


* [http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2 Kernel version: 2.6.38]


* Kernel patch
{| style="width: 100%; color: #000000; border-spacing: 2px; border: 1px solid darkgray; background: lightgrey;" valign="top" |
| style="width: 100%;" |
|-
|


* Kernel configuration
=== ''Sources older than February 2014'' ===
==== Sources for the iMX25 Linux Kernel v2.6.38: ====


=== How to build a kernel: ===
:* [http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2 Mainline Kernel version: 2.6.38 from www.kernel.org]


1. tar xfjv linux-2.6.38.tar.bz2
:* [[media:Linux-2.6.38_DHCOM_iMX25_patch.zip|Patch to DHCOM iMX25 Linux (2014-09-29)]]
2. cd /kernel/path
 
3. patch -p1 <...
:* [[media:Linux-2.6.38_DHCOM_iMX25_config.zip|Kernel configuration for DHCOM iMX25 Linux (2014-09-29)]]
4. cp .config /kernel/path
 
5. ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage
==== Sources for the iMX25 Linux Kernel v3.2.9: ====
 
The uImage file will you find in ../build-linux/arch/arm/boot
 
:* [http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.9.tar.bz2 Mainline Kernel version: 3.2.9 from www.kernel.org]
 
:* [[media:DHCOM-linux-imx-3.2.9.patch.zip|Patch to DHCOM iMX25 Linux 3.2.9 (2013-09-20)]]
 
:* [[media:DHCOM-linux-imx-3.2.9.config.zip|Kernel configuration for DHCOM iMX25 Linux 3.2.9 (2013-03-27)]]
 
==== How to build a kernel ====
{| class="wikitable"
|1. Start a terminal on Linux
|-
|2. Copy the above mentioned source files (linux-3.x.y.tar.bz2, .config, *.patch) into our <code>work_path</code>
|-
|3. <tt># ''cd work_path''</tt>
|-
|4. <tt># ''tar xfjv linux-2.6.38.tar.bz2''</tt>
|-
|5. <tt># ''cd work_path/linux-2.6.38''</tt>
|-
|6. <tt># ''patch -p1 <linux-2.6.38_DHCOM_iMX25.patch''</tt>
|-
|7. <tt># ''cp .config work_path/linux-2.6.38''</tt>
|-
|8. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</tt>
|}
:* Your new <tt>uImage</tt> file is available in <tt>work_path/linux-2.6.38/arch/arm/boot</tt>
|}
 
==Update the kernel with U-Boot ==
 
:The linux kernel will be updated by the [[COM iMX25 Bootloader U-Boot#Update|U-Boot flash update]].
 
:* [[media:Linux-2.6.38_DHCOM_iMX25_kernel.zip|Binary image 2.6.38 DHCOM iMX25 linux kernel (2014-09-29)]]
:* [[media:DHCOM-linux-imx-3.2.9_BUILD.zip|Binary image 3.2.9 DHCOM iMX25 linux kernel (2016-02-24)]]
:* [[media:DHCOM-linux-imx-3.2.78_BUILD.zip|Binary image 3.2.78 DHCOM iMX25 linux kernel (2016-03-08)]]
 
:{| class="wikitable"
|1. Copy the <code>'''uImage'''</code> and <code>'''uImage.env'''</code> file onto a microSD card with a FAT file system (you can use the 1st partition on the microSD card)
|-
|2. Insert the microSD card and start the system
|-
|3. Go to the U-Boot console by pressing '''BACKSPACE''' on a RS232 terminal (during startup)
|-
|4. <code>''update linux''</code>
|}
 
==Debian Rootfilesystem ==
=== Available Rootfilesystems ===
Please have a look at the [[COM_iMX25-D2#Downloads | iMX25 Downloads]] section.


==<br/>How to use our root file system ==
=== External Documentation ===
  1. Format a SD card with ext3 file system
* [https://debian-handbook.info/browse/stable/ The Debian Administrator's Handbook]: A reference book presenting the Debian distribution, from initial installation to configuration of services. The administration and configuration chapters apply to our Debian based root filesystems.
2. Copy root file system onto the SD card
*  [https://www.debian.org/doc/ Debian Documentation]
    -Start terminal
    -su
    -chmod 755 /directory/of/the/SD-card
    -cd /directory/of/the/SD-card
    -tar jxvf rootFS_file.tar.bz2


==<br/>How to control the display brightness ==
=== Login ===
  echo <value> >/sys/class/leds/pwm:out/brightness
{| class="wikitable" align="center" | style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
||
value range: 0..255
<tt>
Debian GNU/Linux 6.0 dhcom ttymxc1<br/>


==<br/>Debian system ==
dhcom login: '''root'''<br/>
Password: '''foo'''
</tt>
|}
=== Calibrating the touchscreen ===
=== Calibrating the touchscreen ===
  TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate
{| class="wikitable" align="center" | style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<tt># TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate</tt>
|}
===Running example Qt Apps ===
===Running example Qt Apps ===
  QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws
{| class="wikitable" align="center" | style="width: color: #000000; background: #FFFFFF;" valign="top" |
For the Qt-Browser change demoname to browser
|<tt># QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws</tt>
=== Login/Shutdown system ===
|}
  Name:     root
*'''Remark:''' To start the Qt-Browser replace <tt>demoname</tt> with <tt>browser</tt>
password: foo
 
=== Shutdown ===
  shutdown -h now
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<tt># shutdown -h now</tt>
|}
 
== How to create a microSD-card with a rootfilesystem on it ==
 
1. Format a microSD card like following (in linux e.g. gparted, palimpsest) with '''Master Boot Record''' partition scheme
{| class="wikitable" | style="width: 450px; color: #000000; background: #FFFFFF;" valign="top" |
|
<tt>P1 '''FAT''' (Primary partition: 100MB)</tt><br/>
<tt>P2 '''ext3''' (Primary partition: Residual space)</tt>
|}
2. Untar the root file system to the ext3 partition of the microSD card (Don't copy the tar archive directly to the microSD card)
{| class="wikitable" | style="width: 450px; color: #000000; background: #FFFFFF;" valign="top" |
|
Start the Console on Linux<br/>
<tt># ''su''</tt><br/>
<tt># ''chmod 755 /path/of/the/microSD_card''</tt><br/>
<tt># ''cd /path/of/the/microSD_card''</tt><br/>
<tt># ''tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2''</tt>
|}
'''Remark:''' If you got a *.tar.gz file so type <tt> tar xfzv ... </tt> to extract the rootfilesystem.


==<br/>Busybox system ==
==Busybox Rootfilesystem ==
=== Calibrating the touchscreen ===
=== Calibrating the touchscreen ===
TSLIB_TSDEVICE=/dev/event0 ts_calibrate
:{| class="wikitable"
|<code>''TSLIB_TSDEVICE=/dev/event0 ts_calibrate''</code>
|}
===Running example Qt Apps ===
===Running example Qt Apps ===
QWS_MOUSE_PROTO=Tslib:/dev/event0 /usr/qt/demos/demoname/demoname -qws
:{| class="wikitable"
For the Qt-Browser change demoname to browser
|<code>''QWS_MOUSE_PROTO=Tslib:/dev/event0 /usr/qt/demos/demoname/demoname -qws''</code>
|}
:For the Qt-Browser change <code>demoname</code> to <code>browser</code>
=== Login/Shutdown system ===
=== Login/Shutdown system ===
  Name: root
:{| class="wikitable" style="width: 120px"
||Username: ||root
|-
  ||Password: ||n/a
|}
:{| class="wikitable"
|<code>''halt''</code>
|}
 
 
== Kernel Userspace Interfaces to Access Hardware ==
 
=== Serial (UART) Interfaces ===
:{| class="wikitable" style="width: 400px"
|style="width: 50%;"|DHCOM (FF) UART 1||<code>/dev/ttymxc1</code>
|-
||DHCOM (BT) UART 2 ||<code>/dev/ttymxc2</code>
|-
||DHCOM (STD) UART 3 ||<code>/dev/ttymxc4</code>
|}
 
=== I2C Interfaces ===
:{| class="wikitable" style="width: 400px"
|style="width: 50%;"|DHCOM I2C 1||<code>/dev/i2c-1</code>
|-
||DHCOM I2C 2 ||<code>/dev/i2c-2</code>
|}
 
=== SPI Interfaces ===
:{| class="wikitable" style="width: 400px"
|style="width: 50%;"|DHCOM SPI 1||<code>/dev/spidev1.0</code>
|-
||DHCOM SPI 2 ||<code>/dev/spidev2.0</code>
|}
 
=== Control the display brightness ===
:{| class="wikitable" style="width: 640px"
|<code>''echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness''</code>
|}
:value range: 0..255
 
=== Control GPIOs ===
 
:{|class="wikitable" style="text-align: center; width: 600px"
|-
! DHCOM Name: !! alt. DHCOM Name: !! Port: !! Pin: !! SO-DIMM Pin# !! Linux <GPIO#>
|-
| GPIO A || || 2 || 12 || 154 || 44
|-
| GPIO B || || 3 || 21 || 156 || 85
|-
| GPIO C || || 2 || 4  || 162 || 36
|-
| GPIO D || || 2 || 5  || 163 || 37
|-
| GPIO E || || 2 || 6  || 164 || 38
|-
| GPIO F || || 2 || 7  || 165 || 39
|-
| GPIO G || || 2 || 8  || 167 || 40
|-
| GPIO H || || 2 || 9  || 173 || 41
|-
| GPIO I || || 3 || 17 || 175 || 81
|-
| CIF HSYNC || GPIO J || 1 || 10 || 74 || 10
|-
| CIF PCLK  || GPIO K || 1 || 11 || 72 || 11
|-
| CIF MCLK  || GPIO L || 1 ||  8 || 70 || 8
|-
| CIF VSYNC || GPIO M || 1 ||  9 || 68 || 9
|-
| CIF D9    || GPIO N || 4 || 21 || 66 || 117
|-
| CIF D8    || GPIO O || 1 ||  7 || 64 || 7
|-
| CIF D7    || GPIO P || 1 ||  6 || 62 || 6
|-
| CIF D6    || GPIO Q || 1 || 31 || 60 || 31
|-
| CIF D5    || GPIO R || 1 || 30 || 58 || 30
|-
| CIF D4    || GPIO S || 1 || 29 || 56 || 29
|-
| CIF D3    || GPIO T || 1 || 28 || 54 || 28
|-
| CIF D2    || GPIO U || 1 || 27 || 52 || 27
|}
 
:Export
:{| class="wikitable" style="width: 640px"
|<code>''echo <GPIO#> >/sys/class/gpio/export''</code>
|}
:Set direction
:{| class="wikitable" style="width: 640px"
|<code>''echo in >/sys/class/gpio/gpioXX/direction''</code>
|-
|<code>''echo out >/sys/class/gpio/gpioXX/direction''</code>
|}
:Set value
:{| class="wikitable" style="width: 640px"
|<code>''echo 0 >/sys/class/gpio/gpioXX/value''</code>
|-
|<code>''echo 1 >/sys/class/gpio/gpioXX/value''</code>
|}
:Get value
:{| class="wikitable" style="width: 640px"
|<code>''cat /sys/class/gpio/gpioXX/value''</code>
|}
 
:unexport
:{| class="wikitable" style="width: 640px"
|<code>''echo <GPIO#> >/sys/class/gpio/unexport''</code>
|}
 
 
=== Initialize and test CAN ===
:Initialize:
:{| class="wikitable"
|<code>''ip link set can0 up type can bitrate 500000''</code>
|}
   
   
  halt
:Send test message via cansend (part of can-utils):
:{| class="wikitable"
|<code>''cansend can0 100#11.2233.44556677.88''</code>
|}
 
:Receive message via candump (part of can-utils):
:{| class="wikitable"
|<code>''candump can0''</code>
|}
 
:Get can-utils:
:* [[media:can-utils_armel.zip|Debian package containing can-utils (ARM)]]
 
=== Test display / framebuffer ===
:{| class="wikitable" style="width: 1200px"
  ||<code>fb_1Colorfill</code>|| Fills the framebuffer device with a given RGB color<br><code>Syntax: fb_1Colorfill [fb (0..31)] [Display Bits (1..8)] [Red value (0..255)] [Green value (0..255)] [Blue value (0..255)]</code>
|-
||<code>fb_fb2BMP</code>||Copies framebuffer device data into a 24Bit BMP-File<br><code>Syntax: fb_fb2BMP [fb (0..31)] [24-Bit BMP-File]</code>
|-
||<code>fb_LoadBMP</code>||Loads a 24Bit BMP-file into a 32Bit framebuffer device<br><code>Syntax: fb_LoadBMP [fb (0..31)] [24-Bit BMP-File] [Display Bits (1..8)] [Transparency (0..100)]</code>
|}
:In most common cases the "Display Bits" should be "8"
 
 
:Get DH framebuffer tools:
:* [[media:dh_framebuffer_tools.zip|DH framebuffer tools v1.0 (ARM)]]
 
== Additional Information ==
*[[Linux Kernel Features | Linux Kernel Features ]]
*[[ELBE Overview| Embedded Linux Build Environment (ELBE)]]

Latest revision as of 08:58, 7 October 2016


Linux virtual machine for development

Building your own Kernel

Sources for the iMX25 Linux Kernel v3.2.9 / v3.2.81:

How to build a kernel

Get sources from Github and build the linux kernel

1. Start a terminal on Linux
2. # git clone https://github.com/dh-electronics/linux-imx25.git
3. # git checkout BRANCH
(BRANCH=dev/3.2.9_dhcom or BRANCH=dev/3.2.81_dhcom)
4. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make imx25_dhcom_defconfig
5. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage
  • Your new uImage file is available in arch/arm/boot


Sources older than February 2014

Sources for the iMX25 Linux Kernel v2.6.38:

Sources for the iMX25 Linux Kernel v3.2.9:

How to build a kernel

1. Start a terminal on Linux
2. Copy the above mentioned source files (linux-3.x.y.tar.bz2, .config, *.patch) into our work_path
3. # cd work_path
4. # tar xfjv linux-2.6.38.tar.bz2
5. # cd work_path/linux-2.6.38
6. # patch -p1 <linux-2.6.38_DHCOM_iMX25.patch
7. # cp .config work_path/linux-2.6.38
8. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage
  • Your new uImage file is available in work_path/linux-2.6.38/arch/arm/boot

Update the kernel with U-Boot

The linux kernel will be updated by the U-Boot flash update.
1. Copy the uImage and uImage.env file onto a microSD card with a FAT file system (you can use the 1st partition on the microSD card)
2. Insert the microSD card and start the system
3. Go to the U-Boot console by pressing BACKSPACE on a RS232 terminal (during startup)
4. update linux

Debian Rootfilesystem

Available Rootfilesystems

Please have a look at the iMX25 Downloads section.

External Documentation

Login

Debian GNU/Linux 6.0 dhcom ttymxc1

dhcom login: root
Password: foo

Calibrating the touchscreen

# TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Running example Qt Apps

# QWS_MOUSE_PROTO=Tslib:/dev/input/event0 /usr/qt/demos/demoname/demoname -qws
  • Remark: To start the Qt-Browser replace demoname with browser

Shutdown

# shutdown -h now

How to create a microSD-card with a rootfilesystem on it

1. Format a microSD card like following (in linux e.g. gparted, palimpsest) with Master Boot Record partition scheme

P1 FAT (Primary partition: 100MB)
P2 ext3 (Primary partition: Residual space)

2. Untar the root file system to the ext3 partition of the microSD card (Don't copy the tar archive directly to the microSD card)

Start the Console on Linux
# su
# chmod 755 /path/of/the/microSD_card
# cd /path/of/the/microSD_card
# tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2

Remark: If you got a *.tar.gz file so type tar xfzv ... to extract the rootfilesystem.

Busybox Rootfilesystem

Calibrating the touchscreen

TSLIB_TSDEVICE=/dev/event0 ts_calibrate

Running example Qt Apps

QWS_MOUSE_PROTO=Tslib:/dev/event0 /usr/qt/demos/demoname/demoname -qws
For the Qt-Browser change demoname to browser

Login/Shutdown system

Username: root
Password: n/a
halt


Kernel Userspace Interfaces to Access Hardware

Serial (UART) Interfaces

DHCOM (FF) UART 1 /dev/ttymxc1
DHCOM (BT) UART 2 /dev/ttymxc2
DHCOM (STD) UART 3 /dev/ttymxc4

I2C Interfaces

DHCOM I2C 1 /dev/i2c-1
DHCOM I2C 2 /dev/i2c-2

SPI Interfaces

DHCOM SPI 1 /dev/spidev1.0
DHCOM SPI 2 /dev/spidev2.0

Control the display brightness

echo <value> >/sys/devices/platform/imx-fb.0/backlight/imxfb-bl/brightness
value range: 0..255

Control GPIOs

DHCOM Name: alt. DHCOM Name: Port: Pin: SO-DIMM Pin# Linux <GPIO#>
GPIO A 2 12 154 44
GPIO B 3 21 156 85
GPIO C 2 4 162 36
GPIO D 2 5 163 37
GPIO E 2 6 164 38
GPIO F 2 7 165 39
GPIO G 2 8 167 40
GPIO H 2 9 173 41
GPIO I 3 17 175 81
CIF HSYNC GPIO J 1 10 74 10
CIF PCLK GPIO K 1 11 72 11
CIF MCLK GPIO L 1 8 70 8
CIF VSYNC GPIO M 1 9 68 9
CIF D9 GPIO N 4 21 66 117
CIF D8 GPIO O 1 7 64 7
CIF D7 GPIO P 1 6 62 6
CIF D6 GPIO Q 1 31 60 31
CIF D5 GPIO R 1 30 58 30
CIF D4 GPIO S 1 29 56 29
CIF D3 GPIO T 1 28 54 28
CIF D2 GPIO U 1 27 52 27
Export
echo <GPIO#> >/sys/class/gpio/export
Set direction
echo in >/sys/class/gpio/gpioXX/direction
echo out >/sys/class/gpio/gpioXX/direction
Set value
echo 0 >/sys/class/gpio/gpioXX/value
echo 1 >/sys/class/gpio/gpioXX/value
Get value
cat /sys/class/gpio/gpioXX/value
unexport
echo <GPIO#> >/sys/class/gpio/unexport


Initialize and test CAN

Initialize:
ip link set can0 up type can bitrate 500000
Send test message via cansend (part of can-utils):
cansend can0 100#11.2233.44556677.88
Receive message via candump (part of can-utils):
candump can0
Get can-utils:

Test display / framebuffer

fb_1Colorfill Fills the framebuffer device with a given RGB color
Syntax: fb_1Colorfill [fb (0..31)] [Display Bits (1..8)] [Red value (0..255)] [Green value (0..255)] [Blue value (0..255)]
fb_fb2BMP Copies framebuffer device data into a 24Bit BMP-File
Syntax: fb_fb2BMP [fb (0..31)] [24-Bit BMP-File]
fb_LoadBMP Loads a 24Bit BMP-file into a 32Bit framebuffer device
Syntax: fb_LoadBMP [fb (0..31)] [24-Bit BMP-File] [Display Bits (1..8)] [Transparency (0..100)]
In most common cases the "Display Bits" should be "8"


Get DH framebuffer tools:

Additional Information