Skip to content

Getting Started with embARC Using GNU on Linux 2017

Qiang Gu edited this page Feb 22, 2018 · 2 revisions

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 GNU 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 ARC GNU Development Tools

Synopsys's Eclipse IDE with GNU toolchain for ARC Processors can be used for embARC development.

The following steps describe the installation of the Eclipse IDE with GNU Toolchain for ARC 2015.12 (ARC GNU Toolkit) for Linux.

  1. Download the latest release ARC GNU Toolkit from https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases.
  2. The installer archive file name is arc_gnu_2015.12_ide_linux_install.tar.gz. Extract the contents of the archive to the ~/ folder.
  3. Rename the arc_gnu_2015.12_ide_linux_install folder to arc_gnu. Installed Directory Structure
  4. Add the ARC GNU toolkit path into your Linux bash configure file (such as .bashrc): Bash Configure File
  5. Make sure your PATH is set correctly by running arc-elf32-gcc -v to see the version of the ARC GNU Toolkit: PATH is Correct

Building and Running Your First Example

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

The supplied examples use the same source code and makefile in both ARC GNU 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_ROOT>/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 UserUser'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 ARC GNU 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 ARC GNU IDE and use the Workspace Launcher to choose <embARC ROOT>/ide_projects/<emsk_xx>/gnu, where <emsk_xx> stands for the EMSK board version. This example uses EMSK 2.2 with ARC GNU IDE, and the workspace is found under <embARC ROOT>/ide_projects/emsk_22/gnu. 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/gnu subdirectory (for example, /home/user/ARC/embARC/ide_projects/emsk_22/gnu). 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 check the OpenOCD binary path and configuration file path by selecting Debugger > Gdbserver Settings. For example, if you installed ARC GNU toolkit(2015.06 or later) in /home/yourname/arc_gnu/, the selected OpenOCD configuration file is /home/yourname/arc_gnu/share/openocd/scripts/board/snps_em_sk_v1.cfg if you are using EMSK 1.1, or /home/yourname/arc_gnu/share/openocd/scripts/board/snps_em_sk.cfg if you are using EMSK 2.0 or later. Debug Configurations
  3. If you made OpenOCD configuration changes, click Apply.
  4. Click Debug.
  5. Confirm that the Debug perspective opens and that execution has stopped at main().
  6. 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.
  7. Go to your terminal window and confirm that you see the "Powered By embARC" banner and example print messages. Successsful Run
  8. 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.
  9. 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 minicom tool if it is not already installed, you can also use other UART terminal tools such as putty or ckermit. For information on how to use the minicom tool, see How to use Minicom.
  2. Open minicom with UART/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: make BD_VER=22 CUR_CORE=arcem11d TOOLCHAIN=gnu 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: make BD_VER=22 CUR_CORE=arcem11d TOOLCHAIN=gnu -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.
Clone this wiki locally