Using Eclipse® with Atmel START Projects

Eclipse® is an open-source integrated development environment (IDE). It can be used as an alternative to the MPLAB® X IDE and Atmel Studio IDEs.

Atmel START projects use the Atmel Studio IDE by default. If you would rather use the Eclipse IDE instead, please follow the instructions provided below.

The following instructions were performed on a Linux® host machine (Mint 18.1), but they are also applicable for Windows® and macOS® operating system software with minor modifications. The Eclipse version used for these instructions is Oxygen 4.7.3. The SAM C21 Xplained Pro Evaluation Kit (ATSAMC21-XPRO) is used as an example target board.


Prerequisites

1

Install the GNU Arm® Embedded Toolchain (gcc-arm-none-eabi).

  • Add the location to your PATH (e.g., in .bashrc).

2

Install and configure the debugger software.

a

For Atmel-ICE or an on-board embedded debugger (e.g., EDGB found on Xplained Pro boards):

  • Compile and install OpenOCD.
  • Git clone https://github.com/ntfreak/openocd.git
    • ./configure —enable-cmsis-dap —enable-jlink –prefix=/opt/tools/{version}
    • make -j && make install
  • Make a udev rule to allow the debugger to be in the plugdev group (e.g., /etc/udev/rules.d/98-cmsis-dap.rules):
    • KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"
  • Restart udev:
    • sudo service udev restart

b

For SEGGER J-Link:

3

Download and install the latest version of Eclipse.
Open Eclipse after installing then go to Help>Check for Updates check for updates.

4

Install the GNU MCU plugin from the Eclipse Marketplace. Go to Help>Marketplace then search for “GNU”. You can also install the EmbSysRegView plugin from the marketplace. This gives you similar functionality to the 'I/O view' in Atmel Studio 7.

There is an install bug present on Oxygen but please read the following to learn more about a workaround for this problem:
https://sourceforge.net/p/embsysregview/bugs/20/

5

Configure the Eclipse global path location.

a

For OpenOCD:

  • Go to Window>Preferences or type 'OpenOCD' in the search box.
  • Select 'Global'.
  • Leave Executable as is if it says 'openocd', otherwise add 'openocd'.
  • For the path, browse to the location where you installed it.
  • Click Apply and Close.

b

For SEGGER J-Link:

  • Go to Window>Preferences or type 'Segger' in the search box.
  • Select “Global”
  • Leave Executable as is if it says 'JlinkGDBServerCLExe', otherwise add 'JlinkGDBServerCLExe'.
  • For the path, browse to the location where you extracted it.
  • Click Apply and Close.

Create a new Atmel START Project (generate the project source files)

Go to http://start.atmel.com to create a new START project. You will create a project from scratch or open an example project:

1

Click on Create New Project to create your own custom project from scratch or click on 'Browse Examples' to open an example project.

2

After configuring your project or opening your selected example, click Export Project (top-right button), then Download Pack.

3

Extract the project somewhere (e.g., Eclipse workspace location).

On Linux with the Firefox browser, there seems to be some kind of problem with START, however, it works fine on Google Chrome.


Create a new Eclipse Project

You will create one of these types of projects:

  • Makefile project
  • Eclipse managed project

For a Makefile project:

1

Go to File>New>Makefile project with the existing code.

2

Enter a name for the project then browse to the location where you extracted downloaded AtmelStart project. Choose ARM Cross GCC for the toolchain.

3

Edit the project properties (go to Project>Properties) and select 'C/C++ Build'.

  • Change the Build Directory location by browsing through 'Workspace' then choose the GCC subdirectory.
    For example:
    ${workspace_loc:/SAMC21-LedFlasher-Makefile/gcc}
  • Click Apply and Close

4

You can now build the project assuming your Arm compiler is present in the system PATH variable.

5

You can debug by configuring the debug settings in Run>Debug Configurations.

  • Double-click on 'GDB OpenOCD Debugging'. This will create a target with the same name as your project.
  • On the 'Debugger tab', the global OpenOCD options previously configured should be filled in. If not, go back to that step and add them as a Workspace option.
  • In the Config options field, add a line to point to the target board script based on the global OpenOCD path location (take a look on your hard drive to see what else is there).
    For example:
    -f ${openocd_path}/../share/openocd/scripts/board/atmel_samc21_xplained_pro.cfg
  • All other options can be left alone.
  • Click 'Debug' and it should download and halt at the first line in your main. You can now step, run, pause, view variables, and etc.

For an Eclipse managed project:

1

File>New>Project>C Project

  • Click Next and choose 'Empty Project' and ARM Cross GCC for the toolchain. Enter a name in the project name field.
  • Click Next, then click Next again. Choose 'Linaro ARMv7 bare metal' for the toolchain and browse to the location where you extracted it with the trailing /bin directory.
    For example:
    /opt/toolchains/gcc-arm-none-eabi-6-2017-q1-update/bin
  • Click Finish.

2

Copy or extract Atmel START code to the new directory in the Eclipse workspace location with the name of your new project.

3

Go to Project > Properties then configure the Project Properties. Reference the gcc/Makefile for all these options and include the directories mentioned below:

  • Select C/C++ Build > Settings and the 'Tool Settings' tab.
    • Target processor>ARM Family>cortex-m0plus (or whatever your target is). You may need to adjust other options in this tab, but for this example leave the rest alone.
    • Optimization > optimize for size (-Os), uncheck everything else and add -ffunction-sections -mlong-calls to the 'Other flags' field.
    • Debugging: make sure -g3 is selected.
  • Select GNU ARM Cross Assembler > Preprocessor > Defined Symbols
    • Add __SAMC21J18A__ and 'DEBUG'. Adjust the part definition based on your target.
  • GNU ARM Cross Assembler > Includes:
    • Look at the Makefile under Compiler Targets and you will see a bunch of -I../xx xx. Those are the include directories you need to add to this field.
    • Click the + symbol and then browse by workspace for each one. The format in the includes field will look like this:
      ${workspace_loc:/${ProjName}/hpl/core}
  • GNU ARM Cross C Compiler:
    • Repeat the exact same steps as the GNU Assembler. You can actually select all the global defines and include items and CTRL+C to copy them and then paste them into the respective fields for the C compiler
  • GNU ARM Cross C Compiler > Optimization:
    • Change Language standard to GNU ISO C99 (-std=gnu99).
  • GNU ARM Cross Linker>General:
    • Add the linker script. Click + and browse by workspace to target/gcc/gcc and chose the flash linker script.
      For example:
      ${workspace_loc:/${ProjName}/samc21/gcc/gcc/samc21j18a_flash.ld}
  • GNU ARM Cross Linker > Libraries:
    • Add m to the 'Libraries' field with the + symbol.
    • Add target/gcc/gcc/ to the search path with the + symbol and browse by workspace.
      For example:
      ${workspace_loc:/${ProjName}/samc21/gcc/gcc}
  • GNU ARM Cross Linker > Miscellaneous:
    • Handle multiple definitions in startup files by adding -z muldefs to 'Other linker flags' field.
    • Click Apply and Close.

You can now build the project and set up debug targets just like in the Makefile instructions.

© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.