Template:DebianVM Development: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Lzenz (talk | contribs)
Christoph (talk | contribs)
 
(37 intermediate revisions by 4 users not shown)
Line 2: Line 2:
For cross developing of applications we provide virtual machines with preinstalled toolchains. Choose the virtual machine which fits to your DHCOM target (Debian 8 on target -> Debian 8 virtual machine). Debian 8 does include support for architecture armhf and armel (Debian 6 only armel). '''By default Debian 8 is configured for armhf.'''
For cross developing of applications we provide virtual machines with preinstalled toolchains. Choose the virtual machine which fits to your DHCOM target (Debian 8 on target -> Debian 8 virtual machine). Debian 8 does include support for architecture armhf and armel (Debian 6 only armel). '''By default Debian 8 is configured for armhf.'''
The sections '''Code Examples for Userspace-Applications to Access SPI, I2C, GPIOs, and more''' and  '''Booting via NFS''' apply for Debian 6 and Debian 8.
The sections '''Code Examples for Userspace-Applications to Access SPI, I2C, GPIOs, and more''' and  '''Booting via NFS''' apply for Debian 6 and Debian 8.
== Debian 8 "Jessie" VMware Image ==
== Debian 9 "Stretch" VM image (for VMware and VirtualBox) ==
=== Get the virtual machine ===
=== Get the virtual machine ===
* [https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0 Get the VMware player]
* Get [https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0 VMware player] or [https://www.virtualbox.org/wiki/Downloads VirtualBox]
  <!-- Old Link: http://www.vmware.com/go/get-player-de -->
* [https://www.dropbox.com/s/b2phwy0m0qqs2gy/RND%20Debian%20Stretch%20v2.1.Vx.zip?raw=1 Debian 9 "Stretch" VMware Image] <br/>Default password for devel user: '''devel'''<br/>Default password for root user: '''root'''
: <font color="#FF1010">Remark: For security reasons, you must set your own password when starting the virtual machine for the first time:</font>
::# Enter default user devel password (devel)
::# Enter default user devel password again (devel)
::# Enter your own user devel password
::# Enter your own user devel password again
 
{|class="wikitable" style="padding:5px;"
|-
! Version: !! File: !! Changes:
|- style="text-align: left" valign="top"
| v2.1.Vx || style="text-align: left;width: 13em" | Debian Stretch v2.1.Vx.zip || style="text-align: left;width: 40em" | - Add Docker<br/>- Python updated to version 3.6.9<br/> - Add ARMv7 Cross-Compiler gcc v10.2<br/> - Enable Copy & Paste and Drag & Drop for files
|-
| v2.0.Vx || style="text-align: left;width: 13em" | Debian Stretch v2.0.Vx.zip || style="text-align: left;width: 40em" | - First release version of Debian 9 VM
|}
 
=== Installed Toolchains ===
:* '''Used for building the Linux Kernel for our ARMv7 DHCOM devices.'''
::* '''ARM GCC 10.2 (available since v2.1.Vx)'''
:::: armhf: <tt>CROSS_COMPILE=/opt/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-</tt>
 
::* '''ARM GCC 8.3'''
:::: armhf: <tt>CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</tt>
 
::* '''Linaro GCC 7.4'''
:::: armhf: <tt>CROSS_COMPILE=/opt/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</tt>
 
::* '''Linaro GCC 6.3'''
:::: armhf: <tt>CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</tt>
 
::* '''Linaro GCC 4.9'''
:::: armhf: <tt>CROSS_COMPILE=/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</tt>
 
:* '''Used for building the Linux Kernel for our ARMv5 DHCOM devices.'''
::* '''CodeSourcery GCC 4.5'''
:::: armel: <tt>CROSS_COMPILE=/opt/CodeSourcery-2011.03-41/bin/arm-none-linux-gnueabi-</tt>
=== Yocto Builds ===
'''Note (only concerning v2.0.Vx):''' If you are going to set up any DH electronics Yocto project by using the repo tool, you need to install Python version 3.6 or later.
 
This versions are not provided by official Debian Stretch package repositories.
To manually install Python 3.6.9 , please follow the instructions:
$: sudo apt install libsqlite3-dev
$: wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
$: tar xvf Python-3.6.9.tgz
$: cd Python-3.6.9
$: ./configure --enable-optimizations --enable-shared
$: make -j8
$: sudo make install
$: sudo /sbin/ldconfig -v
 
== Debian 8 "Jessie" VM image (for VMware) ==
=== Get the virtual machine ===
* [https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0 Get the VMware player]
   <!-- Old Link: http://www.vmware.com/go/get-player-de -->
   <!-- Old Link: http://www.vmware.com/go/get-player-de -->
* [https://www.dropbox.com/s/dj36ghi4w53idgm/Debian%20Jessie%20v1.2.zip?dl=0 Debian 8 "Jessie" VMware Image] <br/>Password for devel user: '''devel'''<br/>Password for root user: '''root'''
* [https://www.dropbox.com/s/e00hws89p79epze/Debian%20Jessie%20v1.3.zip?raw=1 Debian 8 "Jessie" VMware Image] <br/><font color="#FF1010">'''Important info (Feb/2018):''' Don't update the system, because it will brake the cross compiler. If you are asked to upgrade, say NO!</font><br/>Password for devel user: '''devel'''<br/>Password for root user: '''root'''


{|class="wikitable" style="padding:5px;"
{|class="wikitable" style="padding:5px;"
Line 12: Line 66:
! Version: !! File: !! Changes:  
! Version: !! File: !! Changes:  
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.3 || style="text-align: left;width: 13em" | Debian Jessie v1.3.zip || style="text-align: left;width: 40em" | - Debian Security updates<br/>- Compatibility VMware player 5.0<br/>- Ready for yocto build<br/>- Build environment for DHCOM i.MX6 Qt5.7.1 / Qt5.9.1<br/>- Add some useful tools
|-
| v1.2 || style="text-align: left;width: 13em" | Debian Jessie v1.2.zip || style="text-align: left;width: 40em" | - Debian Security updates<br/>- Qt Creator + Support for imx6 modules + Demos<br/>- Update elbe to v1.0<br/>- Add some tools / editors
| v1.2 || style="text-align: left;width: 13em" | Debian Jessie v1.2.zip || style="text-align: left;width: 40em" | - Debian Security updates<br/>- Qt Creator + Support for imx6 modules + Demos<br/>- Update elbe to v1.0<br/>- Add some tools / editors
|-  
|-  
Line 20: Line 76:


=== Installed Toolchains ===
=== Installed Toolchains ===
==== Debian Multiarch Cross Toolchain ====
:* '''Used for building the Linux Kernel for our ARMv7 DHCOM devices.'''
Both armhf and armel Cross Toolchains are preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
::* '''Debian Multiarch Cross Toolchain GCC 4.9'''
* armhf: '''arm-linux-gnueabihf- '''
:::: armhf: <tt>CROSS_COMPILE=arm-linux-gnueabihf-</tt>
* armel: '''arm-linux-gnueabi- '''
:::: The Cross Toolchains is preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
Install directory is <tt>/usr/bin/</tt>. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.
:::: Install directory is <tt>/usr/bin/</tt>. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.


==== Linaro GCC 4.9 armhf ====
::* '''Linaro GCC 4.9'''
Used for building the Linux Kernel for our ARMv7 DHCOM devices.
:::: armhf: <tt>CROSS_COMPILE=/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-</tt>
* armhf: '''arm-linux-gnueabihf- '''  
Install directory is <tt>/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/</tt>. Please refere the section "Linux Kernel" for the matching DHCOM device.


==== CodeSourcery GCC 4.5 armel ====
:* '''Used for building the Linux Kernel for our ARMv5 DHCOM devices.'''
Used for building the Linux Kernel for our ARMv5 DHCOM devices.
::* '''Debian Multiarch Cross Toolchain'''
* armel: '''arm-none-linux-gnueabi- '''  
:::: armel: <tt>CROSS_COMPILE=arm-linux-gnueabi-</tt>
Install directory is <tt>/opt/CodeSourcery-2011.03-41/bin/</tt>. Please refere the section "Linux Kernel" for the matching DHCOM device.
:::: The Cross Toolchains is preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
:::: Install directory is <tt>/usr/bin/</tt>. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.
 
::* '''CodeSourcery GCC 4.5'''
:::: armel: <tt>CROSS_COMPILE=/opt/CodeSourcery-2011.03-41/bin/arm-none-linux-gnueabi-</tt>


=== Qt5 Development ===
=== Qt5 Development ===
Line 42: Line 100:


==== Qt5.7.1 ====
==== Qt5.7.1 ====
We support the latest Qt5.7.1 on our DHCOM i.MX6 and DHCOM am335x. Please download and install the [https://www.dropbox.com/s/vvig7361xhdugdk/qmake-sysroot-mx6-crossarmhf_5.7.1-1.0_amd64.deb?dl=0 '''qmake-sysroot-mx6-crossarmhf_5.7.1-1.0'''] or [https://www.dropbox.com/s/kd5sz2bb5d8vbek/qmake-sysroot-am33-crossarmhf_5.7.1-1.0_amd64.deb?dl=0 '''qmake-sysroot-am33-crossarmhf_5.7.1-1.0'''] package to the DebianVM:
We support the latest Qt5.7.1 on our DHCOM i.MX6 and DHCOM am335x. Please download and install the [https://www.dropbox.com/s/vvig7361xhdugdk/qmake-sysroot-mx6-crossarmhf_5.7.1-1.0_amd64.deb?raw=1 '''qmake-sysroot-mx6-crossarmhf_5.7.1-1.0'''] or [https://www.dropbox.com/s/kd5sz2bb5d8vbek/qmake-sysroot-am33-crossarmhf_5.7.1-1.0_amd64.deb?raw=1 '''qmake-sysroot-am33-crossarmhf_5.7.1-1.0'''] package to the DebianVM:
# open a terminal
# open a terminal
# # for i.MX6: <tt>wget https://dl.dropboxusercontent.com/u/19433555/DHCOM/imx6/qmake-sysroot-mx6-crossarmhf_5.7.1-1.0_amd64.deb</tt>
# # for i.MX6: <tt>wget https://dl.dropboxusercontent.com/u/19433555/DHCOM/imx6/qmake-sysroot-mx6-crossarmhf_5.7.1-1.0_amd64.deb</tt>
Line 61: Line 119:
# There you can find the configurations for your own project.
# There you can find the configurations for your own project.


=== Booting via TFTP/NFS ===
== Debian 6 "Squeeze" VM image (for VMware) ==
==== Prepare the virtual machine ====
# '''Setup nfs-kernel-server'''
#* Install thf nfs server: <code> sudo apt-get install nfs-kernel-server </code>
#* Create a nfsservice directory: <code> mkdir /work/nfsroot </code>
#* Place the root file system in the folder <code>cd /work/nfsroot; sudo tar xf jessie....tar.gz </code>
#* Remove network config from rootfs <code> rm /work/nfsroot/etc/systemd/network/wired-dhcp.network</code>
#* Check whether the line below is part of the "<code>'''/etc/exports'''</code>" file
#*: <code>'''/tftpboot/nfsroot X.X.X.0/255.255.255.0(rw,no_root_squash,no_subtree_check,insecure)'''</code>
#*: The <code>'''X'''</code> must be substituted by our network settings
#* Restart the nfs-server by using this commando
#*<code>''/etc/init.d/nfs-kernel-server restart''</code>
# '''Setup tftp-hpa server'''
#* Install a tftp server : <code> sudo apt-get install tftpd-hpa </code>
#* Create a tftp service directory: <code> mkdir /work/tftp </code>
#* Edit config: <code> sudo vi /etc/default/tftpd-hpa </code>
#** Take care that TFTP_DIRECTORY points to your tftp service directory, for example '/work/tftp'
#* Copy Kernel and DeviceTree into the tftp service directory
 
==== Setup the DHCOM Module for TFTP/NFS Boot ====
This example works with static IP addresses and is tested with DHCOM i.MX6 U-Boot 2015.10 and Kernle 4.4.38. It is possible to work with DHCP, too.
* Enter U-Boot console by pressing '''DEL/BACKSPACE''' on a RS232 terminal while switching on the power supply of the target
* Set IP addresses
{| class="wikitable"
|<tt># env set serverip 192.168.178.90</tt><br/><tt># env set ipaddr 192.168.178.91</tt>
|}
* bootargs for nfs root
{| class="wikitable"
|<tt># env set rootfs 'root=/dev/nfs nfsroot=192.168.178.90:/work/net/nfsroot/ ip=192.168.178.91:192.168.178.90::255.255.255.0:dhcom:eth0:none'</tt>
|}
* load Linux kernel and devicetree with tftp (change filename and path to match you setup)
{| class="wikitable"
|<tt># tftp ${loadaddr} zImage</tt><br/><tt># tftp ${fdt_addr} dtbs/imx6dl-dhcom3B-pdk2.dtb</tt>
|}
* set bootargs and boot
{| class="wikitable"
|<tt># run linuxargs</tt><br/><tt># bootz ${loadaddr} - ${fdt_addr}'</tt>
|}
* optional: '''save it to be permanent'''
{| class="wikitable"
|<tt># env set bootcmd 'tftp ${loadaddr} zImage; tftp ${fdt_addr} dtbs/imx6dl-dhcom3B-pdk2.dtb; run linuxargs; bootz ${loadaddr} - ${fdt_addr}'</tt><br/><tt># env save</tt>
|}
 
== Debian 6 "Squeeze" VMware Image ==
=== Get the virtual machine ===
=== Get the virtual machine ===
* [https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0 Get the VMware player]
* [https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/6_0 Get the VMware player]
   <!-- Old Link: http://www.vmware.com/go/get-player-de -->
   <!-- Old Link: http://www.vmware.com/go/get-player-de -->
* [https://www.dropbox.com/s/b9424pfoiik21dd/Debian%20Squeeze%20v1.5pw.zip?dl=0 Debian Squeeze VMware Image (PW: dhelectronics)] <br/>Password for devel user: '''devel'''<br/>Password for root user: '''root'''
* [https://www.dropbox.com/s/b9424pfoiik21dd/Debian%20Squeeze%20v1.5pw.zip?raw=1 Debian Squeeze VMware Image (PW: dhelectronics)] <br/>Password for devel user: '''devel'''<br/>Password for root user: '''root'''


{|class="wikitable" style="padding:5px;"
{|class="wikitable" style="padding:5px;"
Line 114: Line 129:
! Version: !! File: !! Changes:  
! Version: !! File: !! Changes:  
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.5 || style="text-align: left;width: 13em" | Debian Squeeze v1.5pw.zip || style="text-align: left;width: 40em" | - Update VMware Tools<br\>- DH UBI-Tools<br\>- Language: English<br\>- System updates
| v1.5 || style="text-align: left;width: 13em" | Debian Squeeze v1.5pw.zip || style="text-align: left;width: 40em" | - Update VMware Tools<br/>- DH UBI-Tools<br/>- Language: English<br/>- System updates
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.4 || Debian Squeeze v1.4pw.zip || style="text-align: left" | - ELBE v0.3.1<br\>- ELDK 4.2<br\>- Qt Creator 2.6.1 + Qt target libs 4.7.2<br\>- System updates
| v1.4 || Debian Squeeze v1.4pw.zip || style="text-align: left" | - ELBE v0.3.1<br/>- ELDK 4.2<br/>- Qt Creator 2.6.1 + Qt target libs 4.7.2<br/>- System updates
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.3 || Debian Squeeze v1.3.zipx || style="text-align: left" | - Mono 2.10<br\>- mtd-utils<br\>- System updates
| v1.3 || Debian Squeeze v1.3.zipx || style="text-align: left" | - Mono 2.10<br/>- mtd-utils<br/>- System updates
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.2 || Debian Squeeze v1.2.zipx || style="text-align: left" | - Emdebian Toolchain gcc 4.3 / g++ 4.3 (<code>arm-linux-gnueabi-...</code>)<br\>- TortoiseHg + TortoiseHg for Nautilus<br\>- Add Plugin "REST Client" in Iceweasel
| v1.2 || Debian Squeeze v1.2.zipx || style="text-align: left" | - Emdebian Toolchain gcc 4.3 / g++ 4.3 (<code>arm-linux-gnueabi-...</code>)<br/>- TortoiseHg + TortoiseHg for Nautilus<br/>- Add Plugin "REST Client" in Iceweasel
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.1 || Debian Squeeze v1.1.zipx || style="text-align: left" | - Update Eclipse Indigo with CDT 8.0<br\>- Add demo project "crosshelloworld"
| v1.1 || Debian Squeeze v1.1.zipx || style="text-align: left" | - Update Eclipse Indigo with CDT 8.0<br/>- Add demo project "crosshelloworld"
|- style="text-align: left" valign="top"
|- style="text-align: left" valign="top"
| v1.0 || Debian Squeeze.zipx || style="text-align: left" | - First Release<br\>- CodeSourcery Toolchain (<code>arm-none-linux-gnueabi-...</code>)<br\>- Eclipse Helios & Indigo
| v1.0 || Debian Squeeze.zipx || style="text-align: left" | - First Release<br/>- CodeSourcery Toolchain (<code>arm-none-linux-gnueabi-...</code>)<br/>- Eclipse Helios & Indigo
|}
|}
=== Installed Toolchains ===
:* '''Used for building the Linux Kernel for our ARMv5 DHCOM devices.'''
::* '''Debian Multiarch Cross Toolchain GCC 4.3'''
:::: armel: <tt>CROSS_COMPILE=arm-linux-gnueabi-</tt>
:::: The Cross Toolchains is preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
:::: Install directory is <tt>/usr/bin/</tt>. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.
::* '''CodeSourcery GCC 4.5'''
:::: armel: <tt>CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-</tt>


=== Setting up a Eclipse Cross Executable Project: ===
=== Setting up a Eclipse Cross Executable Project: ===
Line 138: Line 163:
::Prefix type "<code>'''arm-linux-gnueabi-'''</code>"
::Prefix type "<code>'''arm-linux-gnueabi-'''</code>"


== Code Examples for Userspace-Applications to Access SPI, I2C, GPIOs, and more ==
== Use Virtualbox instead of VMware Player/Workstation ==
* The following code samples are designed to get you started quickly with the device interfaces to SPI, I2C, GPIOs and more in Linux userspace applications.
* Within Eclipse you can Import the provided projects:
:# Execute '''">File>Import ..."'''
:# Navigate to '''">General>Existing Projects into Workspace"''' within the import dialog
:# Follow the dialog until you have finished.
 
[[media:Demos_SPI_I2C_GPIO.zip|Download Code Examples SPI, I2C, GPIOs and more ]]
 
Included Demos:
* SPI
* I2C
* GPIO
* RTC
* UART
* Watchdog
* ADC (only for i.MX25)
 
[[media:DHCOM_HAL.zip|Download C++ HAL class library for SPI, I2C, GPIO, UART and physical address space access]]


* For further documentation have a look at [http://www.kernel.org/doc/Documentation/ http://www.kernel.org/doc/Documentation/].
[[media:DOC_VMware_Machine_mit_VirtualBox_starten_V1.0_2015-10-21.pdf| VMware Maschine mit VirtualBox starten (German)]]


== Booting via TFTP/NFS ==
== Booting via TFTP/NFS ==
=== Prepare the virtual machine ===
=== Prepare the virtual machine ===
* Place the root file system in the folder "<code>'''/work/nfsroot'''</code>"
# '''Setup nfs-kernel-server'''
* Check whether the line below is part of the "<code>'''/etc/exports'''</code>" file
#* Install thf nfs server: <code>$ sudo apt-get install nfs-kernel-server </code>
: <code>'''/tftpboot/nfsroot X.X.X.0/255.255.255.0(rw,no_root_squash,no_subtree_check,insecure)'''</code>
#* Create a nfsservice directory: <code>$ mkdir /work/nfsroot </code>
: The <code>'''X'''</code> must be substituted by our network settings
#* Place the root file system in the folder <code>$ cd /work/nfsroot; sudo tar xf jessie....tar.gz </code>
* Restart the nfs-server by using this commando
#* Remove network config from rootfs <code>$ rm /work/nfsroot/etc/systemd/network/wired-dhcp.network</code>
:{| class="wikitable"
#* Check whether the line below is part of the <tt>'''/etc/exports'''</tt> file
|<code>''/etc/init.d/nfs-kernel-server restart''</code>
#* <code>/work/nfsroot X.X.X.0/255.255.255.0(rw,no_root_squash,no_subtree_check,insecure)</code>
|}
#** The <tt>'''X'''</tt> must be substituted by our network settings
#* Restart the nfs-server with <code>4 /etc/init.d/nfs-kernel-server restart</code>
# '''Setup tftp-hpa server'''
#* Install a tftp server : <code>$ sudo apt-get install tftpd-hpa </code>
#* Create a tftp service directory: <code>$ mkdir /work/tftp </code>
#* Edit config: <code>$ sudo vi /etc/default/tftpd-hpa </code>
#** Take care that TFTP_DIRECTORY points to your tftp service directory, for example '/work/tftp'
#* Copy Kernel and DeviceTree into the tftp service directory
#* Restart the tftp-server with <code>$ /etc/init.d/tftp-hpa restart</code>
 
=== Setup the DHCOM Module for TFTP/NFS Boot ===
=== Setup the DHCOM Module for TFTP/NFS Boot ===
This example works with static IP addresses and is tested with DHCOM i.MX6 U-Boot 2015.10 and Kernle 4.4.38. It is possible to work with DHCP, too.  
This example works with static IP addresses and is tested with DHCOM i.MX6 U-Boot 2015.10 and Kernle 4.4.38. It is possible to work with DHCP, too. For further information see [https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt]
* Enter U-Boot console by pressing '''DEL/BACKSPACE''' on a RS232 terminal while switching on the power supply of the target
* Enter U-Boot console by pressing '''DEL/BACKSPACE''' on a RS232 terminal while switching on the power supply of the target
* Set IP addresses
* Set IP addresses
Line 177: Line 193:
|<tt># env set serverip 192.168.178.90</tt><br/><tt># env set ipaddr 192.168.178.91</tt>
|<tt># env set serverip 192.168.178.90</tt><br/><tt># env set ipaddr 192.168.178.91</tt>
|}
|}
* bootargs for nfs root
* bootargs for nfs root (up to Debian Jessie)
{| class="wikitable"
|<tt># env set rootfs 'root=/dev/nfs nfsroot=192.168.178.90:/work/nfsroot/ ip=192.168.178.91:192.168.178.90::255.255.255.0:dhcom:eth0:none'</tt>
|}
* bootargs for nfs root (since Debian Stretch)
{| class="wikitable"
{| class="wikitable"
|<tt># env set rootfs 'root=/dev/nfs nfsroot=192.168.178.90:/work/net/nfsroot/ ip=192.168.178.91:192.168.178.90::255.255.255.0:dhcom:eth0:none'</tt>
|<tt># env set rootfs 'root=/dev/nfs nfsroot=192.168.178.90:/work/nfsroot/,nfsvers=3 ip=192.168.178.91:192.168.178.90::255.255.255.0:dhcom:eth0:none'</tt>
|}
|}
* load Linux kernel and devicetree with tftp (change filename and path to match you setup)
* load Linux kernel and devicetree with tftp (change filename and path to match you setup)
Line 187: Line 207:
* set bootargs and boot
* set bootargs and boot
{| class="wikitable"
{| class="wikitable"
|<tt># run linuxargs</tt><br/><tt># bootz ${loadaddr} - ${fdt_addr}'</tt>
|<tt># run linuxargs</tt><br/><tt># bootz ${loadaddr} - ${fdt_addr}</tt>
|}
|}
* optional: '''save it to be permanent'''
* optional: '''save it to be permanent'''
{| class="wikitable"
{| class="wikitable"
|<tt># env set bootcmd 'tftp ${loadaddr} zImage; tftp ${fdt_addr} dtbs/imx6dl-dhcom3B-pdk2.dtb; run linuxargs; bootz ${loadaddr} - ${fdt_addr}'</tt><br/><tt># env save</tt>
|<tt># env set bootcmd 'tftp ${loadaddr} zImage; tftp ${fdt_addr} dtbs/imx6dl-dhcom3B-pdk2.dtb; run linuxargs; bootz ${loadaddr} - ${fdt_addr}</tt><br/><tt># env save</tt>
|}
|}
== Code Examples for Userspace-Applications to Access SPI, I2C, GPIOs, and more ==
* The following code samples are designed to get you started quickly with the device interfaces to SPI, I2C, GPIOs and more in Linux userspace applications.
* Within Eclipse you can Import the provided projects:
:# Execute '''">File>Import ..."'''
:# Navigate to '''">General>Existing Projects into Workspace"''' within the import dialog
:# Follow the dialog until you have finished.
[[media:Demos_SPI_I2C_GPIO.zip|Download Code Examples SPI, I2C, GPIOs and more ]]
Included Demos:
* SPI
* I2C
* GPIO
* RTC
* UART
* Watchdog
* ADC (only for i.MX25)
[[media:DHCOM_HAL.zip|Download C++ HAL class library for SPI, I2C, GPIO, UART and physical address space access]]
* For further documentation have a look at [http://www.kernel.org/doc/Documentation/ http://www.kernel.org/doc/Documentation/].

Latest revision as of 09:34, 12 August 2021

Introduction

For cross developing of applications we provide virtual machines with preinstalled toolchains. Choose the virtual machine which fits to your DHCOM target (Debian 8 on target -> Debian 8 virtual machine). Debian 8 does include support for architecture armhf and armel (Debian 6 only armel). By default Debian 8 is configured for armhf. The sections Code Examples for Userspace-Applications to Access SPI, I2C, GPIOs, and more and Booting via NFS apply for Debian 6 and Debian 8.

Debian 9 "Stretch" VM image (for VMware and VirtualBox)

Get the virtual machine

Remark: For security reasons, you must set your own password when starting the virtual machine for the first time:
  1. Enter default user devel password (devel)
  2. Enter default user devel password again (devel)
  3. Enter your own user devel password
  4. Enter your own user devel password again
Version: File: Changes:
v2.1.Vx Debian Stretch v2.1.Vx.zip - Add Docker
- Python updated to version 3.6.9
- Add ARMv7 Cross-Compiler gcc v10.2
- Enable Copy & Paste and Drag & Drop for files
v2.0.Vx Debian Stretch v2.0.Vx.zip - First release version of Debian 9 VM

Installed Toolchains

  • Used for building the Linux Kernel for our ARMv7 DHCOM devices.
  • ARM GCC 10.2 (available since v2.1.Vx)
armhf: CROSS_COMPILE=/opt/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
  • ARM GCC 8.3
armhf: CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
  • Linaro GCC 7.4
armhf: CROSS_COMPILE=/opt/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
  • Linaro GCC 6.3
armhf: CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
  • Linaro GCC 4.9
armhf: CROSS_COMPILE=/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
  • Used for building the Linux Kernel for our ARMv5 DHCOM devices.
  • CodeSourcery GCC 4.5
armel: CROSS_COMPILE=/opt/CodeSourcery-2011.03-41/bin/arm-none-linux-gnueabi-

Yocto Builds

Note (only concerning v2.0.Vx): If you are going to set up any DH electronics Yocto project by using the repo tool, you need to install Python version 3.6 or later.

This versions are not provided by official Debian Stretch package repositories. To manually install Python 3.6.9 , please follow the instructions:

$: sudo apt install libsqlite3-dev
$: wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
$: tar xvf Python-3.6.9.tgz
$: cd Python-3.6.9
$: ./configure --enable-optimizations --enable-shared
$: make -j8
$: sudo make install
$: sudo /sbin/ldconfig -v

Debian 8 "Jessie" VM image (for VMware)

Get the virtual machine

Version: File: Changes:
v1.3 Debian Jessie v1.3.zip - Debian Security updates
- Compatibility VMware player 5.0
- Ready for yocto build
- Build environment for DHCOM i.MX6 Qt5.7.1 / Qt5.9.1
- Add some useful tools
v1.2 Debian Jessie v1.2.zip - Debian Security updates
- Qt Creator + Support for imx6 modules + Demos
- Update elbe to v1.0
- Add some tools / editors
v1.1 Debian Jessie v1.1.zip - Compatibility VMware player 6.0
v1.0 Debian Jessie v1.0.zip - New Debian 8 VM

Installed Toolchains

  • Used for building the Linux Kernel for our ARMv7 DHCOM devices.
  • Debian Multiarch Cross Toolchain GCC 4.9
armhf: CROSS_COMPILE=arm-linux-gnueabihf-
The Cross Toolchains is preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
Install directory is /usr/bin/. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.
  • Linaro GCC 4.9
armhf: CROSS_COMPILE=/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
  • Used for building the Linux Kernel for our ARMv5 DHCOM devices.
  • Debian Multiarch Cross Toolchain
armel: CROSS_COMPILE=arm-linux-gnueabi-
The Cross Toolchains is preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
Install directory is /usr/bin/. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.
  • CodeSourcery GCC 4.5
armel: CROSS_COMPILE=/opt/CodeSourcery-2011.03-41/bin/arm-none-linux-gnueabi-

Qt5 Development

Qt5.5.1 prebuilt and preinstalled

We provide the prebuilt Qt5.5.1 libraries including WebEngine (only QtQuick) and WebKit in /work/qt5/sysroot/. This directory contains a Debian 8 based rootfilesystem which is prepared for DHCOM i.MX6, the matching sysroot (*-dev packages), and the Qt5.5.1 libraries installed.

Qt5.7.1

We support the latest Qt5.7.1 on our DHCOM i.MX6 and DHCOM am335x. Please download and install the qmake-sysroot-mx6-crossarmhf_5.7.1-1.0 or qmake-sysroot-am33-crossarmhf_5.7.1-1.0 package to the DebianVM:

  1. open a terminal
  2. # for i.MX6: wget https://dl.dropboxusercontent.com/u/19433555/DHCOM/imx6/qmake-sysroot-mx6-crossarmhf_5.7.1-1.0_amd64.deb
  3. # for AM335x: wget https://dl.dropboxusercontent.com/u/19433555/DHCOM/am335x/qmake-sysroot-am33-crossarmhf_5.7.1-1.0_amd64.deb
  4. install the package
  5. # sudo dpkg -i qmake-sysroot-mx6-crossarmhf_5.7.1-1.0_amd64.deb
  6. now the sysroot and qmake is ready to use
  7. path to qmake is /work/qt5_mx6_armhf/sysroot/usr/local/qt5.7.1/bin/qmake

Build a Qt5 Application via console

  1. open a terminal
  2. navigate to your Qt5 sources
  3. # /work/qt5/sysroot/usr/local/qt5.5.1/bin/qmake your_own_app.pro
  4. # make

Qt Creator

  1. Start Qt Creator IDE
  2. Open demo project TwoLED: /work/qt5_Demos/TwoLED
  3. There you can find the configurations for your own project.

Debian 6 "Squeeze" VM image (for VMware)

Get the virtual machine

Version: File: Changes:
v1.5 Debian Squeeze v1.5pw.zip - Update VMware Tools
- DH UBI-Tools
- Language: English
- System updates
v1.4 Debian Squeeze v1.4pw.zip - ELBE v0.3.1
- ELDK 4.2
- Qt Creator 2.6.1 + Qt target libs 4.7.2
- System updates
v1.3 Debian Squeeze v1.3.zipx - Mono 2.10
- mtd-utils
- System updates
v1.2 Debian Squeeze v1.2.zipx - Emdebian Toolchain gcc 4.3 / g++ 4.3 (arm-linux-gnueabi-...)
- TortoiseHg + TortoiseHg for Nautilus
- Add Plugin "REST Client" in Iceweasel
v1.1 Debian Squeeze v1.1.zipx - Update Eclipse Indigo with CDT 8.0
- Add demo project "crosshelloworld"
v1.0 Debian Squeeze.zipx - First Release
- CodeSourcery Toolchain (arm-none-linux-gnueabi-...)
- Eclipse Helios & Indigo

Installed Toolchains

  • Used for building the Linux Kernel for our ARMv5 DHCOM devices.
  • Debian Multiarch Cross Toolchain GCC 4.3
armel: CROSS_COMPILE=arm-linux-gnueabi-
The Cross Toolchains is preinstalled. They should be used for cross development of native Linux applications. They are downloaded and installed with the Debian Package Manager.
Install directory is /usr/bin/. Please have a look at the preconfigured Examples for cross development using the Eclipse IDE.
  • CodeSourcery GCC 4.5
armel: CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-

Setting up a Eclipse Cross Executable Project:

  • Use Eclipse Indigo (version 3.7.1) for your project.
  • Create a new C++ Project and choose as Executable Project type Cross-Compile Project and as Toolchains Cross GCC
  • Click the Button "Next" and specify under Tool command path the Toolchain path.
  • CodeSourcery:
Folder "/opt/CodeSourcery/Sourcery_G++_Lite/bin"
Prefix type "arm-none-linux-gnueabi-"
  • Emdebian Toolchain:
Folder "/usr/bin"
Prefix type "arm-linux-gnueabi-"

Use Virtualbox instead of VMware Player/Workstation

VMware Maschine mit VirtualBox starten (German)

Booting via TFTP/NFS

Prepare the virtual machine

  1. Setup nfs-kernel-server
    • Install thf nfs server: $ sudo apt-get install nfs-kernel-server
    • Create a nfsservice directory: $ mkdir /work/nfsroot
    • Place the root file system in the folder $ cd /work/nfsroot; sudo tar xf jessie....tar.gz
    • Remove network config from rootfs $ rm /work/nfsroot/etc/systemd/network/wired-dhcp.network
    • Check whether the line below is part of the /etc/exports file
    • /work/nfsroot X.X.X.0/255.255.255.0(rw,no_root_squash,no_subtree_check,insecure)
      • The X must be substituted by our network settings
    • Restart the nfs-server with 4 /etc/init.d/nfs-kernel-server restart
  2. Setup tftp-hpa server
    • Install a tftp server : $ sudo apt-get install tftpd-hpa
    • Create a tftp service directory: $ mkdir /work/tftp
    • Edit config: $ sudo vi /etc/default/tftpd-hpa
      • Take care that TFTP_DIRECTORY points to your tftp service directory, for example '/work/tftp'
    • Copy Kernel and DeviceTree into the tftp service directory
    • Restart the tftp-server with $ /etc/init.d/tftp-hpa restart

Setup the DHCOM Module for TFTP/NFS Boot

This example works with static IP addresses and is tested with DHCOM i.MX6 U-Boot 2015.10 and Kernle 4.4.38. It is possible to work with DHCP, too. For further information see https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt

  • Enter U-Boot console by pressing DEL/BACKSPACE on a RS232 terminal while switching on the power supply of the target
  • Set IP addresses
# env set serverip 192.168.178.90
# env set ipaddr 192.168.178.91
  • bootargs for nfs root (up to Debian Jessie)
# env set rootfs 'root=/dev/nfs nfsroot=192.168.178.90:/work/nfsroot/ ip=192.168.178.91:192.168.178.90::255.255.255.0:dhcom:eth0:none'
  • bootargs for nfs root (since Debian Stretch)
# env set rootfs 'root=/dev/nfs nfsroot=192.168.178.90:/work/nfsroot/,nfsvers=3 ip=192.168.178.91:192.168.178.90::255.255.255.0:dhcom:eth0:none'
  • load Linux kernel and devicetree with tftp (change filename and path to match you setup)
# tftp ${loadaddr} zImage
# tftp ${fdt_addr} dtbs/imx6dl-dhcom3B-pdk2.dtb
  • set bootargs and boot
# run linuxargs
# bootz ${loadaddr} - ${fdt_addr}
  • optional: save it to be permanent
# env set bootcmd 'tftp ${loadaddr} zImage; tftp ${fdt_addr} dtbs/imx6dl-dhcom3B-pdk2.dtb; run linuxargs; bootz ${loadaddr} - ${fdt_addr}
# env save

Code Examples for Userspace-Applications to Access SPI, I2C, GPIOs, and more

  • The following code samples are designed to get you started quickly with the device interfaces to SPI, I2C, GPIOs and more in Linux userspace applications.
  • Within Eclipse you can Import the provided projects:
  1. Execute ">File>Import ..."
  2. Navigate to ">General>Existing Projects into Workspace" within the import dialog
  3. Follow the dialog until you have finished.

Download Code Examples SPI, I2C, GPIOs and more

Included Demos:

  • SPI
  • I2C
  • GPIO
  • RTC
  • UART
  • Watchdog
  • ADC (only for i.MX25)

Download C++ HAL class library for SPI, I2C, GPIO, UART and physical address space access