Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
languagecpp
firstline1
linenumberstrue
#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:

Image Added

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

Code Block
languagebash
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

...