Getting Started with embARC Using MetaWare on Linux 2017 - foss-for-synopsys-dwc-arc-processors/embarc_osp GitHub Wiki

Note: This page is only available for embARC 2017.03.


The ARC EM Starter Kit is an FPGA-based solution for rapid software development, code porting, software debugging, and profiling, preloaded with images for the ARC EM Family of processors: EM4 and EM6 on EMSK v1.1, EM5D and EM7D on EMSK v2.0 and v2.1, EM9D and EM11D on EMSK v2.2. It can be extended using Digilent® Peripheral Modules (Pmods™).

For Windows® instructions, see Getting Started with embARC Using MetaWare on Windows.

Downloading and Installing

Downloading and Installing the embARC Software

  1. Visit our User Forums section and create an account to access the download location.
  2. Unzip the software to ~/ARC (best) or another location. This step creates a subfolder called embARC. Using the above example, ~/ARC/embARC as <embARC ROOT>.

Note: There should be no whitespace in the path to the embARC location. Whitespace causes problems when you build the examples using the provided makefiles.

Downloading and Installing the MetaWare Development Toolkit

Synopsys's premium toolchain for use with the ARC EM family of processors is the MetaWare Development Toolkit. Licensing information is available from www.synopsys.com.

The following steps describe the installation of MetaWare Development Toolkit K-2015.12 on a Linux host running 64-bit CentOS 7. Other supported linux host distributions are listed in the MetaWare Development Toolkit Release Notes.

  1. Obtain a licensed download of the toolkit from www.synopsys.com.. The installer name is mw_devkit_arc_K_2015_12_linux_x64_install.bin.
  2. The MetaWare tools are 32-bit binaries and require the installation of the following prerequisite 32-bit binaries. Example command for CentOS 7 64-bit host OS: sudo yum install glibc-devel.i686 gtk2-devel.i686 gtk3-devel.i686 ncurses-devel.i686 libXtst-devel.i686 libXtst.i686 libusb1-devel
  3. To install the toolkit, run sh ./mw_devkit_arc_K_2015_12_linux_x64_install.bin, and select the installation destination to the default path. Installing MetaWare on Linux
  4. Make sure your PATH is set correctly by running ccac -v to see the version of Metaware Toolkit: Testing the MetaWare Installation

Downloading and Installing install the Digilent Adept Tools

The Digilent Adept Tools are required to enable JTAG support using the USB cable provided with the EMSK board.

It is important to follow the steps about editing the install scripts to specify i686. The default scripts select 64-bit tools, but the MetaWare debugger is 32-bit. If you do not change the install scripts, you will not be able to connect using Digilent.

  1. Go to store.digilentinc.com.
  2. Download both the Runtime and Utilities archives (32-bit Linux version): digilent.adept.runtime_2.16.1-i686.tar.gz digilent.adept.utilities_2.2.1-i686.tar.gz
  3. Untar the files. The libusb1.0 must be installed before you install the Digilent Adept package. Install it if it is not already installed.
  4. Install the FTDI drivers. Go to digilent.adept.runtime_2.16.1-i686/ftdi.drivers_1.0.4-i686 and follow the instructions contained in the README file. Edit the install.sh script: Change szMname=$(uname -m) to szMname="i686".
  5. Install the Adept runtime. Go to digilent.adept.runtime_2.16.1-i686/ and follow the instructions in the README on how to install. Edit the install.sh script: Change szMname=$(uname -m) to szMname="i686".
  6. Install the Adept utilities. Go to digilent.adept.utilities_2.2.1-i686/ and follow the instructions in the README on how to install. Edit the install.sh script: Change mname=$(uname -m) to mname="i686".
  7. Plug the USB cable into your PC. Note that EMSK v2.2 is used in this example.
  8. Try to enumerate the JTAG devices using the Digilent utilities: djtgcfg enum. The following output is displayed if the driver is installed properly: JTAG Enueration After Installing Digilent Adept Tools

Building and Running Your First Example

This section describes how to build a simple example with the MetaWare Development Toolkit using the ARC EM11D configuration in the EMSK v2.2, in the MetaWare IDE and in command-line mode.

The supplied examples use the same source code and makefile in both MetaWare IDE and command-line mode.

This section uses the Contiki Sensor example project as a tutorial. Other examples follow the same build and run steps. For additional documentation, see ~/embARC/doc/embARC_Document.html in the source-code archive.

This example uses the following components:

  • Contiki OS running on EMSK
  • Pmod temperature sensor and associated device driver
  • GPIO drivers on EMSK

It is also a good simple test to confirm that the temperature sensor module is working and that your debugger connection is working correctly.

Configuring Your EMSK

  1. This example uses the ARC EM11D configuration in EMSK 2.2. If your EMSK board is not already running version 2.2 firmware you need to upgrade the firmware to v2.2 (see the ARC EM Starter Kit User's Guide in the PDF manuals provided the EMSK for detailed instructions).
  2. Connect the EMSK board to your PC using the provided USB cable and select the hardware core configuration to be ARC EM11D using the DIP switches setting on the EMSK.
  3. Press the button above the 'C' character on the board to load the selected ARC EM11D core configuration.

Using the MetaWare IDE

The embARC Software includes a folder called ide_projects containing a subfolder for your EMSK board version (emsk_<xx>). Each version subfolder contains subfolders for the desired toolchain (GNU or MetaWare). Each toolchain subfolder contains a wide range of examples, each in its own folder, with embARC project files and pre-generated build and debug configurations for the example, pre-packaged as an eclipse project.

All IDE projects for EMSK 1.1 are configured to target the ARC EM6 configuration by default. The default configuration for EMSK 2.0 and 2.1 is ARC EM7D. The default configuration for EMSK 2.2 is ARC EM11D.

Importing the Project

  1. Open the MetaWare IDE and use the Workspace Launcher to choose <embARC ROOT>/ide_projects/<emsk_xx>/metaware, where <emsk_xx> stands for the EMSK board version. This example uses EMSK 2.2 with MetaWare IDE, and the workspace is found under <embARC ROOT>/ide_projects/emsk_22/metaware. Selecting a Workspace
  2. Close the Welcome perspective if it appears.
  3. Select File > Import....
  4. Expand General and select Existing Projects into Workspace, then click Next.
  5. Use the Browse button to navigate to the location where you unzipped the embARC distribution and look for the ide_projects/emsk_22/metaware subdirectory (for example, /home/user/ARC/embARC/ide_projects/emsk_22/metaware). The list of embARC example projects appear in the Projects section of the dialog.
  6. Select the example that named emsk_contiki_sensor and click Finish. Importing may take several minutes, so it fastest to only import the desired projects. Importing Projects
  7. Confirm that the emsk_contiki_sensor example project appears in the Project Explorer on the left.

Building the Project

  1. In the Project Explorer, find the emsk_contiki_sensor project in the list.
  2. If the project is closed (small icon showing a closed folder), double-click on the project name to open it.
  3. Right-click on the project name, and select Build Configurations > Set Active> arcem11d. Setting the Active Build Configuration
  4. Right-click emsk_contiki_sensor in the Project Explorer and choose Clean Project.
  5. Click the Console tab at the bottom of the screen to see the build progress.
  6. Right-click emsk_contiki_sensor in the Project Explorer and choose Build Project.

Running the Application

  1. Right-click on the project name, and select Debug Configurations.... The Debug Configurations dialog appears.
  2. Select emsk_contiki_sensor-arcem11d from the list under ARC C/C++ Applications and then click Debug.
  3. Confirm that the Debug perspective opens and that execution has stopped at main().
  4. Click the Resume button (green arrow with yellow bar) on the toolbar to start program execution. You should see messages in the IDE Console view indicating a successful target connection.
  5. Go to your terminal window and confirm that you see the "Powered By embARC" banner and example print messages. Successsful Run
  6. Experiment with the buttons, LEDs, and temperature sensor (touch the sensor with your finger to change the temperature) to confirm that GPIO and the temperature sensor are working. Button 1 is the button labeled 'L,' button 2 is the button labeled 'R,' and button 3 is the button above the 'A' in the ARC logo.
  7. When you are finished, click the red Terminate button on the toolbar and return to the C/C++ perspective.

Using the Command Line

The embARC Software includes a folder called example containing all the source code and makefiles for the embARC example. The EMSK subfolder contains all the available examples for the EMSK board. For the Contiki sensor example, the example folder path is <embARC ROOT>/example/emsk/contiki/sensor. You can build and run the example in command-line mode from inside the subfolder.

Note: For each example, you can use defined make options BOARD, BD_VER, CUR_CORE and TOOLCHAIN to select different board versions, core configurations and development toolchains. For detailed documentation on each make options, refer to the example section of embARC documentation.

Building the Example

  1. Open a Linux terminal, and install the subunit minicom tool if it is not already installed. For information on how to use the minicom tool, see How to use Minicom.
  2. Open minicom with COM port where you connected the USB JTAG cable. minicom Startup Screen
  3. Open another Linux terminal, and cd to the Contiki sensor example folder: <embARC ROOT>/example/emsk/contiki/sensor. Changing to the Sensor Example Folder
  4. Type the following command to build the Contiki sensor example for ARC EM11D on the EMSK v2.2: gmake BD_VER=22 CUR_CORE=arcem11d TOOLCHAIN=mw Build Progress on the Command Line The build progress is displayed.

Running the Application

  1. Type the following command to run the Contiki sensor example in command line: gmake BD_VER=22 CUR_CORE=arcem11d TOOLCHAIN=mw -j4 run The application launches in the terminal, and you see the #Powered By embARC# banner and example print messages. Command-Line Run
  2. Experiment with the buttons, LEDs, and temperature sensor (touch the sensor with your finger to change the temperature) to confirm that GPIO and the temperature sensor are working. Button 1 is the button labeled 'L,' button 2 is the button labeled 'R,' and button 3 is the button above the 'A' in the ARC logo.
  3. When you are finished, press CTRL + c in the terminal where the command is being executed. Enter 'q' and press enter to exit the debugger.
  4. Enter 'q' and press enter to exit the debugger.
⚠️ **GitHub.com Fallback** ⚠️