[U-Boot-Users] [PATCH] Add support for generating assembly listing files
timur at freescale.com
timur at freescale.com
Thu Jan 11 18:04:45 CET 2007
From: Timur Tabi <timur at 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 at 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
More information about the U-Boot
mailing list