EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

AT91SAM3U-EK

Started by dasoberdick August 7, 2010
Does anyone have an AT91SAM3U-EK? A simple search for the board on this group did not yield any hits.

I am trying to use Atmel's sample code along side of Jim Lynch's open source development tutorial with the SAM-ICE JTAG programmer but I am unable to properly set up the debugger.

YAGARTO has a sample project for the AT91SAM3U-EK that I am able to debug but I don't understand it well enough to make the more complicated Atmel examples conform to it. After 2 long days of plugging away I still can't figure it out.

It is really hard to find support for this board/chip. Or I am just looking in the wrong spots. Post a question to www.avrfreaks.com and you get about 5 answers within a few hours. Can anyone recommend a better place to post questions?

What's your problem?
Enviado desde mi BlackBerry de Movistar (http://www.movistar.com.ar)

-----Original Message-----
From: "dasoberdick"
Sender: A...
Date: Sun, 08 Aug 2010 02:48:35
To:
Reply-To: A...
Subject: [AT91SAM] AT91SAM3U-EK

Does anyone have an AT91SAM3U-EK? A simple search for the board on this group did not yield any hits.

I am trying to use Atmel's sample code along side of Jim Lynch's open source development tutorial with the SAM-ICE JTAG programmer but I am unable to properly set up the debugger.

YAGARTO has a sample project for the AT91SAM3U-EK that I am able to debug but I don't understand it well enough to make the more complicated Atmel examples conform to it. After 2 long days of plugging away I still can't figure it out.

It is really hard to find support for this board/chip. Or I am just looking in the wrong spots. Post a question to www.avrfreaks.com and you get about 5 answers within a few hours. Can anyone recommend a better place to post questions?
I am able to compile using eclipse but I don't know how to properly set up the debugger. I don't know if the problem is in the make file, the linker script or my gdb commands. I can't really say what my problem is because I don't really understand what is going on yet. If I follow the YAGARTO tutorial using his sample code I can begin a debug session and main.c automatically opens up with a breakpoint at main and I can single step the code. When I use Atmel's code I get an error something along the lines of unable to open source and the program does not appear to be running.

Sorry I cant describe my problem better. All I can describe is what I observe and I know what I observe is not right.

I would be really happy if I could find more documentation that was relative to what I am doing as opposed to sifting through 10 several hundred page docs that apply GNU as a whole.

--- In A..., smorrison49@... wrote:
>
> What's your problem?
> Enviado desde mi BlackBerry de Movistar (http://www.movistar.com.ar)
>
> -----Original Message-----
> From: "dasoberdick"
> Sender: A...
> Date: Sun, 08 Aug 2010 02:48:35
> To:
> Reply-To: A...
> Subject: [AT91SAM] AT91SAM3U-EK
>
> Does anyone have an AT91SAM3U-EK? A simple search for the board on this group did not yield any hits.
>
> I am trying to use Atmel's sample code along side of Jim Lynch's open source development tutorial with the SAM-ICE JTAG programmer but I am unable to properly set up the debugger.
>
> YAGARTO has a sample project for the AT91SAM3U-EK that I am able to debug but I don't understand it well enough to make the more complicated Atmel examples conform to it. After 2 long days of plugging away I still can't figure it out.
>
> It is really hard to find support for this board/chip. Or I am just looking in the wrong spots. Post a question to www.avrfreaks.com and you get about 5 answers within a few hours. Can anyone recommend a better place to post questions?
>

did you enter this kind of commands to work with your debugger?

monitor reset
monitor speed
monitor speed auto
monitor long 0xffffff60 0x00320100
monitor long 0xfffffd44 0xa0008000
monitor long 0xfffffc20 0x00000601
monitor speed 100
monitor long 0xfffffc2c 0x00480a0e
monitor sleep 200
monitor long 0xfffffc30 0x7
monitor sleep 100
monitor long 0xfffffd08 0xa5000401
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
symbol-file main.elf
continue

----- Original Message -----
From: "dasoberdick"
To: A...
Sent: Domingo, 8 de Agosto 2010 0:14:00 (GMT-0300) Auto-Detected
Subject: [AT91SAM] Re: AT91SAM3U-EK

I am able to compile using eclipse but I don't know how to properly set up the debugger. I don't know if the problem is in the make file, the linker script or my gdb commands. I can't really say what my problem is because I don't really understand what is going on yet. If I follow the YAGARTO tutorial using his sample code I can begin a debug session and main.c automatically opens up with a breakpoint at main and I can single step the code. When I use Atmel's code I get an error something along the lines of unable to open source and the program does not appear to be running.

Sorry I cant describe my problem better. All I can describe is what I observe and I know what I observe is not right.

I would be really happy if I could find more documentation that was relative to what I am doing as opposed to sifting through 10 several hundred page docs that apply GNU as a whole.

--- In A... , smorrison49@... wrote:
>
> What's your problem?
> Enviado desde mi BlackBerry de Movistar ( http://www.movistar.com.ar )
>
> -----Original Message-----
> From: "dasoberdick"
> Sender: A...
> Date: Sun, 08 Aug 2010 02:48:35
> To: < A... >
> Reply-To: A...
> Subject: [AT91SAM] AT91SAM3U-EK
>
> Does anyone have an AT91SAM3U-EK? A simple search for the board on this group did not yield any hits.
>
> I am trying to use Atmel's sample code along side of Jim Lynch's open source development tutorial with the SAM-ICE JTAG programmer but I am unable to properly set up the debugger.
>
> YAGARTO has a sample project for the AT91SAM3U-EK that I am able to debug but I don't understand it well enough to make the more complicated Atmel examples conform to it. After 2 long days of plugging away I still can't figure it out.
>
> It is really hard to find support for this board/chip. Or I am just looking in the wrong spots. Post a question to www.avrfreaks.com and you get about 5 answers within a few hours. Can anyone recommend a better place to post questions?
>

more like

#
# This config file was tested with J-Link GDB Server v4.10i
#

# connect to the J-Link gdb server
target remote localhost:2331

# Set gdb server to little endian
monitor endian little

# Set JTAG speed to 5 kHz
monitor speed 5

# Reset the target
monitor reset
monitor sleep 100

# Set JTAG speed in khz
monitor speed auto

# Vector table placed in RAM
monitor writeu32 0xE000ED08 = 0x20000000

load

monitor reg r13 = (0x20000000)
monitor reg pc = (0x20000004)

break ResetException
break main
continue

Which works fine with the YAGARTO project available here

http://yagarto.de/howto/examples/index.html

Atmel includes a script with the sample project which doesn't seem to work either. I gave up on this one because I have seen the above work but not this one

#*************************************************
#
# Connect to J-Link and debug application in sram on SAM3U
#
# Note:
# First,users should do Step1 and Step2 according to your project,
# then do Step3.

# Step1: Connect to the J-Link gdb server
target remote localhost:2331
mon reset

# Step2: Load file(eg. getting-started project)
load bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
symbol-file bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf

# Step3: Initializing PC and stack pointer
# Perpheral reset RSTC_CR
set *0x400e1200 = 0xA5000004
# Modify pc value to even before writing pc register
mon reg sp=(0x20000000)
set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
I read somewhere that the "monitor" command was for openOCD which I don't believe I am using. If I have SAM-ICE I don't need openOCD right? I haven't really been able to find detailed documentation about how all this stuff works. What documentation do I need to look at to figure out what all those commands do. If I run arm-none-eabi-gdb and get to the GDB prompt, help gives lots of useful information which leads me to believe that I need to look at the GDB docs but it is hard for me to figure out what is relevant to the processor.

Here is my makefile as well. Forgive me if this is too much information but I believe the problem may be I am not properly generating the information required by the debugger. The YAGARTO project that works generates a hex file which I am able to load with GDB and eclipse manages to tell me exactly where I am at within the C code. The Atmel project generates a binary file which I am able to load with SAM-BA no problem but it seems a little suspect to me when it comes to using GDB (only because the other project generates a hex file AND works). I sure wish I understood under what conditions I use a hex and what conditions I use a binary. Anyways here is the makefile

# ----
# ATMEL Microcontroller Software Support
# ----
# Copyright (c) 2008, Atmel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the disclaimer below.
#
# Atmel's name may not be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----

# Makefile for compiling basic-pwm2-project

#-------
# User-modifiable options
#-------

# Chip & board used for compilation
# (can be overriden by adding CHIP=chip and BOARD=board to the command-line)
CHIP = at91sam3u4
BOARD = at91sam3u-ek

# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
# TRACE_LEVEL_DEBUG 5
# TRACE_LEVEL_INFO 4
# TRACE_LEVEL_WARNING 3
# TRACE_LEVEL_ERROR 2
# TRACE_LEVEL_FATAL 1
# TRACE_LEVEL_NO_TRACE 0
TRACE_LEVEL = 4

# Optimization level, put in comment for debugging
OPTIMIZATION = -Os

# AT91 library directory
AT91LIB = ./at91lib

# External library
EXT_LIBS= ./external_libs

# Output file basename
OUTPUT = basic-pwm2-project-$(BOARD)-$(CHIP)

# Compile with chip specific features
include $(AT91LIB)/boards/$(BOARD)/$(CHIP)/chip.mak

# Compile for all memories available on the board (this sets $(MEMORIES))
include $(AT91LIB)/boards/$(BOARD)/board.mak

# Output directories
BIN = bin
OBJ = obj

#-------
# Tools
#-------

# Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi-

# Compilation tools
CC = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy

# Flags
INCLUDES += -I$(AT91LIB)/boards/$(BOARD)
INCLUDES += -I$(AT91LIB)/peripherals
INCLUDES += -I$(AT91LIB)/components
INCLUDES += -I$(AT91LIB)
INCLUDES += -I$(EXT_LIBS)

ifeq ($(CHIP_CORE), cortexm3)
TARGET_OPTS = -mcpu=cortex-m3 -mthumb
else
TARGET_OPTS endif

CFLAGS += $(TARGET_OPTS)
CFLAGS += -Wall -mlong-calls -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = $(TARGET_OPTS) -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -g $(OPTIMIZATION) -nostartfiles $(TARGET_OPTS) -Wl,--gc-sections

#-------
# Files
#-------

# Directories where source files can be found
PERIPH = $(AT91LIB)/peripherals
BOARDS = $(AT91LIB)/boards
UTILITY = $(AT91LIB)/utility

VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu
VPATH += $(PERIPH)/pio
VPATH += $(PERIPH)/pwmc
VPATH += $(PERIPH)/irq
VPATH += $(PERIPH)/pmc
VPATH += $(PERIPH)/cp15
VPATH += $(BOARDS)/$(BOARD)
VPATH += $(BOARDS)/$(BOARD)/$(CHIP)
VPATH += $(EXT_LIBS)/cmsis

# Objects built from C source files
C_OBJECTS += main.o
C_OBJECTS += stdio.o
C_OBJECTS += dbgu.o
C_OBJECTS += pio.o
C_OBJECTS += pwmc2.o
C_OBJECTS += pmc.o
C_OBJECTS += board_memories.o
C_OBJECTS += board_lowlevel.o
C_OBJECTS += trace.o

# Objects for different chips
ifeq ($(CHIP_CORE), cortexm3)
C_OBJECTS += nvic.o
C_OBJECTS += exceptions.o
C_OBJECTS += board_cstartup_gnu.o
C_OBJECTS += core_cm3.o
else
C_OBJECTS += aic.o
C_OBJECTS += cp15.o
endif

# Objects built from Assembly source files
ifneq ($(CHIP_CORE), cortexm3)
ASM_OBJECTS += board_cstartup.o
ASM_OBJECTS += cp15_asm.o
endif

# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT)

#-------
# Rules
#-------

all: $(BIN) $(OBJ) $(MEMORIES)

$(BIN) $(OBJ):
mkdir $@

define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))

$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$@.lds" -o $(OUTPUT)-$$@.elf $$^
$(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
$(SIZE) $$^ $(OUTPUT)-$$@.elf

$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<

$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<

debug_$(1): $(1)
perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf

endef

$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))

clean:
-rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf
And for the sake of being complete here is the YAGARTO makefile

#
# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!!
#
##############################################################################################
#
# On command line:
#
# make all = Create project
#
# make clean = Clean project files.
#
# To rebuild project do "make clean" and "make all".
#

##############################################################################################
# Start of default section
#

TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
BIN = $(CP) -O ihex

MCU = cortex-m3

# List all default C defines here, like -D_DEBUG=1
DDEFS
# List all default ASM defines here, like -D_DEBUG=1
DADEFS
# List all default directories to look for include files here
DINCDIR
# List the default directory to look for the libraries here
DLIBDIR
# List all default libraries here
DLIBS
#
# End of default section
##############################################################################################

##############################################################################################
# Start of user section
#

# Define project name here
PROJECT = test

# Define linker script file here
LDSCRIPT_RAM = ./prj/sam3u4e_ram.ld

# List all user C define here, like -D_DEBUG=1
UDEFS
# Define ASM defines here
UADEFS
# List C source files here
SRC = ./src/main.c \
./src/startup.c \
./src/vectors.c

# List ASM source files here
ASRC
# List all user directories here
UINCDIR = ./inc

# List the user directory to look for the libraries here
ULIBDIR
# List all user libraries here
ULIBS
# Define optimisation level here
OPT = -O0

#
# End of user defines
##############################################################################################
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)

ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
LDFLAGS_RAM = $(MCFLAGS) -mthumb -nostartfiles -T$(LDSCRIPT_RAM) -Wl,-Map=$(PROJECT)_ram.map,--cref,--no-warn-mismatch $(LIBDIR)

# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d

#
# makefile rules
#

all: RAM

RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex

%o : %c
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@

%o : %s
$(AS) -c $(ASFLAGS) $< -o $@

%ram.elf: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@

%hex: %elf
$(BIN) $< $@

clean:
-rm -f $(OBJS)
-rm -f $(PROJECT)_ram.elf
-rm -f $(PROJECT)_ram.map
-rm -f $(PROJECT)_ram.hex
-rm -f $(SRC:.c=.c.bak)
-rm -f $(SRC:.c=.lst)
-rm -f $(ASRC:.s=.s.bak)
-rm -f $(ASRC:.s=.lst)
-rm -fR .dep

#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

# *** EOF ***

Well if you made it this far then I really appreciate it. I just want to get to the point where I can use all of the Atmel libraries and drivers AND use Eclipse to debug. I have IAR at work but this has become something that I just want to understand for the sake of understanding. I know it will make me a better engineer.

Hello,

DO you have programmed any other devices of the ARM type before? As far as I
remember, the SAM3U is a cortex device, and is quite capable and has lots of
potential and high data rate. I would recommend to use a simpler device like the
SAM7X, because if you are looking for how to do things and how to figure out the
things work, debuggers, etc. then you need to use really simple devices so you
can find the related information easily, SAM3U is really new and so there are so
few articles about it.
Rgds.

________________________________
From: dasoberdick
To: A...
Sent: Sun, August 8, 2010 9:53:00 AM
Subject: [AT91SAM] Re: AT91SAM3U-EK

more like

#
# This config file was tested with J-Link GDB Server v4.10i
#

# connect to the J-Link gdb server
target remote localhost:2331

# Set gdb server to little endian
monitor endian little

# Set JTAG speed to 5 kHz
monitor speed 5

# Reset the target
monitor reset
monitor sleep 100

# Set JTAG speed in khz
monitor speed auto

# Vector table placed in RAM
monitor writeu32 0xE000ED08 = 0x20000000

load

monitor reg r13 = (0x20000000)
monitor reg pc = (0x20000004)

break ResetException
break main
continue

Which works fine with the YAGARTO project available here

http://yagarto.de/howto/examples/index.html

Atmel includes a script with the sample project which doesn't seem to work
either. I gave up on this one because I have seen the above work but not this
one

#*************************************************
#
# Connect to J-Link and debug application in sram on SAM3U
#
# Note:
# First,users should do Step1 and Step2 according to your project,
# then do Step3.

# Step1: Connect to the J-Link gdb server
target remote localhost:2331
mon reset

# Step2: Load file(eg. getting-started project)
load bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
symbol-file bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf

# Step3: Initializing PC and stack pointer
# Perpheral reset RSTC_CR
set *0x400e1200 = 0xA5000004
# Modify pc value to even before writing pc register
mon reg sp=(0x20000000)
set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)

I read somewhere that the "monitor" command was for openOCD which I don't
believe I am using. If I have SAM-ICE I don't need openOCD right? I haven't
really been able to find detailed documentation about how all this stuff works.
What documentation do I need to look at to figure out what all those commands
do. If I run arm-none-eabi-gdb and get to the GDB prompt, help gives lots of
useful information which leads me to believe that I need to look at the GDB docs
but it is hard for me to figure out what is relevant to the processor.

Here is my makefile as well. Forgive me if this is too much information but I
believe the problem may be I am not properly generating the information required
by the debugger. The YAGARTO project that works generates a hex file which I am
able to load with GDB and eclipse manages to tell me exactly where I am at
within the C code. The Atmel project generates a binary file which I am able to
load with SAM-BA no problem but it seems a little suspect to me when it comes to
using GDB (only because the other project generates a hex file AND works). I
sure wish I understood under what conditions I use a hex and what conditions I
use a binary. Anyways here is the makefile

# ----------------------
# ATMEL Microcontroller Software Support
# ----------------------
# Copyright (c) 2008, Atmel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the disclaimer below.
#
# Atmel's name may not be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ----------------------

# Makefile for compiling basic-pwm2-project

#----------------------
# User-modifiable options
#----------------------

# Chip & board used for compilation
# (can be overriden by adding CHIP=chip and BOARD=board to the command-line)
CHIP = at91sam3u4
BOARD = at91sam3u-ek

# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
# TRACE_LEVEL_DEBUG 5
# TRACE_LEVEL_INFO 4
# TRACE_LEVEL_WARNING 3
# TRACE_LEVEL_ERROR 2
# TRACE_LEVEL_FATAL 1
# TRACE_LEVEL_NO_TRACE 0
TRACE_LEVEL = 4

# Optimization level, put in comment for debugging
OPTIMIZATION = -Os

# AT91 library directory
AT91LIB = ./at91lib

# External library
EXT_LIBS= ./external_libs

# Output file basename
OUTPUT = basic-pwm2-project-$(BOARD)-$(CHIP)

# Compile with chip specific features
include $(AT91LIB)/boards/$(BOARD)/$(CHIP)/chip.mak

# Compile for all memories available on the board (this sets $(MEMORIES))
include $(AT91LIB)/boards/$(BOARD)/board.mak

# Output directories
BIN = bin
OBJ = obj

#----------------------
# Tools
#----------------------

# Tool suffix when cross-compiling
CROSS_COMPILE = arm-none-eabi-

# Compilation tools
CC = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy

# Flags
INCLUDES += -I$(AT91LIB)/boards/$(BOARD)
INCLUDES += -I$(AT91LIB)/peripherals
INCLUDES += -I$(AT91LIB)/components
INCLUDES += -I$(AT91LIB)
INCLUDES += -I$(EXT_LIBS)

ifeq ($(CHIP_CORE), cortexm3)
TARGET_OPTS = -mcpu=cortex-m3 -mthumb
else
TARGET_OPTS endif

CFLAGS += $(TARGET_OPTS)
CFLAGS += -Wall -mlong-calls -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = $(TARGET_OPTS) -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
-D__ASSEMBLY__
LDFLAGS = -g $(OPTIMIZATION) -nostartfiles $(TARGET_OPTS) -Wl,--gc-sections

#----------------------
# Files
#----------------------

# Directories where source files can be found
PERIPH = $(AT91LIB)/peripherals
BOARDS = $(AT91LIB)/boards
UTILITY = $(AT91LIB)/utility

VPATH += $(UTILITY)
VPATH += $(PERIPH)/dbgu
VPATH += $(PERIPH)/pio
VPATH += $(PERIPH)/pwmc
VPATH += $(PERIPH)/irq
VPATH += $(PERIPH)/pmc
VPATH += $(PERIPH)/cp15
VPATH += $(BOARDS)/$(BOARD)
VPATH += $(BOARDS)/$(BOARD)/$(CHIP)
VPATH += $(EXT_LIBS)/cmsis

# Objects built from C source files
C_OBJECTS += main.o
C_OBJECTS += stdio.o
C_OBJECTS += dbgu.o
C_OBJECTS += pio.o
C_OBJECTS += pwmc2.o
C_OBJECTS += pmc.o
C_OBJECTS += board_memories.o
C_OBJECTS += board_lowlevel.o
C_OBJECTS += trace.o

# Objects for different chips
ifeq ($(CHIP_CORE), cortexm3)
C_OBJECTS += nvic.o
C_OBJECTS += exceptions.o
C_OBJECTS += board_cstartup_gnu.o
C_OBJECTS += core_cm3.o
else
C_OBJECTS += aic.o
C_OBJECTS += cp15.o
endif

# Objects built from Assembly source files
ifneq ($(CHIP_CORE), cortexm3)
ASM_OBJECTS += board_cstartup.o
ASM_OBJECTS += cp15_asm.o
endif

# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT)

#----------------------
# Rules
#----------------------

all: $(BIN) $(OBJ) $(MEMORIES)

$(BIN) $(OBJ):
mkdir $@

define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))

$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$@.lds" -o
$(OUTPUT)-$$@.elf $$^
$(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
$(SIZE) $$^ $(OUTPUT)-$$@.elf

$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<

$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<

debug_$(1): $(1)
perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf

endef

$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))

clean:
-rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf

And for the sake of being complete here is the YAGARTO makefile

#
# !!!! Do NOT edit this makefile with an editor which replace tabs by
spaces !!!!

#
##############################################################################################

#
# On command line:
#
# make all = Create project
#
# make clean = Clean project files.
#
# To rebuild project do "make clean" and "make all".
#

##############################################################################################

# Start of default section
#

TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
BIN = $(CP) -O ihex

MCU = cortex-m3

# List all default C defines here, like -D_DEBUG=1
DDEFS
# List all default ASM defines here, like -D_DEBUG=1
DADEFS
# List all default directories to look for include files here
DINCDIR
# List the default directory to look for the libraries here
DLIBDIR
# List all default libraries here
DLIBS
#
# End of default section
##############################################################################################
##############################################################################################

# Start of user section
#

# Define project name here
PROJECT = test

# Define linker script file here
LDSCRIPT_RAM = ./prj/sam3u4e_ram.ld

# List all user C define here, like -D_DEBUG=1
UDEFS
# Define ASM defines here
UADEFS
# List C source files here
SRC = ./src/main.c \
./src/startup.c \
./src/vectors.c

# List ASM source files here
ASRC
# List all user directories here
UINCDIR = ./inc

# List the user directory to look for the libraries here
ULIBDIR
# List all user libraries here
ULIBS
# Define optimisation level here
OPT = -O0

#
# End of user defines
##############################################################################################
INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
LIBS = $(DLIBS) $(ULIBS)
MCFLAGS = -mcpu=$(MCU)

ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb -fomit-frame-pointer -Wall
-Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
LDFLAGS_RAM = $(MCFLAGS) -mthumb -nostartfiles -T$(LDSCRIPT_RAM)
-Wl,-Map=$(PROJECT)_ram.map,--cref,--no-warn-mismatch $(LIBDIR)

# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d

#
# makefile rules
#

all: RAM

RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex

%o : %c
$(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@

%o : %s
$(AS) -c $(ASFLAGS) $< -o $@

%ram.elf: $(OBJS)
$(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@

%hex: %elf
$(BIN) $< $@

clean:
-rm -f $(OBJS)
-rm -f $(PROJECT)_ram.elf
-rm -f $(PROJECT)_ram.map
-rm -f $(PROJECT)_ram.hex
-rm -f $(SRC:.c=.c.bak)
-rm -f $(SRC:.c=.lst)
-rm -f $(ASRC:.s=.s.bak)
-rm -f $(ASRC:.s=.lst)
-rm -fR .dep

#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

# *** EOF ***

Well if you made it this far then I really appreciate it. I just want to get to
the point where I can use all of the Atmel libraries and drivers AND use Eclipse
to debug. I have IAR at work but this has become something that I just want to
understand for the sake of understanding. I know it will make me a better
engineer.
I started with an AT91SAM7S256-EK using the same tutorial. There really isn't much difference between the two devices when it comes to the set up of the tool chain. I was able to get everything to work for the SAM3U based upon the YAGARTO tutorial. But the tutorial does not explain things well enough for me to be able to duplicate it. Even when I was using the simpler SAM7S256 I did not understand a lot of what as going on and I had the same difficulties in finding basic explanations. You could tell me Harry Potter lived inside the chip and I would believe you (OK not really but it still feels like magic).

I still believe my problem is in the Makefile and I am not properly generating the information required by the debugger. The confusing part is that the project that does not work appears to be generating a lot more information than the project that does work.

For instance eclipse has a little [+] or [-] box next to the .elf file which allows me to see all the of the files that go into it (i.e. all the .h and .c files) for the project that does not work while the project that does work does not allow me to peak inside the .elf file.

I hope that made sense...

Even if someone doesn't know the answer I would appreciate someone telling me a good place to look or good documents to read.

Thank you,

Ryan

--- In A..., Maziar Tasbihi wrote:
>
> Hello,
>
> DO you have programmed any other devices of the ARM type before? As far as I
> remember, the SAM3U is a cortex device, and is quite capable and has lots of
> potential and high data rate. I would recommend to use a simpler device like the
> SAM7X, because if you are looking for how to do things and how to figure out the
> things work, debuggers, etc. then you need to use really simple devices so you
> can find the related information easily, SAM3U is really new and so there are so
> few articles about it.
> Rgds.
>
> ________________________________
> From: dasoberdick
> To: A...
> Sent: Sun, August 8, 2010 9:53:00 AM
> Subject: [AT91SAM] Re: AT91SAM3U-EK
>
>
> more like
>
> #
> # This config file was tested with J-Link GDB Server v4.10i
> #
>
> # connect to the J-Link gdb server
> target remote localhost:2331
>
> # Set gdb server to little endian
> monitor endian little
>
> # Set JTAG speed to 5 kHz
> monitor speed 5
>
> # Reset the target
> monitor reset
> monitor sleep 100
>
> # Set JTAG speed in khz
> monitor speed auto
>
> # Vector table placed in RAM
> monitor writeu32 0xE000ED08 = 0x20000000
>
> load
>
> monitor reg r13 = (0x20000000)
> monitor reg pc = (0x20000004)
>
> break ResetException
> break main
> continue
>
> Which works fine with the YAGARTO project available here
>
> http://yagarto.de/howto/examples/index.html
>
> Atmel includes a script with the sample project which doesn't seem to work
> either. I gave up on this one because I have seen the above work but not this
> one
>
> #*************************************************
> #
> # Connect to J-Link and debug application in sram on SAM3U
> #
> # Note:
> # First,users should do Step1 and Step2 according to your project,
> # then do Step3.
>
> # Step1: Connect to the J-Link gdb server
> target remote localhost:2331
> mon reset
>
> # Step2: Load file(eg. getting-started project)
> load bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
> symbol-file bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
>
> # Step3: Initializing PC and stack pointer
> # Perpheral reset RSTC_CR
> set *0x400e1200 = 0xA5000004
> # Modify pc value to even before writing pc register
> mon reg sp=(0x20000000)
> set *0x20000004 = *0x20000004 & 0xFFFFFFFE
> mon reg pc=(0x20000004)
>
> I read somewhere that the "monitor" command was for openOCD which I don't
> believe I am using. If I have SAM-ICE I don't need openOCD right? I haven't
> really been able to find detailed documentation about how all this stuff works.
> What documentation do I need to look at to figure out what all those commands
> do. If I run arm-none-eabi-gdb and get to the GDB prompt, help gives lots of
> useful information which leads me to believe that I need to look at the GDB docs
> but it is hard for me to figure out what is relevant to the processor.
>
> Here is my makefile as well. Forgive me if this is too much information but I
> believe the problem may be I am not properly generating the information required
> by the debugger. The YAGARTO project that works generates a hex file which I am
> able to load with GDB and eclipse manages to tell me exactly where I am at
> within the C code. The Atmel project generates a binary file which I am able to
> load with SAM-BA no problem but it seems a little suspect to me when it comes to
> using GDB (only because the other project generates a hex file AND works). I
> sure wish I understood under what conditions I use a hex and what conditions I
> use a binary. Anyways here is the makefile
>
> # ----------------------
> # ATMEL Microcontroller Software Support
> # ----------------------
> # Copyright (c) 2008, Atmel Corporation
> #
> # All rights reserved.
> #
> # Redistribution and use in source and binary forms, with or without
> # modification, are permitted provided that the following conditions are met:
> #
> # - Redistributions of source code must retain the above copyright notice,
> # this list of conditions and the disclaimer below.
> #
> # Atmel's name may not be used to endorse or promote products derived from
> # this software without specific prior written permission.
> #
> # DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
> # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
> # DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
> # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
> # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
> # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> # ----------------------
>
> # Makefile for compiling basic-pwm2-project
>
> #----------------------
> # User-modifiable options
> #----------------------
>
> # Chip & board used for compilation
> # (can be overriden by adding CHIP=chip and BOARD=board to the command-line)
> CHIP = at91sam3u4
> BOARD = at91sam3u-ek
>
> # Trace level used for compilation
> # (can be overriden by adding TRACE_LEVEL=#number to the command-line)
> # TRACE_LEVEL_DEBUG 5
> # TRACE_LEVEL_INFO 4
> # TRACE_LEVEL_WARNING 3
> # TRACE_LEVEL_ERROR 2
> # TRACE_LEVEL_FATAL 1
> # TRACE_LEVEL_NO_TRACE 0
> TRACE_LEVEL = 4
>
> # Optimization level, put in comment for debugging
> OPTIMIZATION = -Os
>
> # AT91 library directory
> AT91LIB = ./at91lib
>
> # External library
> EXT_LIBS= ./external_libs
>
> # Output file basename
> OUTPUT = basic-pwm2-project-$(BOARD)-$(CHIP)
>
> # Compile with chip specific features
> include $(AT91LIB)/boards/$(BOARD)/$(CHIP)/chip.mak
>
> # Compile for all memories available on the board (this sets $(MEMORIES))
> include $(AT91LIB)/boards/$(BOARD)/board.mak
>
> # Output directories
> BIN = bin
> OBJ = obj
>
> #----------------------
> # Tools
> #----------------------
>
> # Tool suffix when cross-compiling
> CROSS_COMPILE = arm-none-eabi-
>
> # Compilation tools
> CC = $(CROSS_COMPILE)gcc
> SIZE = $(CROSS_COMPILE)size
> STRIP = $(CROSS_COMPILE)strip
> OBJCOPY = $(CROSS_COMPILE)objcopy
>
> # Flags
> INCLUDES += -I$(AT91LIB)/boards/$(BOARD)
> INCLUDES += -I$(AT91LIB)/peripherals
> INCLUDES += -I$(AT91LIB)/components
> INCLUDES += -I$(AT91LIB)
> INCLUDES += -I$(EXT_LIBS)
>
> ifeq ($(CHIP_CORE), cortexm3)
> TARGET_OPTS = -mcpu=cortex-m3 -mthumb
> else
> TARGET_OPTS > endif
>
> CFLAGS += $(TARGET_OPTS)
> CFLAGS += -Wall -mlong-calls -ffunction-sections
> CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL)
> ASFLAGS = $(TARGET_OPTS) -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
> -D__ASSEMBLY__
> LDFLAGS = -g $(OPTIMIZATION) -nostartfiles $(TARGET_OPTS) -Wl,--gc-sections
>
> #----------------------
> # Files
> #----------------------
>
> # Directories where source files can be found
> PERIPH = $(AT91LIB)/peripherals
> BOARDS = $(AT91LIB)/boards
> UTILITY = $(AT91LIB)/utility
>
> VPATH += $(UTILITY)
> VPATH += $(PERIPH)/dbgu
> VPATH += $(PERIPH)/pio
> VPATH += $(PERIPH)/pwmc
> VPATH += $(PERIPH)/irq
> VPATH += $(PERIPH)/pmc
> VPATH += $(PERIPH)/cp15
> VPATH += $(BOARDS)/$(BOARD)
> VPATH += $(BOARDS)/$(BOARD)/$(CHIP)
> VPATH += $(EXT_LIBS)/cmsis
>
> # Objects built from C source files
> C_OBJECTS += main.o
> C_OBJECTS += stdio.o
> C_OBJECTS += dbgu.o
> C_OBJECTS += pio.o
> C_OBJECTS += pwmc2.o
> C_OBJECTS += pmc.o
> C_OBJECTS += board_memories.o
> C_OBJECTS += board_lowlevel.o
> C_OBJECTS += trace.o
>
> # Objects for different chips
> ifeq ($(CHIP_CORE), cortexm3)
> C_OBJECTS += nvic.o
> C_OBJECTS += exceptions.o
> C_OBJECTS += board_cstartup_gnu.o
> C_OBJECTS += core_cm3.o
> else
> C_OBJECTS += aic.o
> C_OBJECTS += cp15.o
> endif
>
> # Objects built from Assembly source files
> ifneq ($(CHIP_CORE), cortexm3)
> ASM_OBJECTS += board_cstartup.o
> ASM_OBJECTS += cp15_asm.o
> endif
>
> # Append OBJ and BIN directories to output filename
> OUTPUT := $(BIN)/$(OUTPUT)
>
> #----------------------
> # Rules
> #----------------------
>
> all: $(BIN) $(OBJ) $(MEMORIES)
>
> $(BIN) $(OBJ):
> mkdir $@
>
> define RULES
> C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
> ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
>
> $(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
> $(CC) $(LDFLAGS) -T"$(AT91LIB)/boards/$(BOARD)/$(CHIP)/$$@.lds" -o
> $(OUTPUT)-$$@.elf $$^
> $(OBJCOPY) -O binary $(OUTPUT)-$$@.elf $(OUTPUT)-$$@.bin
> $(SIZE) $$^ $(OUTPUT)-$$@.elf
>
> $$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
> $(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<
>
> $$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
> $(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<
>
> debug_$(1): $(1)
> perl ../resources/gdb/debug.pl $(OUTPUT)-$(1).elf
>
> endef
>
> $(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))
>
> clean:
> -rm -f $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf
>
> And for the sake of being complete here is the YAGARTO makefile
>
> #
> # !!!! Do NOT edit this makefile with an editor which replace tabs by
> spaces !!!!
>
> #
> ##############################################################################################
>
> #
> # On command line:
> #
> # make all = Create project
> #
> # make clean = Clean project files.
> #
> # To rebuild project do "make clean" and "make all".
> #
>
> ##############################################################################################
>
> # Start of default section
> #
>
> TRGT = arm-none-eabi-
> CC = $(TRGT)gcc
> CP = $(TRGT)objcopy
> AS = $(TRGT)gcc -x assembler-with-cpp
> BIN = $(CP) -O ihex
>
> MCU = cortex-m3
>
> # List all default C defines here, like -D_DEBUG=1
> DDEFS >
> # List all default ASM defines here, like -D_DEBUG=1
> DADEFS >
> # List all default directories to look for include files here
> DINCDIR >
> # List the default directory to look for the libraries here
> DLIBDIR >
> # List all default libraries here
> DLIBS >
> #
> # End of default section
> ##############################################################################################
> ##############################################################################################
>
> # Start of user section
> #
>
> # Define project name here
> PROJECT = test
>
> # Define linker script file here
> LDSCRIPT_RAM = ./prj/sam3u4e_ram.ld
>
> # List all user C define here, like -D_DEBUG=1
> UDEFS >
> # Define ASM defines here
> UADEFS >
> # List C source files here
> SRC = ./src/main.c \
> ./src/startup.c \
> ./src/vectors.c
>
> # List ASM source files here
> ASRC >
> # List all user directories here
> UINCDIR = ./inc
>
> # List the user directory to look for the libraries here
> ULIBDIR >
> # List all user libraries here
> ULIBS >
> # Define optimisation level here
> OPT = -O0
>
> #
> # End of user defines
> ##############################################################################################
> INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
> LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
> DEFS = $(DDEFS) $(UDEFS)
> ADEFS = $(DADEFS) $(UADEFS)
> OBJS = $(ASRC:.s=.o) $(SRC:.c=.o)
> LIBS = $(DLIBS) $(ULIBS)
> MCFLAGS = -mcpu=$(MCU)
>
> ASFLAGS = $(MCFLAGS) -g -gdwarf-2 -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
> CPFLAGS = $(MCFLAGS) $(OPT) -gdwarf-2 -mthumb -fomit-frame-pointer -Wall
> -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
> LDFLAGS_RAM = $(MCFLAGS) -mthumb -nostartfiles -T$(LDSCRIPT_RAM)
> -Wl,-Map=$(PROJECT)_ram.map,--cref,--no-warn-mismatch $(LIBDIR)
>
> # Generate dependency information
> CPFLAGS += -MD -MP -MF .dep/$(@F).d
>
> #
> # makefile rules
> #
>
> all: RAM
>
> RAM: $(OBJS) $(PROJECT)_ram.elf $(PROJECT)_ram.hex
>
> %o : %c
> $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@
>
> %o : %s
> $(AS) -c $(ASFLAGS) $< -o $@
>
> %ram.elf: $(OBJS)
> $(CC) $(OBJS) $(LDFLAGS_RAM) $(LIBS) -o $@
>
> %hex: %elf
> $(BIN) $< $@
>
> clean:
> -rm -f $(OBJS)
> -rm -f $(PROJECT)_ram.elf
> -rm -f $(PROJECT)_ram.map
> -rm -f $(PROJECT)_ram.hex
> -rm -f $(SRC:.c=.c.bak)
> -rm -f $(SRC:.c=.lst)
> -rm -f $(ASRC:.s=.s.bak)
> -rm -f $(ASRC:.s=.lst)
> -rm -fR .dep
>
> #
> # Include the dependency files, should be the last of the makefile
> #
> -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
>
> # *** EOF ***
>
> Well if you made it this far then I really appreciate it. I just want to get to
> the point where I can use all of the Atmel libraries and drivers AND use Eclipse
> to debug. I have IAR at work but this has become something that I just want to
> understand for the sake of understanding. I know it will make me a better
> engineer.
>


The 2024 Embedded Online Conference