Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Map files and .d79 files for Atmel AT91SAM7
PostPosted: Tue Nov 29, 2011 12:32 am 
Offline

Joined: Mon Nov 28, 2011 7:58 am
Posts: 5
Hi,
Some questions concerning build output files for Atmel AT91SAM7, using IAR workbench. I am working on a project that someone else put together, and I see that when I do a build, I get a .bin file and .d79 file, but no map file.

1. What does a .d79 file contain?
2. Is there a way to generate a map file from a .d79 file or .bin file? (I am also playing with the makefile to see if I can generate one in the meantime.)

Thanks in advance!
Will


Top
 Profile  
 
 Post subject: Re: Map files and .d79 files for Atmel AT91SAM7
PostPosted: Tue Nov 29, 2011 1:21 am 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
What version of IAR you using? Commercial/Evaluation?

The D79 is an object file (ie binary code + metadata + symbols).

The compiler/linker should be able to output MAP and LST type file based on the output options selected within the project.

Suggest you read through the documentation for the compiler/linker.


Top
 Profile  
 
 Post subject: Re: Map files and .d79 files for Atmel AT91SAM7
PostPosted: Wed Nov 30, 2011 4:44 am 
Offline

Joined: Mon Nov 28, 2011 7:58 am
Posts: 5
I am using the commercial version (4.40A (4.40.1.501)) on our own hardware (no development kit). I'm going through the makefiles- it's not obvious for me (see below). If there is a tool to convert a .d79 file to a map file, then that would be cool.

Thanks,
Will

Makefile:
##############################################################################
# CONFIGURATION #
##############################################################################
# NOTE - environment variables BOARD and CPU must be defined

# name of APPutable
APP = rsm

##############################################################################
# TOOLS #
##############################################################################

# C pre-processor used mainly in dependency generation
CPP = "../BuildTools/cpp.exe"
SED = "../BuildTools/sed.exe"
RM = "../BuildTools/rm.exe" -f
CP = "../BuildTools/cp.exe"
MV = "../BuildTools/mv.exe"
MKDIR = "../BuildTools/mkdir.exe" --parents
TOUCH = "../BuildTools/touch.exe"

# NOTE CC etc are in the platform specific section

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

# list of source and include directories
LIB = ../lib

FREERTOS = ../lib/FreeRTOS/Source

RTOSSRC = $(FREERTOS) \
$(FREERTOS)/portable/MemMang \
$(RTOSPORTSRC)

RTOSINC = $(FREERTOS)/include $(TOOLCHAININC)

include $(LIB)/$(BOARD)/$(TOOLCHAIN)/Makefile

# directories of all the sources
SOURCES = $(LIB)/$(CPU) \
$(LIB)/$(BOARD)/$(TOOLCHAIN) \
$(LIB)/$(BOARD) \
$(LIB) \
$(BOARD)/$(TOOLCHAIN) \
$(BOARD) \
. \
$(RTOSSRC)

RELEASE = ../../../Release/Sam7

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

# upto 2 executables supported
EXEC = ../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)/$(APP).$(EXEEXT)
EXE2 = ../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)/$(APP).$(BINEXT)

# generate a list of all the sources
CSRC = $(foreach DIR, $(SOURCES), $(wildcard $(DIR)/*.c))
SSRC = $(foreach DIR, $(SOURCES), $(wildcard $(DIR)/*.$(ASMEXT)))

# generate a list of objects from the C sources
COBJ = $(CSRC:$(LIB)/$(CPU)%.c=../obj/$(APP)/lib/$(CPU)%.$(OBJEXT))
COBJ := $(COBJ:$(LIB)/$(BOARD)/$(TOOLCHAIN)%.c=../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
COBJ := $(COBJ:$(LIB)/$(BOARD)%.c=../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
COBJ := $(COBJ:$(LIB)%.c=../obj/$(APP)/lib/$(TOOLCHAIN)%.$(OBJEXT))
COBJ := $(COBJ:$(BOARD)/$(TOOLCHAIN)%.c=../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
COBJ := $(COBJ:$(BOARD)%.c=../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
COBJ := $(COBJ:.%.c=../obj/$(APP)/$(TOOLCHAIN)%.$(OBJEXT))

# generate a list of objects from asm sources
SOBJ = $(SSRC:$(LIB)/$(CPU)%.$(ASMEXT)=../obj/$(APP)/lib/$(CPU)%.$(OBJEXT))
SOBJ := $(SOBJ:$(LIB)/$(BOARD)/$(TOOLCHAIN)%.$(ASMEXT)=../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
SOBJ := $(SOBJ:$(LIB)/$(BOARD)%.$(ASMEXT)=../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
SOBJ := $(SOBJ:$(LIB)%.$(ASMEXT)=../obj/$(APP)/lib/$(TOOLCHAIN)%.$(OBJEXT))
SOBJ := $(SOBJ:$(BOARD)/$(TOOLCHAIN)%.$(ASMEXT)=../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
SOBJ := $(SOBJ:$(BOARD)%.$(ASMEXT)=../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)%.$(OBJEXT))
SOBJ := $(SOBJ:.%.$(ASMEXT)=../obj/$(APP)/$(TOOLCHAIN)%.$(OBJEXT))

# generate a dependencies from object lists
CDEP = $(COBJ:%$(OBJEXT)=%d)
SDEP = $(SOBJ:%$(OBJEXT)=%das)

# standard include directories
INCLUDES = $(LIB)/$(CPU)/include \
$(LIB)/$(BOARD)/include \
$(LIB)/$(BOARD)/$(TOOLCHAIN)/include \
$(LIB)/include \
$(LIB)/include/platform \
include \
$(BOARD)/include \
$(BOARD)/$(TOOLCHAIN)/include \
$(RTOSINC)

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

#implicit rules censored up the Makefile so disable them
.SUFFIXES:

all: mktargetdir $(EXEC) $(EXE2)
@$(CP) $(EXEC) $(RELEASE)/$(notdir $(EXEC))
@$(CP) $(EXE2) $(RELEASE)/$(notdir $(EXE2))
@$(PFMINST)
@echo ok

.PHONY: clean
clean:
@$(RM) -r ../obj/$(APP)

mktargetdir:
@$(MKDIR) $(addsuffix .,$(sort $(dir $(COBJ)) $(dir $(SOBJ))))
@$(MKDIR) $(dir $(EXEC))

test:


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

# These are defined to help handling of spaces in paths
BLANK :=
SPACE := $(BLANK) $(BLANK)

define run_cdep
@$(CPP) $(RTOSPORT) $(CPPFLAGS) -MM $(subst +,$(SPACE),$(INCLUDES:%=-I%)) $< -o $@~
@$(SED) "s,$(notdir $*).o[ :]*,$@ $(@:%.$(OBJEXT)=%.d): ,g" < $@~ > $(@:%.$(OBJEXT)=%.d)
@$(RM) $@~
endef

define run_cbuild
@echo $@
@$(run_cdep)
@$(CC) $(RTOSPORT) $(CFLAGS) $(subst +,$(SPACE),$(INCLUDES:%=-I%)) $< $(CCOUT)$@
endef

define run_sdep
@$(CPP) $(RTOSPORT) $(CPPFLAGS) -MM $(INCLUDES:%=-I%) $< -o $@~
@$(SED) "s,$(notdir $*).o[ :]*,$@ $(@:%.$(OBJEXT)=%.das): ,g" < $@~ > $(@:%.$(OBJEXT)=%.das)
@$(RM) $@~
endef

define run_sbuild
@echo $@
@$(run_sdep)
@$(AS) $(RTOSPORT) $(AFLAGS) $(subst +,$(SPACE),$(INCLUDES:%=-I%)) $< -o $@
endef

##############################################################################
# Object generation #
##############################################################################

# C objects
../obj/$(APP)/lib/$(CPU)/%.$(OBJEXT): $(LIB)/$(CPU)/%.c
$(run_cbuild)

../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(LIB)/$(BOARD)/$(TOOLCHAIN)/%.c
$(run_cbuild)

../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(LIB)/$(BOARD)/%.c
$(run_cbuild)

../obj/$(APP)/lib/$(TOOLCHAIN)/%.$(OBJEXT): $(LIB)/%.c
$(run_cbuild)

../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(BOARD)/$(TOOLCHAIN)/%.c
$(run_cbuild)

../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(BOARD)/%.c
$(run_cbuild)

../obj/$(APP)/$(TOOLCHAIN)/%.$(OBJEXT): %.c
$(run_cbuild)

# ASM objects
../obj/$(APP)/lib/$(CPU)/%.$(OBJEXT): $(LIB)/$(CPU)/%.$(ASMEXT)
@$(run_sbuild)

../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(LIB)/$(BOARD)/$(TOOLCHAIN)/%.$(ASMEXT)
$(run_sbuild)

../obj/$(APP)/lib/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(LIB)/$(BOARD)/%.$(ASMEXT)
$(run_sbuild)

../obj/$(APP)/lib/$(TOOLCHAIN)/%.$(OBJEXT): $(LIB)/%.$(ASMEXT)
$(run_sbuild)

../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(BOARD)/$(TOOLCHAIN)/%.$(ASMEXT)
$(run_sbuild)

../obj/$(APP)/$(BOARD)/$(TOOLCHAIN)/%.$(OBJEXT): $(BOARD)/%.$(ASMEXT)
$(run_sbuild)

../obj/$(APP)/$(TOOLCHAIN)/%.$(OBJEXT): %.$(ASMEXT)
$(run_sbuild)

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

# rule to build executable
$(EXEC): $(COBJ) $(SOBJ) $(LDSCRIPT)
@echo $@
@..\BuildTools\buildver.bat >$(dir $(EXEC))version.c
@$(CC) $(RTOSPORT) $(CFLAGS) $(subst +,$(SPACE),$(INCLUDES:%=-I%)) \
$(dir $(EXEC))version.c $(CCOUT)$(dir $(EXEC))version.$(OBJEXT)
@$(LD) $(LDFLAGS) $(LDOUT)$(EXEC) $(SOBJ) $(COBJ) $(dir $(EXEC))version.$(OBJEXT) $(LDFLAGS2)

# Rule to build bin from exe
%.$(BINEXT): %.$(EXEEXT)
$(run_mkbin)

# include the files containing dependency rules
-include $(CDEP) $(SDEP)


Top
 Profile  
 
 Post subject: Re: Map files and .d79 files for Atmel AT91SAM7
PostPosted: Wed Nov 30, 2011 5:41 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Look in the include file to figure out what linker (LD) and options (LDFLAGS, LDFLAGS2) are.

include $(LIB)/$(BOARD)/$(TOOLCHAIN)/Makefile

@$(LD) $(LDFLAGS) $(LDOUT)$(EXEC) $(SOBJ) $(COBJ) $(dir $(EXEC))version.$(OBJEXT) $(LDFLAGS2)

Generating MAP files is the job of the LINKER, it has comprehensive information about the structure of the code and placement. The information, a smaller subset of it, could also exist in the .D79, a suitable object file dumper should be able to extract it.

Isn't the command line option for the IAR linker to output a map file "-l whatever.map" ?

If the makefile is too complex, use the IDE (Options -> Linker -> List -> Generate linker map file)


Top
 Profile  
 
 Post subject: Re: Map files and .d79 files for Atmel AT91SAM7
PostPosted: Thu Dec 01, 2011 7:41 am 
Offline

Joined: Mon Nov 28, 2011 7:58 am
Posts: 5
Hi,

Thanks – that is an excellent suggestion (to use the IAR debugger to create the map file), but unfortunately, the build is done elsewhere and the IAR workbench is used mainly for debugging. The build is actually done through visual studio, BUT interestingly enough, visual studio just calls a python script which creates a makefile (which calls other makefiles) which uses IAR libraries and compiler and builds the output files (only a .bin and .d79 file). I did not create this setup, but I’m trying to work with it. I think my best bet is to look at the python script and makefiles and try to modify them to produce a map file, by playing with the LD and LDFLAGS, etc.

Thanks,
Will


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: