This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[HC11][PATCH]: Fix gdb.asm tests for HC11/HC12


Hi!

Committed the following patch for HC11/HC12 on mainline and 6_4 branch:

- it fixes the asm tests where the data section must be initialized
  explicitly on HC11/HC12 (embedded ROMable target)
- it fixes the link of the asm test for HC11/HC12 where we must not
  use the linker script because this is a specific asm test and
  we use the linker directly.

The gdb.asm tests pass completely on the HC11/HC12 target now.

Stephane

2005-11-11  Stephane Carrez  <stcarrez@nerim.fr>

	* gdb.asm/m68hc11.inc: Setup the data section.
	* gdb.asm/asm-source.exp (m6811-*-*): Don't use the target board linker
	script for this test.
	(m6812-*-*): Likewise.
Index: gdb.asm/asm-source.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asm-source.exp,v
retrieving revision 1.57
diff -u -p -r1.57 asm-source.exp
--- gdb.asm/asm-source.exp	31 Oct 2005 20:33:22 -0000	1.57
+++ gdb.asm/asm-source.exp	11 Nov 2005 11:10:15 -0000
@@ -80,11 +80,25 @@ switch -glob -- [istarget] {
     }
     "m6811-*-*" {
         set asm-arch m68hc11
-        set asm-flags "-mshort-double -m68hc11 -gdwarf-2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+        set asm-flags "-mshort-double -m68hc11 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+	set debug-flags "-gdwarf-2"
+	# This asm test is specific and uses the linker directly.
+	# We must not use the target board linker script defined for other
+	# tests.  Remove it and restore it later on.
+	set board [target_info name]
+	set old_ldscript [board_info $board ldscript]
+	unset_board_info "ldscript"
     }
     "m6812-*-*" {
         set asm-arch m68hc11
-        set asm-flags "-mshort-double -m68hc12 -gdwarf-2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+        set asm-flags "-mshort-double -m68hc12 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+	set debug-flags "-gdwarf-2"
+	# This asm test is specific and uses the linker directly.
+	# We must not use the target board linker script defined for other
+	# tests.  Remove it and restore it later on.
+	set board [target_info name]
+	set old_ldscript [board_info $board ldscript]
+	set_board_info ldscript ""
     }
     "mips*-*" {
         set asm-arch mips
@@ -226,6 +240,11 @@ if {[target_link "asmsrc1.o asmsrc2.o" "
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
 
+# Restore the target board linker script for HC11/HC12.
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
+    set_board_info ldscript $old_ldscript
+}
+
 remote_exec build "mv asmsrc1.o asmsrc2.o ${objdir}/${subdir}"
 
 
Index: gdb.asm/m68hc11.inc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/m68hc11.inc,v
retrieving revision 1.2
diff -u -p -r1.2 m68hc11.inc
--- gdb.asm/m68hc11.inc	7 Mar 2005 21:16:50 -0000	1.2
+++ gdb.asm/m68hc11.inc	11 Nov 2005 11:10:15 -0000
@@ -37,6 +37,22 @@
 _.frame: .word 0
         .previous
         lds     #0x2000
+        ; the linker script maps the data section in ROM (LMA) for its initial
+        ; content and in RAM (VMA) for its runtime value.  We have to do
+        ; what the default crt0 does: copy the ROM part in RAM.
+        ; (otherwise any 'globalvar' appears uninitialized)
+	ldx	#__data_image
+	ldy	#__data_section_start
+	bra	Start_map
+Loop:
+	ldaa	0,x
+	staa	0,y
+	inx
+	iny
+Start_map:
+	cpx	#__data_image_end
+	blo	Loop
+Done:
         clr     _.frame
         clr     _.frame+1
 	.endm
@@ -46,5 +62,5 @@ _.frame: .word 0
 	.macro gdbasm_datavar name value
 	.data
 \name:
-	.long	\value
+	.word	\value
 	.endm

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]