gdb: Add OpenRISC or1k and or1knd target support
This patch prepares the current GDB port of the OpenRISC processor from https://github.com/openrisc/binutils-gdb for upstream merging. Testing has been done with a cgen sim provided in a separate patch. This has been tested with 2 toolchains. GCC [1] 5.4.0 from the OpenRISC project with Newlib [2] and GCC 5.4.0 with Musl [3] 1.1.4. It supports or1knd (no delay slot target). The default target is or1k (with delay slot). You can change the target arch with: (gdb) set architecture or1knd The target architecture is assumed to be or1knd [1] https://github.com/openrisc/or1k-gcc [2] https://github.com/openrisc/newlib [3] https://github.com/openrisc/musl-cross gdb/doc/ChangeLog: 2017-12-12 Stafford Horne <shorne@gmail.com> Stefan Wallentowitz <stefan@wallentowitz.de> Franck Jullien <franck.jullien@gmail.com> Jeremy Bennett <jeremy.bennett@embecosm.com> * gdb.texinfo: Add OpenRISC documentation. gdb/ChangeLog: 2017-12-12 Stafford Horne <shorne@gmail.com> Stefan Wallentowitz <stefan@wallentowitz.de> Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Franck Jullien <franck.jullien@gmail.com> Jeremy Bennett <jeremy.bennett@embecosm.com> * configure.tgt: Add targets for or1k and or1knd. * or1k-tdep.c: New file. * or1k-tdep.h: New file. * features/Makefile: Add or1k.xml to build. * features/or1k.xml: New file. * features/or1k-core.xml: New file. * features/or1k.c: Generated.
This commit is contained in:
parent
db9077b727
commit
a994fec4f8
@ -1,3 +1,17 @@
|
||||
2017-12-12 Stafford Horne <shorne@gmail.com>
|
||||
Stefan Wallentowitz <stefan@wallentowitz.de>
|
||||
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
|
||||
Franck Jullien <franck.jullien@gmail.com>
|
||||
Jeremy Bennett <jeremy.bennett@embecosm.com>
|
||||
|
||||
* configure.tgt: Add targets for or1k and or1knd.
|
||||
* or1k-tdep.c: New file.
|
||||
* or1k-tdep.h: New file.
|
||||
* features/Makefile: Add or1k.xml to build.
|
||||
* features/or1k.xml: New file.
|
||||
* features/or1k-core.xml: New file.
|
||||
* features/or1k.c: Generated.
|
||||
|
||||
2017-12-12 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR tdep/22576
|
||||
|
@ -463,6 +463,12 @@ nios2*-*-*)
|
||||
gdb_target_obs="nios2-tdep.o"
|
||||
;;
|
||||
|
||||
or1k-*-* | or1knd-*-*)
|
||||
# Target: OpenCores OpenRISC 1000 32-bit implementation bare metal
|
||||
gdb_target_obs="or1k-tdep.o"
|
||||
gdb_sim=../sim/or1k/libsim.a
|
||||
;;
|
||||
|
||||
powerpc*-*-freebsd*)
|
||||
# Target: FreeBSD/powerpc
|
||||
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \
|
||||
|
@ -1,3 +1,10 @@
|
||||
2017-12-12 Stafford Horne <shorne@gmail.com>
|
||||
Stefan Wallentowitz <stefan@wallentowitz.de>
|
||||
Franck Jullien <franck.jullien@gmail.com>
|
||||
Jeremy Bennett <jeremy.bennett@embecosm.com>
|
||||
|
||||
* gdb.texinfo: Add OpenRISC documentation.
|
||||
|
||||
2017-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.texinfo (Index Files): Document .debug_names and -dwarf-5.
|
||||
|
@ -546,6 +546,11 @@ was developed by SRI International and the University of Cambridge
|
||||
Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
|
||||
("CTSRD"), as part of the DARPA CRASH research programme.
|
||||
|
||||
The original port to the OpenRISC 1000 is believed to be due to
|
||||
Alessandro Forin and Per Bothner. More recent ports have been the work
|
||||
of Jeremy Bennett, Franck Jullien, Stefan Wallentowitz and
|
||||
Stafford Horne.
|
||||
|
||||
@node Sample Session
|
||||
@chapter A Sample @value{GDBN} Session
|
||||
|
||||
@ -22442,6 +22447,7 @@ acceptable commands.
|
||||
* M68K:: Motorola M68K
|
||||
* MicroBlaze:: Xilinx MicroBlaze
|
||||
* MIPS Embedded:: MIPS Embedded
|
||||
* OpenRISC 1000:: OpenRISC 1000 (or1k)
|
||||
* PowerPC Embedded:: PowerPC Embedded
|
||||
* AVR:: Atmel AVR
|
||||
* CRIS:: CRIS
|
||||
@ -22651,6 +22657,38 @@ As usual, you can inquire about the @code{mipsfpu} variable with
|
||||
@samp{show mipsfpu}.
|
||||
@end table
|
||||
|
||||
@node OpenRISC 1000
|
||||
@subsection OpenRISC 1000
|
||||
@cindex OpenRISC 1000
|
||||
|
||||
@noindent
|
||||
The OpenRISC 1000 provides a free RISC instruction set architecture. It is
|
||||
mainly provided as a soft-core which can run on Xilinx, Altera and other
|
||||
FPGA's.
|
||||
|
||||
@value{GDBN} for OpenRISC supports the below commands when connecting to
|
||||
a target:
|
||||
|
||||
@table @code
|
||||
|
||||
@kindex target sim
|
||||
@item target sim
|
||||
|
||||
Runs the builtin CPU simulator which can run very basic
|
||||
programs but does not support most hardware functions like MMU.
|
||||
For more complex use cases the user is advised to run an external
|
||||
target, and connect using @samp{target remote}.
|
||||
|
||||
Example: @code{target sim}
|
||||
|
||||
@item set debug or1k
|
||||
Toggle whether to display OpenRISC-specific debugging messages from the
|
||||
OpenRISC target support subsystem.
|
||||
|
||||
@item show debug or1k
|
||||
Show whether OpenRISC-specific debugging messages are enabled.
|
||||
@end table
|
||||
|
||||
@node PowerPC Embedded
|
||||
@subsection PowerPC Embedded
|
||||
|
||||
@ -41739,6 +41777,7 @@ registers using the capitalization used in the description.
|
||||
* M68K Features::
|
||||
* NDS32 Features::
|
||||
* Nios II Features::
|
||||
* OpenRISC 1000 Features::
|
||||
* PowerPC Features::
|
||||
* S/390 and System z Features::
|
||||
* Sparc Features::
|
||||
@ -42025,6 +42064,14 @@ targets. It should contain the 32 core registers (@samp{zero},
|
||||
@samp{pc}, and the 16 control registers (@samp{status} through
|
||||
@samp{mpuacc}).
|
||||
|
||||
@node OpenRISC 1000 Features
|
||||
@subsection Openrisc 1000 Features
|
||||
@cindex target descriptions, OpenRISC 1000 features
|
||||
|
||||
The @samp{org.gnu.gdb.or1k.group0} feature is required for OpenRISC 1000
|
||||
targets. It should contain the 32 general purpose registers (@samp{r0}
|
||||
through @samp{r31}), @samp{ppc}, @samp{npc} and @samp{sr}.
|
||||
|
||||
@node PowerPC Features
|
||||
@subsection PowerPC Features
|
||||
@cindex target descriptions, PowerPC features
|
||||
|
@ -93,6 +93,7 @@ mips64-expedite = r29,pc
|
||||
mips64-dsp-expedite = r29,pc
|
||||
microblaze-expedite = r1,rpc
|
||||
nios2-linux-expedite = sp,pc
|
||||
or1k-expedite = r1,npc
|
||||
powerpc-expedite = r1,pc
|
||||
rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4
|
||||
rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4
|
||||
@ -136,6 +137,7 @@ XMLTOC = \
|
||||
mips64-linux.xml \
|
||||
nds32.xml \
|
||||
nios2.xml \
|
||||
or1k.xml \
|
||||
rs6000/powerpc-32.xml \
|
||||
rs6000/powerpc-32l.xml \
|
||||
rs6000/powerpc-403.xml \
|
||||
|
65
gdb/features/or1k-core.xml
Normal file
65
gdb/features/or1k-core.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2017 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.or1k.group0">
|
||||
<reg name="r0" bitsize="32" type="int"/>
|
||||
<reg name="r1" bitsize="32" type="data_ptr"/>
|
||||
<reg name="r2" bitsize="32" type="data_ptr"/>
|
||||
<reg name="r3" bitsize="32" type="int"/>
|
||||
<reg name="r4" bitsize="32" type="int"/>
|
||||
<reg name="r5" bitsize="32" type="int"/>
|
||||
<reg name="r6" bitsize="32" type="int"/>
|
||||
<reg name="r7" bitsize="32" type="int"/>
|
||||
<reg name="r8" bitsize="32" type="int"/>
|
||||
<reg name="r9" bitsize="32" type="code_ptr"/>
|
||||
<reg name="r10" bitsize="32" type="int"/>
|
||||
<reg name="r11" bitsize="32" type="int"/>
|
||||
<reg name="r12" bitsize="32" type="int"/>
|
||||
<reg name="r13" bitsize="32" type="int"/>
|
||||
<reg name="r14" bitsize="32" type="int"/>
|
||||
<reg name="r15" bitsize="32" type="int"/>
|
||||
<reg name="r16" bitsize="32" type="int"/>
|
||||
<reg name="r17" bitsize="32" type="int"/>
|
||||
<reg name="r18" bitsize="32" type="int"/>
|
||||
<reg name="r19" bitsize="32" type="int"/>
|
||||
<reg name="r20" bitsize="32" type="int"/>
|
||||
<reg name="r21" bitsize="32" type="int"/>
|
||||
<reg name="r22" bitsize="32" type="int"/>
|
||||
<reg name="r23" bitsize="32" type="int"/>
|
||||
<reg name="r24" bitsize="32" type="int"/>
|
||||
<reg name="r25" bitsize="32" type="int"/>
|
||||
<reg name="r26" bitsize="32" type="int"/>
|
||||
<reg name="r27" bitsize="32" type="int"/>
|
||||
<reg name="r28" bitsize="32" type="int"/>
|
||||
<reg name="r29" bitsize="32" type="int"/>
|
||||
<reg name="r30" bitsize="32" type="int"/>
|
||||
<reg name="r31" bitsize="32" type="int"/>
|
||||
<reg name="ppc" bitsize="32" type="code_ptr"/>
|
||||
<reg name="npc" bitsize="32" type="code_ptr"/>
|
||||
<flags id="sr_flags" size="4">
|
||||
<field name="SM" start="0" end="0"/>
|
||||
<field name="TEE" start="1" end="1"/>
|
||||
<field name="IEE" start="2" end="2"/>
|
||||
<field name="DCE" start="3" end="3"/>
|
||||
<field name="ICE" start="4" end="4"/>
|
||||
<field name="DME" start="5" end="5"/>
|
||||
<field name="IME" start="6" end="6"/>
|
||||
<field name="LEE" start="7" end="7"/>
|
||||
<field name="CE" start="8" end="8"/>
|
||||
<field name="F" start="9" end="9"/>
|
||||
<field name="CY" start="10" end="10"/>
|
||||
<field name="OV" start="11" end="11"/>
|
||||
<field name="OVE" start="12" end="12"/>
|
||||
<field name="DSX" start="13" end="13"/>
|
||||
<field name="EPH" start="14" end="14"/>
|
||||
<field name="FO" start="15" end="15"/>
|
||||
<field name="SUMRA" start="16" end="16"/>
|
||||
<field name="CID" start="28" end="31"/>
|
||||
</flags>
|
||||
<reg name="sr" bitsize="32" type="sr_flags"/>
|
||||
</feature>
|
77
gdb/features/or1k.c
Normal file
77
gdb/features/or1k.c
Normal file
@ -0,0 +1,77 @@
|
||||
/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
|
||||
Original: or1k.xml */
|
||||
|
||||
#include "defs.h"
|
||||
#include "osabi.h"
|
||||
#include "target-descriptions.h"
|
||||
|
||||
struct target_desc *tdesc_or1k;
|
||||
static void
|
||||
initialize_tdesc_or1k (void)
|
||||
{
|
||||
struct target_desc *result = allocate_target_description ();
|
||||
set_tdesc_architecture (result, bfd_scan_arch ("or1k"));
|
||||
|
||||
struct tdesc_feature *feature;
|
||||
|
||||
feature = tdesc_create_feature (result, "org.gnu.gdb.or1k.group0");
|
||||
tdesc_type_with_fields *type_with_fields;
|
||||
tdesc_type *field_type;
|
||||
type_with_fields = tdesc_create_flags (feature, "sr_flags", 4);
|
||||
tdesc_add_flag (type_with_fields, 0, "SM");
|
||||
tdesc_add_flag (type_with_fields, 1, "TEE");
|
||||
tdesc_add_flag (type_with_fields, 2, "IEE");
|
||||
tdesc_add_flag (type_with_fields, 3, "DCE");
|
||||
tdesc_add_flag (type_with_fields, 4, "ICE");
|
||||
tdesc_add_flag (type_with_fields, 5, "DME");
|
||||
tdesc_add_flag (type_with_fields, 6, "IME");
|
||||
tdesc_add_flag (type_with_fields, 7, "LEE");
|
||||
tdesc_add_flag (type_with_fields, 8, "CE");
|
||||
tdesc_add_flag (type_with_fields, 9, "F");
|
||||
tdesc_add_flag (type_with_fields, 10, "CY");
|
||||
tdesc_add_flag (type_with_fields, 11, "OV");
|
||||
tdesc_add_flag (type_with_fields, 12, "OVE");
|
||||
tdesc_add_flag (type_with_fields, 13, "DSX");
|
||||
tdesc_add_flag (type_with_fields, 14, "EPH");
|
||||
tdesc_add_flag (type_with_fields, 15, "FO");
|
||||
tdesc_add_flag (type_with_fields, 16, "SUMRA");
|
||||
tdesc_add_bitfield (type_with_fields, "CID", 28, 31);
|
||||
|
||||
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
|
||||
tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "data_ptr");
|
||||
tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "code_ptr");
|
||||
tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r13", 13, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r14", 14, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r15", 15, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r16", 16, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r17", 17, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r18", 18, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r19", 19, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r20", 20, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r21", 21, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r22", 22, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r23", 23, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r24", 24, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r25", 25, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r26", 26, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r27", 27, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r28", 28, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r29", 29, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r30", 30, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "r31", 31, 1, NULL, 32, "int");
|
||||
tdesc_create_reg (feature, "ppc", 32, 1, NULL, 32, "code_ptr");
|
||||
tdesc_create_reg (feature, "npc", 33, 1, NULL, 32, "code_ptr");
|
||||
tdesc_create_reg (feature, "sr", 34, 1, NULL, 32, "sr_flags");
|
||||
|
||||
tdesc_or1k = result;
|
||||
}
|
12
gdb/features/or1k.xml
Normal file
12
gdb/features/or1k.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2016 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target>
|
||||
<architecture>or1k</architecture>
|
||||
<xi:include href="or1k-core.xml"/>
|
||||
</target>
|
1294
gdb/or1k-tdep.c
Normal file
1294
gdb/or1k-tdep.c
Normal file
File diff suppressed because it is too large
Load Diff
56
gdb/or1k-tdep.h
Normal file
56
gdb/or1k-tdep.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* Definitions to target GDB to OpenRISC 1000 32-bit targets.
|
||||
Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
With this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef OR1K_TDEP__H
|
||||
#define OR1K_TDEP__H
|
||||
|
||||
#ifndef TARGET_OR1K
|
||||
#define TARGET_OR1K
|
||||
#endif
|
||||
|
||||
#include "opcodes/or1k-desc.h"
|
||||
#include "opcodes/or1k-opc.h"
|
||||
|
||||
/* General Purpose Registers */
|
||||
#define OR1K_ZERO_REGNUM 0
|
||||
#define OR1K_SP_REGNUM 1
|
||||
#define OR1K_FP_REGNUM 2
|
||||
#define OR1K_FIRST_ARG_REGNUM 3
|
||||
#define OR1K_LAST_ARG_REGNUM 8
|
||||
#define OR1K_LR_REGNUM 9
|
||||
#define OR1K_FIRST_SAVED_REGNUM 10
|
||||
#define OR1K_RV_REGNUM 11
|
||||
#define OR1K_PPC_REGNUM (OR1K_MAX_GPR_REGS + 0)
|
||||
#define OR1K_NPC_REGNUM (OR1K_MAX_GPR_REGS + 1)
|
||||
#define OR1K_SR_REGNUM (OR1K_MAX_GPR_REGS + 2)
|
||||
|
||||
/* Properties of the architecture. GDB mapping of registers is all the GPRs
|
||||
and SPRs followed by the PPC, NPC and SR at the end. Red zone is the area
|
||||
past the end of the stack reserved for exception handlers etc. */
|
||||
|
||||
#define OR1K_MAX_GPR_REGS 32
|
||||
#define OR1K_NUM_PSEUDO_REGS 0
|
||||
#define OR1K_NUM_REGS (OR1K_MAX_GPR_REGS + 3)
|
||||
#define OR1K_STACK_ALIGN 4
|
||||
#define OR1K_INSTLEN 4
|
||||
#define OR1K_INSTBITLEN (OR1K_INSTLEN * 8)
|
||||
#define OR1K_NUM_TAP_RECORDS 8
|
||||
#define OR1K_FRAME_RED_ZONE_SIZE 2536
|
||||
|
||||
#endif /* OR1K_TDEP__H */
|
Loading…
Reference in New Issue
Block a user