This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH]: Add .eeprom and .softregs sections for HC11/HC12
- From: Stephane Carrez <stcarrez at nerim dot fr>
- To: binutils at sources dot redhat dot com
- Date: Sat, 29 Jun 2002 14:34:53 +0200
- Subject: [PATCH]: Add .eeprom and .softregs sections for HC11/HC12
Hi!
The following patch adds support for .eeprom and .softregs sections for HC11/HC12.
.softregs is used to put gcc soft registers. It is intended to be located
in RAM quite everywhere. Best place is .page0 for HC11 and bss for HC12.
I've committed this on mainline.
Stephane
2002-06-29 Stephane Carrez <stcarrez@nerim.fr>
* emulparams/m68hc12elfb.sh (EEPROM_MEMORY): Define.
* emulparams/m68hc11elfb.sh (EEPROM_MEMORY): Define.
* emulparams/m68hc11elf.sh (EEPROM_SIZE): Define.
(EEPROM_START_ADDR): Define.
(EEPROM_MEMORY): Define.
* emulparams/m68hc12elf.sh: Likewise.
* scripttempl/elfm68hc11.sc: Handle .eeprom section; handle .softregs
section to put soft registers in .page0.
* scripttempl/elfm68hc12.sc: Likewise but put soft registers in bss.
2002-06-29 Stephane Carrez <stcarrez@nerim.fr>
* config/tc-m68hc11.h (ELF_TC_SPECIAL_SECTIONS): New sections
.softregs and .eeprom.
Index: ld/emulparams/m68hc11elf.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/m68hc11elf.sh,v
retrieving revision 1.1
diff -u -p -r1.1 m68hc11elf.sh
--- ld/emulparams/m68hc11elf.sh 19 Jun 2000 01:22:43 -0000 1.1
+++ ld/emulparams/m68hc11elf.sh 29 Jun 2002 10:24:39 -0000
@@ -5,8 +5,11 @@ ROM_START_ADDR=0x08000
ROM_SIZE=0x8000
RAM_START_ADDR=0x01100
RAM_SIZE=0x6F00
+EEPROM_START_ADDR=0xb600
+EEPROM_SIZE=512
TEXT_MEMORY=text
DATA_MEMORY=data
+EEPROM_MEMORY=eeprom
ARCH=m68hc11
MAXPAGESIZE=32
EMBEDDED=yes
Index: ld/emulparams/m68hc11elfb.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/m68hc11elfb.sh,v
retrieving revision 1.1
diff -u -p -r1.1 m68hc11elfb.sh
--- ld/emulparams/m68hc11elfb.sh 19 Jun 2000 01:22:43 -0000 1.1
+++ ld/emulparams/m68hc11elfb.sh 29 Jun 2002 10:24:39 -0000
@@ -3,6 +3,7 @@ SCRIPT_NAME=elfm68hc11
OUTPUT_FORMAT="elf32-m68hc11"
TEXT_MEMORY=text
DATA_MEMORY=data
+EEPROM_MEMORY=eeprom
ARCH=m68hc11
MAXPAGESIZE=32
GENERIC_BOARD=yes
Index: ld/emulparams/m68hc12elf.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/m68hc12elf.sh,v
retrieving revision 1.1
diff -u -p -r1.1 m68hc12elf.sh
--- ld/emulparams/m68hc12elf.sh 19 Jun 2000 01:22:43 -0000 1.1
+++ ld/emulparams/m68hc12elf.sh 29 Jun 2002 10:24:39 -0000
@@ -5,8 +5,11 @@ ROM_START_ADDR=0x08000
ROM_SIZE=0x8000
RAM_START_ADDR=0x01100
RAM_SIZE=0x6F00
+EEPROM_START_ADDR=0x0800
+EEPROM_SIZE=2048
TEXT_MEMORY=text
DATA_MEMORY=data
+EEPROM_MEMORY=eeprom
ARCH=m68hc12
MAXPAGESIZE=32
EMBEDDED=yes
Index: ld/emulparams/m68hc12elfb.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/m68hc12elfb.sh,v
retrieving revision 1.1
diff -u -p -r1.1 m68hc12elfb.sh
--- ld/emulparams/m68hc12elfb.sh 19 Jun 2000 01:22:43 -0000 1.1
+++ ld/emulparams/m68hc12elfb.sh 29 Jun 2002 10:24:40 -0000
@@ -3,6 +3,7 @@ SCRIPT_NAME=elfm68hc12
OUTPUT_FORMAT="elf32-m68hc12"
TEXT_MEMORY=text
DATA_MEMORY=data
+EEPROM_MEMORY=eeprom
ARCH=m68hc12
MAXPAGESIZE=32
GENERIC_BOARD=yes
Index: ld/scripttempl/elfm68hc11.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfm68hc11.sc,v
retrieving revision 1.7
diff -u -p -r1.7 elfm68hc11.sc
--- ld/scripttempl/elfm68hc11.sc 25 Nov 2001 17:29:27 -0000 1.7
+++ ld/scripttempl/elfm68hc11.sc 29 Jun 2002 10:24:41 -0000
@@ -100,6 +100,7 @@ MEMORY
page0 (rwx) : ORIGIN = 0x0, LENGTH = 256
text (rx) : ORIGIN = ${ROM_START_ADDR}, LENGTH = ${ROM_SIZE}
data : ORIGIN = ${RAM_START_ADDR}, LENGTH = ${RAM_SIZE}
+ eeprom : ORIGIN = ${EEPROM_START_ADDR}, LENGTH = ${EEPROM_SIZE}
}
/* Setup the stack on the top of the data memory bank. */
@@ -165,6 +166,10 @@ BSS_DATA_RELOC="
.scommon 0 : { *(.scommon) }
"
+SOFT_REGS_RELOC="
+ .softregs 0 : { *(.softregs) }
+"
+
cat <<EOF
${RELOCATING+/* Linker script for 68HC11 executable (PROM). */}
${RELOCATING-/* Linker script for 68HC11 object file (ld -r). */}
@@ -294,6 +299,7 @@ SECTIONS
.page0 :
{
*(.page0)
+ ${RELOCATING+*(.softregs)}
} ${RELOCATING+ > page0}
/* Start of text section. */
@@ -393,6 +399,7 @@ SECTIONS
/* Relocation for some bss and data sections. */
${RELOCATING-${BSS_DATA_RELOC}}
+ ${RELOCATING-${SOFT_REGS_RELOC}}
.bss ${RELOCATING-0} :
{
@@ -409,6 +416,12 @@ SECTIONS
} ${RELOCATING+ > ${DATA_MEMORY}}
${RELOCATING+__bss_size = SIZEOF(.bss);}
${RELOCATING+PROVIDE (__bss_size = SIZEOF(.bss));}
+
+ .eeprom ${RELOCATING-0} :
+ {
+ *(.eeprom)
+ *(.eeprom.*)
+ } ${RELOCATING+ > ${EEPROM_MEMORY}}
${RELOCATING+${VECTORS}}
Index: ld/scripttempl/elfm68hc12.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfm68hc12.sc,v
retrieving revision 1.7
diff -u -p -r1.7 elfm68hc12.sc
--- ld/scripttempl/elfm68hc12.sc 25 Nov 2001 17:29:27 -0000 1.7
+++ ld/scripttempl/elfm68hc12.sc 29 Jun 2002 10:24:43 -0000
@@ -165,6 +165,10 @@ BSS_DATA_RELOC="
.scommon 0 : { *(.scommon) }
"
+SOFT_REGS_RELOC="
+ .softregs 0 : { *(.softregs) }
+"
+
cat <<EOF
${RELOCATING+/* Linker script for 68HC12 executable (PROM). */}
${RELOCATING-/* Linker script for 68HC12 object file (ld -r). */}
@@ -393,10 +397,12 @@ SECTIONS
/* Relocation for some bss and data sections. */
${RELOCATING-${BSS_DATA_RELOC}}
+ ${RELOCATING-${SOFT_REGS_RELOC}}
.bss ${RELOCATING-0} :
{
${RELOCATING+__bss_start = .;}
+ ${RELOCATING+*(.softregs)}
${RELOCATING+*(.sbss)}
${RELOCATING+*(.scommon)}
@@ -409,6 +415,12 @@ SECTIONS
} ${RELOCATING+ > ${DATA_MEMORY}}
${RELOCATING+__bss_size = SIZEOF(.bss);}
${RELOCATING+PROVIDE (__bss_size = SIZEOF(.bss));}
+
+ .eeprom ${RELOCATING-0} :
+ {
+ *(.eeprom)
+ *(.eeprom.*)
+ } ${RELOCATING+ > ${EEPROM_MEMORY}}
${RELOCATING+${VECTORS}}
Index: gas/config/tc-m68hc11.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68hc11.h,v
retrieving revision 1.5
diff -u -p -r1.5 tc-m68hc11.h
--- gas/config/tc-m68hc11.h 8 Mar 2001 23:24:24 -0000 1.5
+++ gas/config/tc-m68hc11.h 29 Jun 2002 10:25:05 -0000
@@ -1,5 +1,5 @@
/* tc-m68hc11.h -- Header file for tc-m68hc11.c.
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -60,6 +60,8 @@ extern const char *m68hc11_arch_format P
- The .vectors is the data section that represents the interrupt
vectors. */
#define ELF_TC_SPECIAL_SECTIONS \
+ { ".eeprom", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
+ { ".softregs",SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, \
{ ".page0", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
{ ".vectors", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },