COM AM35 Linux: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==<br/>FAQ ==
== Linux virtual machine for development ==
* Please have a look at: '''[[Virtual Machine for Application Development]]'''


=== Ethernet does not work ===
==Building your own Kernel ==
Check if the line "allow-hotplug eth0" in the file "/etc/network/interfaces" is activated. You can activate the ethernet interface on a running system with the command:
:{| class="wikitable"
|<code>''ifconfig eth0 up''</code>
|}
:'''Remark:''' To work with a nfs-rootfilesystem you have to disable the line "allow-hotplug eth0" in the file "/etc/network/interfaces". Maybe the system was prepared for this method for development and nobody did change it back.


=== How to set a Linux environment variable? ===
==== Sources for the AM35x Linux Kernel v3.2.12 / v3.2.81 ====
This example shows you how to configure the system to use a proxy-server with a environment variable.
* The latest Linux Kernel source code is available on GitHub: [https://github.com/dh-electronics/linux-am35x https://github.com/dh-electronics/linux-am35x]
:{| class="wikitable"
* We recommend to use on new projects the latest v3.2.81 Linux Kernel
|<code>''export http_proxy=http://192.168.xxx.xxx:xxxx</code>
|}


=== How to schedule jobs to run periodically at certain times or dates? ===
==== How to build a kernel ====
You can use the cron daemon and/or anacron. To use anacron you have to copy or link your program or script into one of the the following folders:
Get sources from Github and build the linux kernel using 5 threads and a build directory
:{| class="wikitable"
{| class="wikitable"
|<code>/etc/cron.hourly</code>
|1. Start a terminal on Linux
|-
|2. <tt># ''git clone [https://github.com/dh-electronics/linux-am35x.git https://github.com/dh-electronics/linux-am35x.git]''</tt>
|-
|3. <tt># ''mkdir build''</tt>
|-
|4. <tt># ''cd linux-am35x''</tt>
|-
|-
|<code>/etc/cron.daily</code>
|5. <tt># ''git checkout BRANCH''<br/>(BRANCH=dev/3.2.12_dhcom or BRANCH=dev/3.2.81_dhcom)</tt>
|-
|-
|<code>/etc/cron.weekly</code>
|6. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make O=../build/ dhcm3517_defconfig''</tt>
|-
|-
|<code>/etc/cron.monthly</code>
|7. <tt># ''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make -j5 O=../build/ uImage''</tt>
|}
|}
For further information have a look at the general linux documentation.
* Your new <tt>uImage</tt> file is available in <tt>../build/arch/arm/boot</tt>
'''Remark:'''
* On linux-am35x.git we use the git branch "master".  


== Linux virtual machine for development ==
{| style="width: 100%; color: #000000; border-spacing: 2px; border: 1px solid darkgray; background: lightgrey;" valign="top" |
{{DebianVM Development}}
| style="width: 100%;" |
 
|-
==<br/>Building your own Kernel ==
|
 
=== ''Sources older than April 2014'' ===
=== Sources for the AM35 Kernel: ===
==== Sources for the AM35 Kernel based on 3.2.12 Mainline ====


:* [http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.12.tar.bz2 Kernel version: 3.2.12 from www.kernel.org]
:* [http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.2.12.tar.bz2 Kernel version: 3.2.12 from www.kernel.org]
Line 73: Line 75:
::: - changed partitionsize of linux-kernel
::: - changed partitionsize of linux-kernel


=== How to build a kernel: ===
==== How to build a kernel ====
 
{| class="wikitable"
:{| class="wikitable"
|1. Start a terminal on Linux
|1. Start the Console on Linux
|-
|-
|2. Copy the above mentioned source files into our <code>work_path</code> and unzip them
|2. Copy the above mentioned source files (linux-3.x.y.tar.bz2, .config, *.patch) into our <code>work_path</code>
|-
|-
|3. <code>''cd work_path''</code>
|3. <tt># ''cd work_path''</tt>
|-
|-
|4. <code>''tar xfjv linux-3.2.12.tar.bz2''</code>
|4. <tt># ''tar xfjv linux-3.2.12.tar.bz2''</tt>
|-
|-
|5. <code>''cd linux-3.2.12''</code>
|5. <tt># ''cd work_path/linux-3.2.12''</tt>
|-
|-
|6. <code>''patch -p1 <../dh-linux-am35x_xxxxxxxx.patch''</code>
|6. <tt># ''patch -p1 < ../dh-linux-am35x_xxxxxxxx.patch''</tt>
|-
|-
|7. <code>''cp ../dh-linux-am35x_xxxxxxxx.config .config''</code>
|7. <tt># ''cp ../dh-linux-am35x_xxxxxxxx.config .config'</tt>
|-
|-
|8. <code>''ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage''</code>
|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-3.2.12/arch/arm/boot</tt>
|}
|}
:The <code>uImage</code> file will you find in <code>arch/arm/boot</code>


==<br/>Update the kernel with U-Boot ==
== Update the kernel with U-Boot ==


:The linux kernel will be updated by the [[COM_AM35_Bootloader_U-Boot#Update|U-Boot flash update]].
:The linux kernel will be updated by the [[COM_AM35_Bootloader_U-Boot#Update|U-Boot flash update]].


:* [[media:DHCOM-linux-am3517_BUILD.zip |Current built of DHCOM AM35 linux-3.2.12 kernel (details see above)]]
:* [[media:DHCOM-linux-am3517_BUILD.zip |Binary Image DHCOM AM35 linux-3.2.12-rt20 kernel (details see above)]]


:{| class="wikitable"
:{| class="wikitable"
Line 110: Line 112:
|}
|}


== Debian system ==
==Debian Rootfilesystem ==


=== Get Rootfilesystem ===
=== Available Rootfilesystems ===
Please have a look at the [[COM_AM35-D2#Downloads | AM35x Downloads]] section.


:* [https://dl.dropbox.com/u/19433555/DHCOM/2012-07-13_developer-rootfs_am3517.tar.gz Debian rootfilesystem, based on Debian 6.0 "Squeeze" incl. SGX kernel modules (3D acceleration)]
=== External Documentation ===
* [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.
*  [https://www.debian.org/doc/ Debian Documentation]


=== How to create a microSD-card with a rootfilesystem on it ===
=== Login ===
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
||
<tt>
Debian GNU/Linux 6.0 dhcom ttyO0<br/>


:1. Format a microSD card like following (in linux e.g. you can use palimpsest) with '''Master Boot Record''' partition scheme
dhcom login: '''root'''<br/>
::{| class="wikitable"
Password: '''foo'''
|P1 '''FAT'''  (Primary partition: 100MB)
</tt>
|-
|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)
::{| class="wikitable"
|Start the Console on Linux
|-
|<code>''su''</code>
|-
|<code>''chmod 755 /path/of/the/microSD_card''</code>
|-
|<code>''cd /path/of/the/microSD_card''</code>
|-
|<code>''tar xfjv path/to/RootFS/Name_of_RootFS_file.tar.bz2''</code>
|}
|}
:'''Remark:''' If you got a *.tar.gz file so type <code> tar xfzv ...  </code> to extract the rootfilesystem.


=== Login/Shutdown system ===
=== Shutdown ===
:{| class="wikitable" style="width: 120px"
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
||Username: ||root
|<tt># shutdown -h now</tt>
|-
||Password: ||foo
|}
:{| class="wikitable"
|<code>''shutdown -h now''</code>
|}
|}


=== Calibrating the touchscreen ===
=== Calibrating the touchscreen ===
:{| class="wikitable"
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<code>''ts_calibrate''</code>
|<tt># ts_calibrate</tt>
|}
|}
:Check the enviroment variable "TSLIB_TSDEVICE=/dev/input/event0" with <code> printenv </code> if an error occurs.
*Check the enviroment variable "TSLIB_TSDEVICE=/dev/input/event0" with <code> printenv </code> if an error occurs.


===Running Qt Demos ===
===Running Qt Demos ===
:{| class="wikitable"
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<code>''cd /usr/qt/demos/demoname''</code>
|<tt># cd /usr/qt/demos/demoname</tt><br/><tt># ./demoname -qws</tt>
|-
|<code>''demoname -qws''</code>
|}
|}
:For the Qt-Browser change <code>demoname</code> to <code>browser</code>
*For the Qt-Browser change <code>demoname</code> to <code>browser</code>
:If the touchscreen does not work please check the enviroment variable "QWS_MOUSE_PROTO=Tslib:/dev/input/event0" with <code> printenv</code>.
*If the touchscreen does not work please check the enviroment variable "QWS_MOUSE_PROTO=Tslib:/dev/input/event0" with <code> printenv</code>.


'''''Run Qt demos with powerVR (3d acceleration) support:'''''
'''''Run Qt demos with powerVR (3d acceleration) support'''''
:{| class="wikitable"
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<code>''cd /usr/qt/demos/embedded/demoname''</code>
|<tt># cd /usr/qt/demos/embedded/demoname</tt><br/><tt># ./demoname -qws</tt>
|-
|<code>''demoname -qws''</code>
|}
|}


'''''Run demos with a usb-mouse as input device:'''''
'''''Run Qt demos with usb mouse input device'''''
:{| class="wikitable"
{| class="wikitable" align="center" |  style="width: 400px; color: #000000; background: #FFFFFF;" valign="top" |
|<code>''cd /usr/qt/demos/demoname''</code>
|<tt># cd /usr/qt/demos/demoname</tt><br/><tt># export QWS_MOUSE_PROTO=Auto:/dev/input/mice</tt><br/><tt># ./demoname -qws</tt>
|-
|<code>''/QWS_MOUSE_PROTO=Auto:/dev/input/mice demoname -qws''</code>
|}
|}


:'''Remark:''' Just remember that you need to run the Qt demos with the options -qws. Omitting -qws results in the app waiting to connect to the QWS Server, which is not running.
'''Remark:''' Just remember that you need to run the Qt demos with the options -qws. Omitting -qws results in the app waiting to connect to the QWS Server, which is not running.
 
== 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.


== Kernel Userspace Interfaces to Access Hardware ==  
== Kernel Userspace Interfaces to Access Hardware ==  
Line 185: Line 185:
=== Serial (UART) Interfaces ===
=== Serial (UART) Interfaces ===
:{| class="wikitable" style="width: 400px"
:{| class="wikitable" style="width: 400px"
  ||DHCOM (FF) UART 1||<code>/dev/ttyO0</code>
  | style="width: 50%;"| DHCOM (FF) UART 1||<code>/dev/ttyO0</code>
  |-
  |-
  ||DHCOM (BT) UART 2 ||<code>/dev/ttyO2</code>
  ||DHCOM (BT) UART 2 ||<code>/dev/ttyO2</code>
Line 194: Line 194:
=== I2C Interfaces ===
=== I2C Interfaces ===
:{| class="wikitable" style="width: 400px"
:{| class="wikitable" style="width: 400px"
  ||DHCOM I2C 1||<code>/dev/i2c-3</code>
  | style="width: 50%;"| DHCOM I2C 1||<code>/dev/i2c-3</code>
  |-
  |-
  ||DHCOM I2C 2 ||<code>/dev/i2c-2</code>
  ||DHCOM I2C 2 ||<code>/dev/i2c-2</code>
Line 203: Line 203:
=== SPI Interfaces ===
=== SPI Interfaces ===
:{| class="wikitable" style="width: 400px"
:{| class="wikitable" style="width: 400px"
  ||DHCOM SPI 1||<code>/dev/spidev1.0</code>
  | style="width: 50%;"| DHCOM SPI 1||<code>/dev/spidev1.0</code>
  |-
  |-
  ||DHCOM SPI 2 ||<code>/dev/spidev2.0</code>
  ||DHCOM SPI 2 ||<code>/dev/spidev2.0</code>
Line 305: Line 305:
:* [[media:can-utils_armel.zip|Debian package containing can-utils (ARM)]]
:* [[media:can-utils_armel.zip|Debian package containing can-utils (ARM)]]


==[[Linux Kernel Features | Linux Kernel Features ]]==
=== Testing display / framebuffer ===
:In most common cases the "Display Bits" should be "8"
:With "fb" you select the number of the framebuffer device (e.g. /dev/fb0)
:{| class="wikitable" style="width: 1200px"
||<code>fb_1Colorfill</code>||Fills the framebuffer device with a given RGB color<br><code>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 the framebuffer device data into a 24Bit BMP-File<br><code>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>fb_LoadBMP [fb (0..31)] [24-Bit BMP-File] [Display Bits (1..8)] [Transparency (0..100)]</code>
|}
 
:Get DH farmebuffer tools:
:* [[media:dh_framebuffer_tools.zip|DH framebuffer tools version 1.0 (ARM)]]


==[[ELBE Overview| Embedded Linux Build Environment (ELBE)]]==
== Additional Information ==
*[[Linux Kernel Features | Linux Kernel Features ]]
*[[ELBE Overview| Embedded Linux Build Environment (ELBE)]]

Latest revision as of 12:16, 7 October 2016

Linux virtual machine for development

Building your own Kernel

Sources for the AM35x Linux Kernel v3.2.12 / v3.2.81

How to build a kernel

Get sources from Github and build the linux kernel using 5 threads and a build directory

1. Start a terminal on Linux
2. # git clone https://github.com/dh-electronics/linux-am35x.git
3. # mkdir build
4. # cd linux-am35x
5. # git checkout BRANCH
(BRANCH=dev/3.2.12_dhcom or BRANCH=dev/3.2.81_dhcom)
6. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make O=../build/ dhcm3517_defconfig
7. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make -j5 O=../build/ uImage
  • Your new uImage file is available in ../build/arch/arm/boot

Remark:

  • On linux-am35x.git we use the git branch "master".

Sources older than April 2014

Sources for the AM35 Kernel based on 3.2.12 Mainline

  • latest changes: 2013-12-05 -> 2014-04-23
- Add DH touch support
- Add Boardfile to use LCD-Interface with GPIO-functionality (DHpicoITX)
  • latest changes: 2013-06-17 -> 2013-12-05
- USB-OTG: Fixed mass storage operation (depends on latest kernel configuration, too)
- BUG-Fix: Set rtc default values to a valid status
  • latest changes: 2013-05-22 -> 2013-06-17
- (Minor) Customizations for 1 GByte Spansion NAND-Flash
  • latest changes: 2013-04-04 -> 2013-05-22
- (Minor) BUG-Fix: Initialization of DHCOM GPIO_E pad fixed
  • latest changes: 2012-12-14 -> 2013-04-04
- SPI BUG-Fix: Disabled "Turbo-Mode" to avoid wrong additional byte-reads (If used: Kernel-Update recommended)
- I2C BUG-Fix: AM35x Errata 1.1.26 (If used: Kernel-Update recommended)
- enabled ETH_VIO_GPIO (necessary for DHCOM pico-ITX) to supply ethernet transformer
- FF UART support added
- DHCOM (CAM) GPIO Padconfigurations changed to GPIO-Mode on default.
- removed USB-OTG-POWER-GPIO (Use kernel-argument [u-boot env bootargs] 'dheva01_version=200' to activate it again)
- backlight PWM default is now 205 (80%)
  • 2012-11-08 -> 2012-12-14
- /dev/spidev1.1 is now /dev/spidev1.0
- watchdog driver support for magic close added
  • 2012-08-29 -> 2012-11-08
- added audio support
- changed partitionsize of linux-kernel

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-3.2.12.tar.bz2
5. # cd work_path/linux-3.2.12
6. # patch -p1 < ../dh-linux-am35x_xxxxxxxx.patch
7. # cp ../dh-linux-am35x_xxxxxxxx.config .config'
8. # ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make uImage
  • Your new uImage file is available in work_path/linux-3.2.12/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/DEL on a RS232 terminal (during startup)
4. update linux

Debian Rootfilesystem

Available Rootfilesystems

Please have a look at the AM35x Downloads section.

External Documentation

Login

Debian GNU/Linux 6.0 dhcom ttyO0

dhcom login: root
Password: foo

Shutdown

# shutdown -h now

Calibrating the touchscreen

# ts_calibrate
  • Check the enviroment variable "TSLIB_TSDEVICE=/dev/input/event0" with printenv if an error occurs.

Running Qt Demos

# cd /usr/qt/demos/demoname
# ./demoname -qws
  • For the Qt-Browser change demoname to browser
  • If the touchscreen does not work please check the enviroment variable "QWS_MOUSE_PROTO=Tslib:/dev/input/event0" with printenv.

Run Qt demos with powerVR (3d acceleration) support

# cd /usr/qt/demos/embedded/demoname
# ./demoname -qws

Run Qt demos with usb mouse input device

# cd /usr/qt/demos/demoname
# export QWS_MOUSE_PROTO=Auto:/dev/input/mice
# ./demoname -qws

Remark: Just remember that you need to run the Qt demos with the options -qws. Omitting -qws results in the app waiting to connect to the QWS Server, which is not running.

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.

Kernel Userspace Interfaces to Access Hardware

Serial (UART) Interfaces

DHCOM (FF) UART 1 /dev/ttyO0
DHCOM (BT) UART 2 /dev/ttyO2
DHCOM (STD) UART 3 /dev/ttyO1

I2C Interfaces

DHCOM I2C 1 /dev/i2c-3
DHCOM I2C 2 /dev/i2c-2
On Module Devices /dev/i2c-1

SPI Interfaces

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

Control the display brightness

echo <value> >/sys/class/backlight/omap-pwm-backlight/brightness
value range: 0..255

Control GPIOs

DHCOM Name: alt. DHCOM Name: SO-DIMM Pin# Linux <GPIO#>
GPIO A 154 116
GPIO B 156 117
GPIO C 162 118
GPIO D 163 119
GPIO E 164 125
GPIO F 165 140
GPIO G 167 141
GPIO H 173 155
GPIO I 175 152
CIF HSYNC GPIO J 74 96
CIF PCLK GPIO K 72 94
CIF MCLK GPIO L 70 58
CIF VSYNC GPIO M 68 97
CIF D9 GPIO N 66 98
CIF D8 GPIO O 64 95
CIF D7 GPIO P 62 106
CIF D6 GPIO Q 60 105
CIF D5 GPIO R 58 104
CIF D4 GPIO S 56 103
CIF D3 GPIO T 54 102
CIF D2 GPIO U 52 101
CIF D1 GPIO V 50 100
CIF D0 GPIO W 48 99
Remark: Depending on your board configuration some of the additional gpios shared with the camera interface are not available on your system.
Export
echo <GPIO#> >/sys/class/gpio/export
Remark: Have a look into /sys/class/gpio/ for already configured gpios.
Set direction
echo in >/sys/class/gpio/gpio<GPIO#>/direction
echo out >/sys/class/gpio/gpio<GPIO#>/direction
Set state
echo 0 >/sys/class/gpio/gpio<GPIO#>/value
echo 1 >/sys/class/gpio/gpio<GPIO#>/value

Initialize and Test CAN Interface

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 can messages (part of can-utils):
candump can0
Get can-utils:

Testing display / framebuffer

In most common cases the "Display Bits" should be "8"
With "fb" you select the number of the framebuffer device (e.g. /dev/fb0)
fb_1Colorfill Fills the framebuffer device with a given RGB color
fb_1Colorfill [fb (0..31)] [Display Bits (1..8)] [Red value (0..255)] [Green value (0..255)] [Blue value (0..255)]
fb_fb2BMP Copies the framebuffer device data into a 24Bit BMP-File
fb_fb2BMP [fb (0..31)] [24-Bit BMP-File]
fb_LoadBMP Loads a 24Bit BMP-file into a 32Bit framebuffer device
fb_LoadBMP [fb (0..31)] [24-Bit BMP-File] [Display Bits (1..8)] [Transparency (0..100)]
Get DH farmebuffer tools:

Additional Information