Starter Guide: Hello World From the ARM Core¶
- Table of contents
- Starter Guide: Hello World From the ARM Core
This guide will step you through setting up your MityDSP-L138 Virtual Machine build environment and getting the ARM to run a Hello World program.
Install Virtual Box on your PC and Import Critical Link VM¶
- Download and install from: https://www.virtualbox.org/wiki/Downloads
- Get the Linux Virtual Machine image onto your PC (Contains developers tools, u-boot, and kernel source code)
- We recommend downloading the latest Virtual Machine image as documented on this wiki page (Linux Build VM)
- Directions on creating your own custom Linux VM is documented on this wiki page (Linux Build VM)
- If you were provided a MityDSP-L138 USB Flashdrive with your development kit you may copy the *.OVA file onto your PC
- Launch VirtualBox Manager (from Windows)
- Select File->Import Appliance to open up the wizard for importing a VirtualBox appliance
- Select Choose and then navigate the location on your PC with the *.OVA file
- Select Import - Note this operation may take 10 ~ 15 minutes
- Press "Start" in the VM Virtual Box Manager to run the virtual box
Get the ARM build environment up and running¶
Make sure the GCC Toolchain is installed¶
- Open a terminal by selecting "Applications - Accessories - Terminal"
- In the terminal run
mitydspl138@vm$ arm-angstrom-linux-gnueabi-gcc -v
- You should get a response similar to
Using built-in specs. Target: arm-angstrom-linux-gnueabi Configured with: /home/mikew/projects/mityomap/sw/ARM/linux/oe/build/tmp/work/i686-armv5te-sdk-angstrom-linux-gnueabi/gcc-cross-sdk-4.3.3-r11.2/gcc-4.3.3/configure --build=i686-linux --host=i686-linux --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/angstrom/arm --exec_prefix=/usr/local/angstrom/arm --bindir=/usr/local/angstrom/arm/bin --sbindir=/usr/local/angstrom/arm/bin --libexecdir=/usr/local/angstrom/arm/libexec --datadir=/usr/local/angstrom/arm/share --sysconfdir=/usr/local/angstrom/arm/etc --sharedstatedir=/usr/local/angstrom/arm/share/com --localstatedir=/usr/local/angstrom/arm/var --libdir=/usr/local/angstrom/arm/lib --includedir=/usr/local/angstrom/arm/include --oldincludedir=/usr/local/angstrom/arm/include --infodir=/usr/local/angstrom/arm/share/info --mandir=/usr/local/angstrom/arm/share/man --with-gnu-ld --enable-shared --enable-languages=c,c++,objc,fortran --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi- --enable-target-optspace --enable-cheaders=c_std --enable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap --with-float=soft --with-sysroot=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi --with-build-time-tools=/home/mikew/projects/mityomap/sw/ARM/linux/oe/build/tmp/cross/armv5te/arm-angstrom-linux-gnueabi/bin --with-build-sysroot=/home/mikew/projects/mityomap/sw/ARM/linux/oe/build/tmp/staging/armv5te-angstrom-linux-gnueabi --disable-libunwind-exceptions --disable-libssp --disable-libgomp --disable-libmudflap --with-mpfr=/home/mikew/projects/mityomap/sw/ARM/linux/oe/build/tmp/staging/i686-linux/usr --enable-__cxa_atexit Thread model: posix gcc version 4.3.3 (GCC)
- If you do not see the previous output, you may need to source the cross compile environment
For toolchains 4.5.4 (most recent)mitydspl138@vm$ . /usr/local/oecore-i686/environment-setup-armv5te-angstrom-linux-gnueabi
For ToolChains 4.3.3 and belowmitydspl138@vm$ . /usr/local/angstrom/arm/environment-setup
- You should get a response similar to
If that fails, refer to GCC Toolchain for instructions on installing the toolchain
Make sure that Eclipse is installed or you can use TI Code Composer which is based on eclipse¶
- Eclipse should reside under Applications -> Programming -> Eclipse
- If Eclipse is not installed, from a terminal, run
mitydspl138@vm$ sudo apt-get install eclipse
Install the CDT Extensions in Eclipse (Skip if using Code Composer)¶
- Start Eclipse by selecting Applications->Programming->Eclipse
- Check for updates by running Help->Check For Updates
- Select Help->Install New Software
- Enter "http://download.eclipse.org/tools/cdt/releases/galileo" in the "Work With:" section
- Click the checkbox for CDT Main Features
- Click the checkbox for CDT Optional Features
- Click Next, and Next Again
- Accept the license Agreement, click Finish
- Restart Eclipse when prompted
Create a new Eclipse project¶
- Start Eclipse by selecting Applications->Programming->Eclipse
- Select File->New->Project...
- Select C/C++ -> C++ Project
- Give the project a suitable name
- Under "Project Type:" select Cross-Compile Project and make sure that Cross GCC is selected as the toolchain
Note: In CCSv5.5, instead select "Hello World C++ Project" and make sure that Cross GCC is selected at the toolchain - Click Next
- Set "Tool command prefix" to be "arm-angstrom-linux-gnueabi-"
- Set "Tool command path"
- For 4.3.3 Toolchain: /usr/local/angstrom/arm/
- For 5.4.3 Toolchain: /usr/local/oecore-i686/sysroots/i686-angstromsdk-linux/usr/bin/armv5te-angstrom-linux-gnueabi"
- Click Finish
- Right click Project and select Properties -> C/C++ Build -> Evironment
- Ensure Variable Path contains "/usr/local/oecore-i686/sysroots/i686-angstromsdk-linux/usr/bin/armv5te-angstrom-linux-gnueabi"
not "/usr/local/oecore-i686/sysroots/i686-angstromsdk-linux/usr/bin/armv5te-angstrom-linux-gnueabi/bin"
- Create the Hello World program
- Select File -> New -> Source File
- Name it appropriately (with .c or .cpp extension)
- Add a main function that prints out "Hello World"
- Build the project
Send the executable to the MityDSP-L138 unit¶
- Connect an Ethernet cable to the MityDSP-L138 / Industrial IO board. The Ethernet cable should be connected to a network visible to your host build machine, and there should be a DHCP server running on your network. Otherwise static IP addresses will need to be configured for both your host PC and MityDSP-L138 module.
- Boot the MityDSP-L138 up into linux.
- From the serial port, get the IP address assigned to the MityDSP-L138. This can be accomplished by running
root@mityomap# ifconfig -a
- From your host, use the "scp" program to copy your compiled executable onto the target (the example below puts the file in the /home/root/ directory):
mitydspl138@vm$ scp ExampleProgram root@192.168.0.151:/home/root/
- Where the address above is replaced with the one assigned to your module from the ipconfig command above
- The first time you connect to the module you may be prompted to confirm authenticity, type "yes":
The authenticity of the host '196.168.0.151 (192.168.0.151)' can't be established. RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX. Are you sure you want to continue connecting (yes/no)?
- You will then be prompted to the password of the root user on the MityDSP module. There is none in default filesystems so just press the "Enter" key.
root@192.168.0.151's password:
- You will then see the file be transmitted with status information shown
ExampleProgram 100% 146KB 145.7KB/s 00:00
Make sure the MityDSP-L138 is up to date¶
- Update opkg and install any missing libraries (i.e. libstdc++)
root@mityomap# opkg update root@mityomap# opkg install libstdc++6
- During the "update" process it is expected that the /mityomapl138/Packages.gz will fail as this is auto generated by Angstrom; it can be ignored:
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.05/ipk/eglibc/armv5te/machine/mityomapl138/Packages.gz, wget returned 1.
- During the "update" process it is expected that the /mityomapl138/Packages.gz will fail as this is auto generated by Angstrom; it can be ignored:
- MDK releases prior to 2014-01-13 may experience 404 Errors when running opkg, please run this command to update the repository configuration files to use a valid URL:
sed -i 's#http://www.#http://feeds.#' /etc/opkg/angstrom*.conf
Launch the application.¶
From either a serial port, or from a remote shell (e.g., "ssh root@192.168.0.151"):root@mityomap# cd /tmp root@mityomap# ./ExampleProgram
- You should see "Hello World" printed to the terminal.
Go to top