【技术】Ubuntu上位机配置Blackfin开发环境手记

Ubuntu配置上位机Blackfin开发环境手记:[参考]http://blog.csdn.net/cp1300/article/details/8205282

My note for configuring the Software Development Environment(SDE) for TLL board on Ubuntu 12.04

Section 0: Working Aim 工作目的】

现在手里有一个嵌入式开发板,搭载的是 AnalogDevices 公司的 Blackfin527 Processor,预装板载Uclinux操作系统。现在要配置上位机Linux/Ubuntu12.04 的开发环境,包括Blackfin ToolchainEclipse开发环境,和Library.

 

Section1: Install Toolchain

Install Blackfin Toolchain

Refer to the Note after this section if you meet some issue during this installation.

1.1 Package Installation (recommended)

·                  Get the latest Blackfin Toolchain from ADI

·                                      Current up to date version is: 2011R1-RC4

·                                      Example download command:

·                  Check if a previous toolchain is already installed

·                 If so, remove old tool chain using rpm -e ...

> rpm -qa blackfin-toolchain\*

·                  Install Toolchain using RPM.

·                 Note: If a previous toolchain is installed, you may need to uninstall the previous toolchain see above

rpm -ivh blackfin-toolchain-*

More details on toolchain installation can be found at ADI's installation wiki entry.

1.2 Source Installation (advanced)

·                  Prequisites

yum install automake autoconf ncurses-devel zlib-devel texinfo

·                  set desired version

set VERSION=2011R1-RC2

·                  Get the latest Version of the GNU toolchain

svn checkout svn://sources.blackfin.uclinux.org/toolchain/tags/$VERSION/

·                  Compile and Install

> cd bfin_toolchain.$VERSION/buildscript/ > ./BuildToolChain -o <COMPILER_NSTALLATION_DIR>

Note: 这里要注意的是:

1.ADI offers serious packages of toolchain of one version for different usages. You should select which one is needed.  I downloaded the 3 packages:

  > blackfin-toolchain-2012R2-RC1.i386.rpm

  > blackfin-toolchain-elf-gcc-4.3-2012R2-RC1.i386.rpm

  > blackfin-toolchain-uclibc-default-2012R2-RC1.i386.rpm

        from the Blackfin Linux website in the toolchain file release page

 

2. Ubuntu does not support installing this toolchain by RPM tool.

  > I used the "How to Install rpm package on Ubuntu" approach to go around it. Chinese tutorial:

     注意,用alien转换的deb包并不能保证100%顺利安装,所以可以找到deb最好直接用deb

     有时候,我们想要使用的软件并没有被包含到 Ubuntu 的仓库中,而程序本身也没有提供让 Ubuntu可以使用的 deb 包,你又不愿从源代码编译。但假如软件提供有 rpm 包的话,我们也是可以在 Ubuntu中安装的。

方法一:

1. 先安装 alien  fakeroot 这两个工具,其中前者可以将 rpm 包转换为 deb 包。安装命令为: Intall the "alien" and "fakeroot" tools:
              

sudo apt-get install alien fakeroot

2. 将需要安装的 rpm 包下载备用,假设为 package.rpm Assume your package is: package.rpm

3.
 使用 alien  rpm 包转换为 deb 包: use alien to convert rpm package into deb package:

$ fakeroot alien package.rpm

4. 一旦转换成功,我们可以即刻使用以下指令来安装: After a while, if succeed, install it using command:

$ sudo dpkg -i package.deb

如何转换rpm详细教程,参考这里http://zhidao.baidu.com/question/377062512

[Section2. Install Eclipse]

Follow OS independent instructions:
Generally, follow instructions at: link

Note: It seems that Blackfin Toolchain only works in Helios Eclipse

Install components: 

     Blackfin ucLinux

     GDB Hardware Debugging

     Target Terminal Management

     ZynxCDT

Below is my steps:

Refer to this web page: http://docs.blackfin.uclinux.org/doku.php?id=toolchain:eclipse:install

   2.1.Install the Java Runtime Environment (JRE)

Checking your Java Runtime Environment version: 

$ java -version

If you do not have Java installed, go through the :Install Java Runtime Env. 1.6.0 

After you finished, the lines below should be displayed:

$ java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

 

 2.2 Install the IDDE (Eclipse)

There are no executable installers for Eclipse. It is distributed as a zip archive which you can unpack anywhere you like, and then just run the eclipse.exe program in the eclipse sub-directory.

To get the installer, visit the Eclipse download page.

You will be presented with a variety of download choices. The only difference between them is the default plug-in set. Since you will most likely be compiling/debugging code for the Blackfin processor, you should pick Eclipse IDE for C/C++ Developers.: 

 Note: It seems that Blackfin Toolchain only works in Helios Version (Download this verion)

Extract: eclipse-cpp-helios-SR2-linux-gtk.tar.gz , 
       1.Double-Click on Archive and Extract Eclipse into /tmp

       2.Open Terminal Window

       3.Install Required Packages

 

sudo su
# apt-get install g++

 

 4.Relocate Eclipse

# mv /tmp/eclipse /opt

 5.Create a Symlink

# ln -s /opt/eclipse/eclipse /usr/bin/eclipse

6. After, you can Start Eclipse from Terminal simply with:

# eclipse

or: (the way by which we launch Eclipse is under the Super User permision)

$ exit
$ sudo eclipse

       If you want to overcome the root permission issue, refer to: here. but it does not work on my Ubuntu.

 

       Reference: How-to Install Eclipse Juno 4.2 C/C++ on Ubuntu
        If Installed Eclipse on Linux, but it does not start,read this

    2.3 Install the Blackfin Plug-ins

 The Blackfin plug-ins will require Eclipse 4.2, as well as the CDT. Additionally, you will have to install the GDB Hardware Debugging CDT plug-in (it is usually not installed by default). 
          To install the GDB Hardware Debugging plug-in, the CDT update site needs enabled. 
          To enable the CDT site:

1.                Select the Eclipse menu Window→Preferences.

2.                Select Install/Update→Available Software Sites and select the site, http://download.eclipse.org/tools/cdt/releases/juno.

(Here I used Helios, it's a little different. Keep it Enabled. Maybe we need to add the link in the last line)

3.                Use the Enable button to enable the site.

     Install the GDB Hardware Debugging plug-in via the Update Manager:

1.                Select the Eclipse menu Help→Install New Software

2.                Select the http://download.eclipse.org/tools/cdt/releases/indigo site in the Work With list(Add this, if there isn't.)

3.                Enable the GDB Hardware Debugging plugin under CDT Optional Features

 



  1. The Blackfin plug-ins can be obtained from the http://blackfin.uclinux.org/eclipse/ site via the Update Manager:

              1.Select Help→Install New Software from the Eclipse menu
              2.Click the Add button
              3.Add http://blackfin.uclinux.org/eclipse/ as a new site"Blackfin GNU"

Then you can select the plug-ins to install:

      

The Blackfin Debug plug-in results in extra selectable entries in the “Debug Configuration” dialog, while the Tool chain plug-in allows for selecting the desired tool chain out of a list from within the New Project Wizard dialog.

 

Install the Zylin CDT

The Eclipse C/C++ Development Tools (CDT) has excellent GDB support. However, there are a few stumbling blocks when trying to debug embedded applications, which Zylin AS has made some modifications in Eclipse CDT to improve support for GDB embedded debugging.

Path for update manager “Add Site”: http://opensource.zylin.com/zylincdt

         

 

Install Subclipse (SVN)   (I skipped this)

While not released with Eclipse, there is a Subversion plugin called Subclipse. Visit the Subclipse homepage for some concise install directions.

Once you have Subclipse installed, the interface is the same as using the CVS plugin.

 

Target Management Terminal

An ANSI (vt102) compatible Terminal including plug-ins for SerialSSH and Telnet connections.

To use a serial terminal in Eclipse Juno. (Here we use Helios)

 

1: Install the software for serial terminals:

Navigate to: Help -> Install New Software...

Dropdown list for Work with: to say Juno - http://download.eclipse.org/releases/juno

Select: Mobile and Device Development, especially Target Management Terminal which is "An ANSI (vt102) compatible Terminal including plug-ins for Serial, SSH and Telnet connections."

Click Next and anything else to finish the install ...

2: Open the view

Navigate to: Window -> Show View -> Other ... -> Terminal -> Terminal (NOTE: singular Terminal, not plural Terminals)

3: Open a terminal

The rest should be fairly obvious as the view contains icons to Connect, Disconnect, Settings, etc which are related to Serial, SSH and Telnet connections.

Reference: click here



 

Target Management Terminal Serial Connector requires RXTX

Installation as an Eclipse Plugin via Update Manager:


  • In Eclipse, choose Help > Software Updates
    • Add New Remote Site:
Name = RXTX URL = http://rxtx.qbang.org/eclipse/

           · select proper version, Install All


Untill Now, we have installed the components:  

  • Blackfin ucLinux (Blackfin plug-ins)
  • GDB Hardware Debugging
  • Target Terminal Management
  • ZynxCDT (We installed ZylinCDT instead)

Section3. Library Installation

 

  • Checkout of common code
> svn co https://nuforge.coe.neu.edu/svn/pal/tags/v1.1_gnu/0.1/bare-c
  • Edit Makefile.macros located in bare-c/common
    • Edit the prefix to the path where you want the library to be installed  For ex: 
> # --- Installation directories prefix = /home/student/agarwal/temp/pal
  • Edit the COMPILER macros to the path where you have installed the compiler above
    The default install path for all of our toolchains is /opt/uClinux/
#-- Compiler COMPILER =  <COMPILER_NSTALLATION_DIR> /bfin-elf/bin/bfin-elf-gcc 
eg. #-- Compiler COMPILER = /opt/uClinux/bfin-elf/bin/bfin-elf-gcc
 
BackUP:
#-- Compiler

COMPILER = /ECEnet/Apps1/sce-ext-pkg/sw/bfin_toolchain.2011R1-BETA1/bfin-elf

  • For Compiling the library we need to source the blackfin compiler path .
For tcsh shell 
> setenv PATH <COMPILER_NSTALLATION_DIR>/bfin-elf/bin/:$PATH 
For bash shell 
> export PATH; PATH=<COMPILER_NSTALLATION_DIR>/bfin-elf/bin:$PATH
    Here we use:
> export PATH; PATH = /opt/uClinux/bfin-elf/bin:$PATH 
  • Follow these steps to install the libraries
> cd common  
> make clean 
> make 
> sudo make install
  •   Validate your environment   
> source <installation path>/bin/setup.sh 
 eg. > source /usr/uClinux/bfin-elf/bin/setup.sh
> cd demo 
> make clean 
> make
        This make should complete without error. (But we meet several errors)
  ==============================================
Here, I just referred some other instructions, and:
 1.deleted Eclipse, 
 2.Downloaded the Eclipse(Juno)
 3.Set the PATH

1. ReInstall the Eclipse
      go to the "eclipse" folder:
> cd /opt
> rm -rf eclipse
2. Download the Eclipse (Juno)

    Select the Juno version, Download the eclipse package from: Linux 32bit
       
       Extra it into /home/yourname/programfiles/

       We have Installed the Java Runtime Environment above, so we don't need to install it here.

3. Configure the environment variable(PATH)

       Modify the environment variable of "bfin-linux-uclibc-gcc"
        In Terminal, run:
> sudo gedit /etc/profile
       Modify the Environmental Variable. Note, this is user environmental variable, After this we can only use
"bfin-linux-uclibc-gcc" but cannot use "sudo bfin-linux-uclibc-gcc". All the command after "sudo" is for using 
system environmental variable but not user's environmental variable.
       In the gedit window add the line below at the tail.
 > export PATH=$PATH:/opt/uClinux/bfin-linux-uclibc/bin 
    And for the JRE PATH configure, add the line below:
 > JAVA_HOME=/opt/java/32/jre1.6.0_16
 > PATH=$JAVA_HOME/bin:$PATH
       See the snap below:
    

4. Building a uClinux Hello World project 
         Go to the location of eclipse:"
/home/yourname/programfiles/eclipse", Run the eclipse by:
> cd /home/yourname/programfiles/eclipse
> ./eclipse 
          In Eclipse, New->Project->C/C++ -> C Project -> "Project type: Executable/Empty Project" and 
"ToolChains:Cross GCC " -> "Next" -> Set the path of your "bfin-linux-uclibc-gcc"  -> finish.
See the snap:
       

       And build your Hello World project:

       

        This method is only for building the uClinux app. If you want to build Bare-Metal 
Refer to:
Developing Bare-Metal C Applications
  1.     Setup common bare-c library bareC Release Notes
    1.     Update bare-c libraries updateBarec
    2.     Doxygen documentation link
  2.     Developing and debugging C applications using Eclipse link
    1.      TLL's: Bare-C Development/Debugging with Eclipse link
           More detailed debug tutorial.
    2.      Debug connection through gnICE link
    3.      Alternative debug connection: using kgdb kgdb
  3.      Using DSP-specific libraries dsplibs
  4.      Launching bare-c apps through U-Boot link
  5.      Analog Devices introduction to bare-c development link
  6.      Stop automatically booting linux u-boot


================= Connect with Target Board =================
        In this Section, we are going to download the executable bin file made by Eclipse down to target.
        1. Install the minicom
        2. Install the USB-UART bridge converter driver on Linux
        3. Install the USB-Ethernet bridge converter driver on Linux, and Configure it.
        4. Test the Communication functions.
        5. Test the J-TAG connection if I have interests.

   1. Install the minicom
         In the Terminal, input:
> sudo apt-get install minicom
    2. Install the USB-UART bridge converter driver on Linux
        Install driver for USB-UART bridge converter on Linux Ubuntu12.04
        Ubuntu下USB转串口芯片驱动程序安装,支持cp210x,pl2303等


        When you plugin your USB-UART converter, and run "> ls /dev/tty*", if you don't see the
 /dev/ttyUSB0 (or similar), your Linux does not detect your USB-UART device.

We need to install the driver for your device.

Here we use Ubuntu12.04, and Updated the source to 3.2.0 version. If there is difference about
version Number from your OS platform, please try to modify it into yours.


1.Download the Linux Source Code

Open a terminal and execute the following commands. Note that your version of Linux may differ
slightly -- adjust accordingly.
$ cd ~
$ sudo apt-get install build-essential linux-source
$ cp /usr/src/linux-source-3.2.0.tar.bz2 .
$ bunzip2 linux-source-3.2.0.tar.bz2 
$ tar xf linux-source-3.2.0.tar 
$ cd ~/linux-source-3.2.0



2.Recompile and Reinstall the cp210x Driver

From within a terminal, execute:
$ cd ~/linux-source-3.2.0
$ make oldconfig
$ make prepare
$ make scripts
$ cp /usr/src/linux-headers-3.2.0-34-generic-pae/Module.symvers .

Here, I have the "3.2.0-29" version also, I launched the command above, but not the below:
  "cp /usr/src/linux-headers-3.2.0-29-generic-pae/Module.symvers ."

Recompile and Reinstall the cp210x Driver
Here, We can actually install many kinds of USB-UART converter drivers. We take cp210x as the
 example.
From within a terminal, execute:

$ make M=drivers/usb/serial
$ sudo mv /lib/modules/$(uname -r)/kernel/drivers/usb/serial/cp210x.ko /lib/modules
  /$(uname -r)/kernel/drivers/usb/serial/cp210x.ko.old
$ sudo cp drivers/usb/serial/cp210x.ko /lib/modules/$(uname -r)/kernel/drivers/usb
  /serial/
$ sudo modprobe -r cp210x
$ sudo modprobe cp210x

Reboot Linux system.

Run Terminal: 
$ ls /dev/tty*
The we can see the device is detected by Linux Host OS:
    Then, We can configure the minicom to communicate with our target board.


======================================================
Here is an example of configure the parameters of minicom for TLL6527M PAL board:
I just copied it here hardly without any font editing. Sorry about that.

Serial Communications from Host-PC to TLL6527M Target Hardware

The TLL System Design Environment (SDE) running on the host PC comes pre-configured with
 the required settings for serial-UART communications between the host PC and the TLL6527M
 base module. Generally, for use with TLL6527M the settings need not to be changed
(
Note: From the SDE OS version 0.3.2, the serial terminal program Minicom is set to
open /dev/ttyUSB0 with the needed configuration as mentioned above.
).

  • To start serial communication from host to the TLL6527M, open the serial communication terminal
    program Minicom. Just open a terminal window on your Linux SDE running on the host PC  and
    type the command "minicom" at the command prompt on your host PC terminal console.
  • The TLL6527M on power-up  is set by default to the following serial-UART communication settings:

  • Bits per second = 115200
  • Data bits = 8
  • Parity = None
  • Stop Bits = 1
  • Flow control = None
  •  Make sure that the TLL6527M's USB-UART port has been mapped to a ttyUSBx device node in the /dev
    folder on the host PC SDE. See following example:


  • Now make sure that this "ttyUSBx" is set as the destination port, baud rate is 115200,
     and 8N1 mode for minicom, by running the command 'minicom -s'. Note that running the
    "minicom -s" command as a normal user will only apply the settings for the current
    session. In order to make the settings permanent, these commands need to be run with
    root privileges.
    See example below: 


  • The following window will appear on your host PC terminal window: 

  • Go to ‘Serial port setup’, following screen will appear, make sure that serial device is set to ‘/dev/ttyUSB0’
    and bps/par/bits is set to 115200 8N1:
 
  • Now go back to the main menu and choose ‘save setup as dfl’. This will save the configuration settings and from next time
    onwards user can directly run ‘minicom’ command without the option ‘–s’ and it will load settings from the saved file.


  • RESET the target by using the SDE's TLL6527M reset utility or by pressing the RESET button on the target. 
  • Following messages will be displayed on the terminal. By default, U-Boot is setup to
    automatically start booting the OS after waiting for a few seconds for the user to
    interrupt the automatic launch by pressing any key. So to stop U-Boot from loading
    uClinux and provide U-Boot command prompt, just hit any key. (This is assuming TLL6527M
    is flashed with u-boot and uClinux. TLL6527Ms are pre-flashed with firmware before shipping)
    .





         Go to the website of your converter applier, for me: Here, Download 
         I halted here. :( But I never give up, solved it next:)
          Here is another simpler way to install the driver: 
 http://blog.sina.com.cn/s/blog_55a4cddc0101afs8.html

    3. Minicom configuration:
   To here, we can use Eclipse to develop our own Blackfin-uClinux app and send it down to our target
      board (TLL6527M PAL Board), But there is still no our desired ToolChain out of a list from within the New Project Wizard dialog
      

=========== Add the Blackfin Linux FDPIC GNU Toolchain(bfin-linux-uclibc) =============
        Then I installed the Blackfin Plug-ins again for Juno
        Reference : Installing Eclipse 4.2 (Juno)
        There contains:
                `. A Java Runtime Environment (JRE) version 1.6 or newer
                `. Eclipse IDDE (version 4.2 recommended)
                `. C/C++ Development Tools (CDT)
                `. Blackfin toolchain
                `. Blackfin Plug-ins

        Here we only installed the Plug-ins:
        The Blackfin plug-ins will require Eclipse 4.2, as well as the CDT. 
        Additionally, you will have to install the GDB Hardware Debugging 
        CDT plug-in (it is usually not installed by default). To install 
        the GDB Hardware Debugging plug-in the CDT update site needs enabled.

        --------
        To enable the CDT site:
        1. Select the Eclipse menu Window→Preferences.
        2. Select Install/Update→Available Software Sites and select the site, 
        3. http://download.eclipse.org/tools/cdt/releases/juno.
        4. Use the Enable button to enable the site.

        ---------
        Install the GDB Hardware Debugging plug-in via the Update Manager:
        1. Select the Eclipse menu Help→Install New Software
        2. Select the http://download.eclipse.org/tools/cdt/releases/indigo site in the Work With list
        3. Enable the GDB Hardware Debugging plugin under CDT Optional Features

        ---------
        The Blackfin plug-ins can be obtained from the 
        http://blackfin.uclinux.org/eclipse/    site via the Update Manager:

        1. Select Help→Install New Software from the Eclipse menu
        2. Click the Add button
        3. Add http://blackfin.uclinux.org/eclipse/ as a new site "Blackfin GNU"

        ---------
        Then you can select the plug-ins to install:
        The Blackfin Debug plug-in results in extra selectable entries in the “Debug Configuration” dialog, 
        The Tool chain plug-in allows for selecting the desired tool chain out of a list from within the 
        New Project Wizard dialog.
        
        As the dialoge box said, restart Eclipse.

        ---------
        Then when we creat a C Project, "Project type":Empty Project, in the "ToolChains" box, 
        there appears:"Blackfin Linux FDPIC GNU Toolchain(bfin-linux-uclibc)"
        See the Snap pic below:
        



======================================
=========== Ethernet Connection ==========

        Here, I'm going to configure the Ethernet manually.

        I tried to run palTelnet.sh, but failed by some errors.:
-----------
./palTelnet.sh: 44: read: arg count
WARNING: TRENDnet TU2-ET100 not found.
  1) Validate USB connection from TU2-ET100 to host.
  2) Validate TU2-ET100 is connected to virtual machine instead of host).
     check: Virtual Machine -> Removable Devices -> asix ax88772
Press <ENTER> to continue, <CTRL>-C to stop
./palTelnet.sh: 44: read: arg count
-----------
        It says the TRENDnet TU2-ET100, I thought it was because of the driver
        of TU2-ET100 was not configured.
        (The gray part does not work, you can just skip it)
        Download the driver from:
        http://www.trendnet.com/downloads/list_subcategory.asp?SUBTYPE_ID=1003
        Extract it into:
        /home/sonictl/Downloads/LINUX2.6.9_REV122/AX88772_772A_LINUX2.6.9_REV122/
open readme, it says:"This driver is only for Kernel 2.6.9 to 2.6.13"
It seems like I need to download the Kernel2.6.9. get it 
        from:get "linux-2.6.9.tar.bz2" from: www.kernel.org/pub/linux/kernel/v2.6/

        Open a terminal and execute the following commands.
        
        > $ cd ~
        > $ sudo mv ~/Downloads/linux-2.6.9.tar.bz2 /usr/src/
        > $ cp /usr/src/linux-2.6.9.tar.bz2 .
        > $ bunzip2 linux-2.6.9.tar.bz2
        > $ tar xf linux-2.6.9.tar 
        > $ cd ~/linux-2.6.9
        
        Recompile and Reinstall the cp210x Driver,From within a terminal, execute:
        > $ cd ~/linux-2.6.9
        > $ make oldconfig
I pressed all Return Key.
        > $ make prepare
        > $ make scripts
        > $ cp /usr/src/linux-headers-3.2.0-34-generic-pae/Module.symvers .
        
To here I get halted. I searched online for a while, and Did the following:
========================================================

        Retry Install the ASIX AX88772 Driver for Linux
        
        Download the driver for Kernel 3.x my kernel is 3.2.0, you can update your kernel by 
              > sudo apt-get install build-essential linux-source    )
         unzip the Package_YouDownloaded.zip
         go into the folder, and open the readme file in gedit
$ sudo su
make
        If the compilation is well, the asix.ko will be created under the current
        directory.
        If you want to use modprobe command to mount the driver, executing the
    following command to install the driver into your Linux:
[root@localhost template]# make install
        
     ----------------
     Usage:
     ----------------

     1. If you want to load the driver manually, go to the driver directory and
        execute the following commands: ( this does not work, skip )

[root@localhost template]# insmod asix.ko

     2. If you had installed the driver during driver compilation, then you can use
        the following command to load the driver automatically. (I used this one)

[root@localhost anywhere]# modprobe asix

     If you want to unload the driver, just executing the following command:

[root@localhost anywhere]# rmmod asix
     ----------------
         Test if the driver is loaded:
         But How?

==================================
        So, I began to configure the Host Manually.

        First, check the USB devices connected on Ubuntu Linux:
         > lsusb
        we get:
-----------
        $ lsusb
        Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
        Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
        Bus 001 Device 006: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x Composite Device
        Bus 001 Device 007: ID 0b95:7720 ASIX Electronics Corp. AX88772

Manually Setting IP Address

This section shows what happens inside the script described in section 2 and allow you to follow the
setup manually.

1. Identify the Ethernet Interface Name inside the Virtual Machine

Each time the Ethernet adapter is connected a different name may be associated with it. To list
the currently known Ethernet interfaces, open a new terminal, and execute

> ifconfig
  • Ifconfig will list two connections. 
         A) Interface with IP address (this is the connection to the internet), Example output:
eth0 Link encap:Ethernet HWaddr 00:0C:29:51:9B:E6 
inet addr:192.168.64.138 Bcast:192.168.64.255 Mask:255.255.255.0 
inet6 addr: fe80::20c:29ff:fe51:9be6/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

B) Interface without IP address (connection to PAL)

The device #: 00:50:B6:xx:xx:xx is your Ethernet Adapter #

eth1 Link encap:Ethernet HWaddr 00:50:B6:0A:2A:1A 
inet6 addr: fe80::20c:29ff:fe51:9be7/64 Scope:Link 
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

         The PAL interface can be recognized by 

 

             (1) a different second line: the line starting with "inet addr" is missing (even though the "inet6 addr"
                  may be listed)

             (2) the HWaddr starts with 00:50:B6.

2. Set IP address for interface connected to PAL

  • Assign IP address by using the following command 
    (we assume eth1 is the Ethernet connection without specified IP address
    )
> sudo ifconfig eth1 192.168.40.1
  • "sudo" allows executing a command as root (administrator).  For VM pal user, PW:real happy 

3. Validate that the interface has accepted the IP setting

  • Use "ifconfig" again

4. Establish a Telnet connection to the board.

  • Each PAL is set by default to the IP 192.168.40.211 (you can use "ifconfig" through minicom to get it)
  • Open a telnet session by
> telnet 192.168.40.211
For my target PAL board, Username: root, PW:uClinux
I Set it succesfully, So the Ethernet connection is configured correctly. That means our driver installation is
Done!


=====================  Configure your telnet connection with the target board   ====================

Sometimes, when our automatically network connection is not stable, i.e. the DHCP can not work proplerly,
 we need the mannually conifigure the ip for our telnet.

Manually Configuring Ethernet

This section describes how to manually configure the Ethernet connection on SDE 5.3.x. This is an
alternative to running the automated setup script add-trendnet-adapter.py.

1. Connect TU2-ET100 and make sure it is connected to the Virtual Machine (see instructions here)

2. Open context menu to to configure connections through NetworkManager.

  • Click right mouse button on NetworkManager icon
  • Select "Edit Connections ..."

Open Context Menu on NetworkManager and select "Edit Connections"

3. In the dialog box "Network Connections", select the Wired Connection that corresponds to your USB
Ethernet adapter.

  • Note which connection has appeared after plugging in the USB Ethernet adapter. The image below,
    assumes  "eth0" is the connection for the TU2-ET100.
  • Then, select "Edit ..."

Select connection for your Ethernet adapter (assumed here eth0)

4. Validate that the TU2-ET100 was correctly selected

  • The Device MAC address should start with 00:50:b6.

Validate MAC address of Connection

5. Select Tab "IPV4 Settings", and configure the interface.

  • Under Method, select "Manual"
  • Select: Add
  • Enter the following values into line under Addresses
    • Address: 192.168.40.1
    • Netmask: 255.255.255.0
    • Gateway: 192.168.40.1
  • Close "Editing eth0" dialog box by selecting "Save"
    • Save button is grayed out unless valid values are entered for Address.

6. Close dialog box Network Connections.

The Ethernet connection is now configured. The same configuration will be recovered next time
the same USB Ethernet adapter is connected.


================================================

 ===============================================

If you want to use the library "libasound.a/out", 
you may need the "libasound2" package.



 * For My Nuggets:
 * I need library "TLL6527M_C_API_uClinux_TLL2012R1DevTEST" from /prerelease20120823/libary/elfStatic/
 * I need include /prerelease2012xxxx/inclue/common/
 *
 * For Audio:
 * I need library  "asound" from /opt/ALSA_LIB
 * I need include .../prerelease2012xxxx/inclue/audio/
 * I need include  /opt/ALSA_INCLUDE/alsa/sound


    I found there is no /opt/ALSA_LIB folder in my Ubuntu12.04 system disk.

the brown text below is my failed configuration note, just skip it ;)
----so, go to Ubuntu website and download the alsa package:


https://launchpad.net/ubuntu/precise/+source/alsa-lib/1.0.25-1ubuntu10


Download the alsa-lib_1.0.25.orig.tar.bz2, extract it into Download folder.
run the command in Terminal:
    $ cd ~/Download/alsa-lib-1.0.25
    $ sudo ./configure
    $ sudo make
    $ sudo make install


There are some errors existed.
-----------------------------
    I searched the library "asound", and I find it is in the "libasound2" package.
----Install "libasound2" package: ----
    Download the file "libasound2_1.0.22-0ubuntu7_i386.deb" package from:
    http://packages.ubuntu.com/lucid/libasound2


    Install the .deb package:
    > $ sudo dpkg -i libasound2_1.0.22-0ubuntu7_i386.deb


    An error happend:Package libpython2.6 is not installed. 
    It depends on libpython2.6.


----Install the "libpython2.6" package: ----
    Download the package at:http://packages.ubuntu.com/zh-cn/lucid/libpython2.6


    Install it:
    > $ sudo dpkg -i libpython2.6_2.6.5-1ubuntu6.1_i386.deb


    but:
    libpython2.6 depends on python2.6


    libpython2.6 depends on libssl0.9.8


----Install the "python2.6" and "libssl0.9.8" 
    ----Install Python 2.6 in Ubuntu 12.04:
        Ref:http://www.ubuntututorials.com/install-python-2-6-ubuntu-12-04/
        Ubuntu 12.04 includes Python 2.7.3 and  Python 2.6 is no longer available for install.If you need 


to run  legacy software which only support Python 2.6.Below steps will show you how to install Python 2.6 


from PPA,alternatively you also can build it yourself.


        sudo add-apt-repository ppa:fkrull/deadsnakes
        sudo apt-get update
        sudo apt-get install python2.6 python2.6-dev


        some error happens, about dependency.


    ----Install libssl0.9.8 ----
        Download it from:https://launchpad.net/ubuntu/precise/i386/libssl0.9.8/0.9.8o-7ubuntu3.1
        Install it by dpkg -i libssl...deb


        It seems like succeeded.


    ----Install Python 2.6 again----
        sudo add-apt-repository ppa:fkrull/deadsnakes
        sudo apt-get update
        sudo apt-get install python2.6 python2.6-dev


        I got:"E: Unmet dependencies."


    ----Install libpython2.6 :
        > sudo dpkg -i libpython2.6_2.6.5-1ubuntu6.1_i386.deb 
        it still need for python 2.6


    ----Install Python2.6:
        1. Download "Python-2.6.tar.bz2" from:
           http://www.python.org/ftp/python/2.6/Python-2.6.tar.bz2
        2. Extract it
           $ tar jxvf Python-2.6.tar.bz2
 
        3. $ cd Python-2.6
           $ sudo ./configure
           $ sudo make
  $ sudo make install


    ----Install libpython2.6 :
        > cd ~/Downloads
        > sudo dpkg -i libpython2.6_2.6.5-1ubuntu6.1_i386.deb
        Error: libpython2.6 depends on python2.6 (= 2.6.5-1ubuntu6.1); 
        however: Version of python2.6 on system is 2.6.8-2+precise1.


    ----Install python2.6.5-1ubuntu6.1
        Download it from:
        https://launchpad.net/ubuntu/+archive/primary/+files/python2.6_2.6.5.orig.tar.gz


        Extract: $ tar zxvf python2.6_2.6.5.orig.tar.gz
        > $ cd ~/Downloads/python2.6-2.6.5
        > $ ./configure
        > $ sudo make
        > $ sudo make install
        
    ----Install libpython2.6 :
        > cd ~/Downloads
        > sudo dpkg -i libpython2.6_2.6.5-1ubuntu6.1_i386.deb
        
        Error: libpython2.6 depends on python2.6 (= 2.6.5-1ubuntu6.1); 
        however: Version of python2.6 on system is 2.6.8-2+precise1.


    ----Install libpython2.6_2.6.8-2+precise1_i386.deb  
        Download it from:
        https://launchpad.net/~fkrull/+archive/deadsnakes/+build/3802469/+files/libpython2.6_2.6.8-


2%2Bprecise1_i386.deb


        Install it:
        $ sudo dpkg -i libpython2.6_2.6.8-2+precise1_i386.deb
        
It seems like succeeded.


    ----Install "libasound2" package again:


        Install the "libasound2" package:
        > $ sudo dpkg -i libasound2_1.0.22-0ubuntu7_i386.deb
    
        It seems like succeeded.


----Check the /opt/ALSA_LIB and /opt/ALSA_INCLUDE
        No! :(


    There is no folder about alsa in /opt, but check if my uClinux programe compiling can be correct. add 


the "asound" library directly as -lasound, but no assigning the path of it because I have installed the 


libasound2 package above.


    Go back to Eclipse, and configure the library: 
        asound
        "TLL6527M_C_API_uClinux_TLL2012R1DevTEST" from /prerelease20120823/libary/elfStatic/


                            configure the include: 
        prerelease../include/audio
        prerelease../include/common
        usr/include/alsa/sound


    When compiling in Eclipse, Get the error: cannot find the lib: -lasound 


 
----Install the libasound2-dev
    > $ sudo apt-get install libasound2-dev
    Get error:
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
    
    
----Install the alsa-lib-1.0.13:
    Go to the webpage:
    http://www.linuxfromscratch.org/blfs/view/6.3/multimedia/alsa-lib.html
    Download the .tar.bz2 package:
    http://gd.tuwien.ac.at/opsys/linux/alsa/lib/alsa-lib-1.0.13.tar.bz2
    Extract it:
    > $ tar jxvf alsa-lib-1.0.13.tar.bz2
    > $ cd ~/Downloads/alsa-lib-1.0.13/
    
    Install the library:
    > $ ./configure --enable-static && make
    > $ sudo make install


    


    It seems that installing the alsa-lib-1.0.13 succeeded, 
    the library file "libasound.a/out" at:  /usr/lib
    I just included in Eclipse the header files at:  /usr/include/alsa/sound


    But the Eclipse still report error:
        DescriptionResourcePathLocationType
        skipping incompatible /usr/lib/libasound.so when searching for -lasoundaudio_example


C/C++ Problem
        skipping incompatible /usr/lib/libasound.a when searching for -lasoundaudio_example


C/C++ Problem
        cannot find -lasoundaudio_exampleC/C++ Problem
        make: *** [audio_example] Error 1audio_exampleC/C++ Problem


----Copy the /opt/ALSA_INCLUDE/alsa/sound & /opt/ALSA_LIB from the Fedora Host System that released by The 


Learning Labs company. Put them into my U-disk.


    Now plug in the u-disk, and we need to mount the devices. 


    Run the command to see which devices do you have: 
    > $ sudo fdisk -l /dev/sda
    And I got:
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00029a1e


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    14680063     7339008   83  Linux
/dev/sda2        14682110    16775167     1046529    5  Extended
/dev/sda5        14682112    16775167     1046528   82  Linux swap / Solaris




    There should be a FAT32 System disk, but there is no.


    If you only plugged in one U-disk, and your disk is not scsi interface, its hardware name is: sda1


    Build an usb folder at your mnt: $ sudo mkdir /mnt/usb


    Mount your u-disk:  $ mount -t vfat /dev/sda1  /mnt/usb


    I copied it to the /opt folder from my ~/Downloads which is containing the /ALSA_INCLUDE and /ALSA_LIB 


which is copied from U-disk:
    ~/Downloads/opt> $ sudo cp -r ALSA_INCLUDE /opt/
    ~/Downloads/opt> $ sudo cp -r ALSA_LIB /opt/


    Now we have the libraries and head files needed for audio programming.
    Test in Eclipse: I don't have the permission to access the foler I copied just now.
    [Here, you can try command: "sudo chmod 777 foldername"]
    [Ref:http://superuser.com/questions/208606/how-to-change-file-permissions-for-a-directory-in-one-


command]


    ----Log out linux and log in as the root user:
    Ref:http://linuxathena.com/tutorials/login-root-account-gui-ubuntu-12-04/
    Open Terminal, input: sudo passwd
    update the UNIX password: xxx
    
    By default, Ubuntu doesn't allow root log on the graphic interface.
    Modify the "/etc/gdm/gdm.conf" file to allow root log on.
    In this file, modify the "AllowRoot = false" into "AllowRoot = true".


    Ubuntu 12.04下允许Root用户直接登录图形界面:
    Ref:http://askubuntu.com/questions/126286/unable-to-login-as-root-from-the-login-screen-even-though-


i-have-a-root-account
    Now, I'm using Ubuntu 12.04, I have to enable it in /etc/lightdm/lightdm.conf
    Enter the sudo mode:
    > $ su root
    Change the file permission of "lightdm.conf"
    > # chmod 777 /etc/lightdm/lightdm.conf


    > # vi lightdm.conf


    Add the following line:
    greeter-show-manual-login = true
    Save and exit: ":wq"
    Reboot the system.  Select the user, input "root" and password.


    Change the permission of /opt/alsa* folders.
    Logout and login as former user.
    
    Test the access to the /opt/alsa* folders in Eclipse.
    There are 5 new errors occured.
    DescriptionResourcePathLocationType
undefined reference to `_dlsym'audio_exampleline 121, external location: /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/dlmisc.cC/C++ Problem
    undefined reference to `_dlclose'audio_exampleline 91, external location: /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/dlmisc.cC/C++ Problem
    undefined reference to `_dlsym'audio_exampleline 167, external location: /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/dlmisc.cC/C++ Problem
    make: *** [audio_example] Error 1audio_exampleC/C++ Problem
undefined reference to `_dlopen'audio_exampleline 70, external location: /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/dlmisc.cC/C++ Problem


    And I received the notes form the TLL board provider:
----------------------
At this moment we're only supporting our Fedora based TLL SDE as Design / Development host OS for TLL platforms, this enables us to ensure all the tools/settings/dependencies work seamlessly with each other and thus requires us to concentrate efforts on a single platform avoiding a proliferation of different OS flavors. Hence we've tested the nuggets and build tools ONLY on TLL SDE(Fedora).


I would guess that ALSA libs would not be OS flavor dependent and might be usable just by coping library binaries and include header files over to your Ubuntu machine. However we'll not be able to support any issues you might face there.


Why don't you consider building a personal TLL SDE bootable pen drive which you can plug into your own machine while working with TLL platforms and then just reboot your system into your ubuntu when you need to use other things you are using. You can install it on a 4GB (or greater) pen drive.


Here is a link to SDE installation notes:
https://tll.assembla.com/spaces/designcenter/wiki/System_Design_Environment#2._installation_of_tll_sde


Please feel free to let us know any issues you face with this use mode of SDE.


 ---------
Hello ,


let me echo his words.


I would not recommend any use on a custom installation. There are too many variables that can not be sufficiently controlled. As such it is practically infeasible to support such an installation.


Alternatively, you can install/run the SDE directly as outlined by Ashish, however at a loss of company-specific customizations.

    
    ----------------------------


至此,我配置好了blackfin的开发环境,但是没法配置适用于TLL所有板载功能的开发环境。因为TLL板自己的开发环境为了使用TLL板,有太多的东西需要配置。我并没有完整的配置文档。或许他们公司经过一次次的修改,才发布的SDE本身已经不知道要配置哪些东西了。

到此为止吧。。。。。但是

=============================================================================
    

    But when I compile the accelerometer, there is no errors happened. This
makes me burn a new fire in my mind.

    I began to test the other nuggets except audio.

=============================================================================

        OMG!!!
    I fixed this problem by: add the libarary -ldl into my objects.mk file which is created
by Eclipse.

    so:

    * For My Nuggets On Ubuntu12.04:
    * You need library  "TLL6527M_C_API_uClinux_TLL2012R1DevTEST" at /prerelease20120823/libary/elfStatic/
    * You need include  /prerelease2012xxxx/inclue/common/
    *
    * For Audio:
    * You need library  "dl" (No need to assign its path, system default.)
    * You need library  "asound" from /opt/ALSA_LIB
    * You need include  .../prerelease2012xxxx/inclue/audio/
    * You need include  /opt/ALSA_INCLUDE/alsa/sound
=====================================================

遇到 Eclipse 编译时出现:
undefined reference to '_dlclose'
undefined reference to '_dlopen'
undefined reference to '_dlsym'
undefined reference to '_dlsym'
我的解决办法:
    我是修改了.mk 文件,实际上是增加了一个库, dl (dynamic link) 
    在原本描述链接库的地方:

LIBS := -lTLL6527M_C_API_uClinux_TLL2012R1DevTEST -lasound
    修改为:"
LIBS := -lTLL6527M_C_API_uClinux_TLL2012R1DevTEST -lasound -ldl
再重新编译,就没有错误产生了。
=====================================================    

    But I met the errors when I launch the app bin file on my target board! :(

    See the log below:

root:/home> ls
audio_example  matlab-serial
root:/home> ./audio_example 
Switching to default type SSM2603, for stereo capture 
through Line In, at 16 bits per sample and 48000 Hz 
sampling rate
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/dlmisc.c:246:(snd1_dlobj_cache_get) symbol _snd_ctl_hw_open is not defined inside [builtin]
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/confmisc.c:674:(snd_determine_driver) could not open control for card 0
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/conf.c:3326:(snd_config_hooks_call) function snd_config_hook_load_for_all_cards returned error: No such device or address
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/dlmisc.c:246:(snd1_dlobj_cache_get) symbol _snd_ctl_hw_open is not defined inside [builtin]
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/confmisc.c:674:(snd_determine_driver) could not open control for card 0
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/conf.c:4184:(_snd_config_evaluate) function snd_func_card_driver returned error: No such device or address
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/conf.c:4184:(_snd_config_evaluate) function snd_func_concat returned error: No such device or address
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/conf.c:4184:(_snd_config_evaluate) function snd_func_refer returned error: No such device or address
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/conf.c:4663:(snd_config_expand) Evaluate error: No such device or address
ALSA lib /home/Lavanya/2011R1_Release/blackfin-linux-dist_RC3/lib/alsa-lib/alsa-lib-1.0.24/src/pcm/pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.default
Cannot open device::No such device or address
Cannot Init
root:/home>

    I really do not know how to fix the alsa-lib problem....







================================================

 
原文地址:https://www.cnblogs.com/sonictl/p/6735661.html