Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The parent page described the basic steps to setup the ARM toolchain on eclipse and gdb. In this tutorial we will go deep on the configuration of the ARM toolchain for the TI CC2538 platform.

Requirements

Download and install the following software

  • Latest jlink software from segger (this tutorial used v4.74b).

Download the following files. Will be used during the project configuration.

  • A linker file for CC2538SF53 (download)
  • A startup file for the ARM GNU GCC toolchain (download)

Configuration

  • Create a new project from Eclipse: Select File - New - C Project
  • Choose ARM Cross Target Application - Empty Project
  • Choose the ARM Windows (or Linux) GCC (GNUARM,WinARM)
  • Select a name for the project

In the project properties, configure the project to use the arm-gnu toolchain as described in the parent page.

The special configuration for CC2538 is the following:

go to Linker settings and In General select the path to the linker file (downloaded previously)

Click OK to save the changes.

In your project folder structure add the downloaded files (linker file and startup file) and create a main program containing the following code:

 

#include <stdint.h>
#define GPIO_C_DIR                0x400DB400
#define GPIO_C_DATA               0x400DB000
#define HWREG(x) (*((volatile uint32_t *)(x)))

int main(void)
{
    volatile uint32_t ui32LoopCount;
    volatile uint32_t ui32LoopXV=0;
    // Set direction output and initial value for PC2 and PC0
    // Greed LED on PC2
    // Red LED on PC0
    HWREG(GPIO_C_DIR) |= 0x05;
    HWREG(GPIO_C_DATA + (0x05 << 2)) = 0;
    // Loop forever.
    while(1)
    {
        // Turn on both LED's.
        HWREG(GPIO_C_DATA + (0x05 << 2)) ^= 0x05;
        // Delay for a bit
        for(ui32LoopCount = 200000; ui32LoopCount > 0; ui32LoopCount--)
        {
            ui32LoopXV++;
        }
    }
}

The folder structure should look something like:

Make sure you can compile the code by using the "hammer". The console output should indicate something like that.

13:37:30 **** Incremental Build of configuration Debug for project artest ****
make all 
Invoking: ARM Windows GNU Print Size
arm-none-eabi-size  --format=berkeley artest.elf
   text       data        bss        dec        hex    filename
    824          0        512       1336        538    artest.elf
Finished building: artest.siz
 
13:37:33 Build Finished (took 2s.612ms)

 

Create a Debug Configuration using JTAG and GDB

 

Before starting a Debug configuration we have to make sure that the GDB hardware debug plugin in Eclipse is installed. To install it go to Help - Install New Software

 

 

Before starting a debug configuration GDB server needs to be started. This is a tool provided by Segger and can be started by

Create a Debug Configuration as follows:

Make sure to select the Standard GDB Hardware Debugging Launcher

In the Debugger tab configure the debugger as follow (choose the location of the arm-none-eabi-gdb script)

 

Configure the startup tab as follows:

The code to put in the box is the following one.

target remote localhost:2331
monitor interface jtag
monitor speed 5000
monitor endian little
monitor flash download = 1
monitor flash breakpoints = 1
monitor reset

Click Apply to save the settings and Debug to start the debugging session.

 

 

  • No labels