public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Add support for generating assembly listing files
@ 2007-01-11 17:04 timur at freescale.com
  0 siblings, 0 replies; only message in thread
From: timur at freescale.com @ 2007-01-11 17:04 UTC (permalink / raw)
  To: u-boot

From: Timur Tabi <timur@freescale.com>

This patch adds support for generating assembly listing files when building
U-Boot.  When "LISTING=1" is specified on the "make" command line, each 
compiled .c and .S file will generate a .lst file in the same location as
the corresponding .o file.  Assembly listing files contain the assembly
instructions and opcodes that the compiler generates.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 Makefile  |    2 +-
 README    |   15 +++++++++++++++
 config.mk |   20 +++++++++-----------
 3 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index a973dff..1dbdf4d 100644
--- a/Makefile
+++ b/Makefile
@@ -2302,7 +2302,7 @@ atstk1002_config	:	unconfig
 clean:
 	find $(OBJTREE) -type f \
 		\( -name 'core' -o -name '*.bak' -o -name '*~' \
-		-o -name '*.o'  -o -name '*.a'  \) -print \
+		-o -name '*.o'  -o -name '*.a' -o -name '*.lst' \) -print \
 		| xargs rm -f
 	rm -f $(obj)examples/hello_world $(obj)examples/timer \
 	      $(obj)examples/eepro100_eeprom $(obj)examples/sched \
diff --git a/README b/README
index ecfd1f8..f6bef2d 100644
--- a/README
+++ b/README
@@ -2425,6 +2425,21 @@ this behavior and build U-Boot to some e
 Note that the command line "O=" setting overrides the BUILD_DIR environment
 variable.
 
+To generate an assembly listing file for each source file (.c and .S), add
+"LISTING=1" on the make command line when building your image:
+
+	make LISTING=1 all
+
+or
+
+	make O=/tmp/build LISTING=1 all
+
+A listing file contains the assembly instructions (with opcodes) that the 
+compiler generated when it compiled a source file.  Each listing file will be 
+located in the same place as the corresponding .o file, and it will have 
+a .lst extension.  Listing files are useful when you want to examine the
+compiler's output, which may not be what you expect.  They are also useful
+with hardware debuggers that do not support source code.
 
 Please be aware that the Makefiles assume you are using GNU make, so
 for instance on NetBSD you might need to use "gmake" instead of
diff --git a/config.mk b/config.mk
index 6e280bc..a3c88c7 100644
--- a/config.mk
+++ b/config.mk
@@ -224,22 +224,20 @@ export	TEXT_BASE PLATFORM_CPPFLAGS PLATF
 
 #########################################################################
 
-ifndef REMOTE_BUILD
-
-%.s:	%.S
-	$(CPP) $(AFLAGS) -o $@ $<
-%.o:	%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-%.o:	%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-else
-
 $(obj)%.s:	%.S
 	$(CPP) $(AFLAGS) -o $@ $<
+
 $(obj)%.o:	%.S
+ifdef LISTING
+	$(CC) $(AFLAGS) -Wa,-alds=$(@D)/$(*F).lst -c -o $@ $<
+else
 	$(CC) $(AFLAGS) -c -o $@ $<
+endif
+
 $(obj)%.o:	%.c
+ifdef LISTING
+	$(CC) $(CFLAGS) -Wa,-alds=$(@D)/$(*F).lst -c -o $@ $<
+else
 	$(CC) $(CFLAGS) -c -o $@ $<
 endif
 
-- 
1.4.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-11 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-11 17:04 [U-Boot-Users] [PATCH] Add support for generating assembly listing files timur at freescale.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox