diff -ruN m68k-bdm-1.4-pre4/gdb/scripts/5249.gdb m68k-bdm-1.4-pre4.wo/gdb/scripts/5249.gdb
--- m68k-bdm-1.4-pre4/gdb/scripts/5249.gdb 1970-01-01 01:00:00.000000000 +0100
+++ m68k-bdm-1.4-pre4.wo/gdb/scripts/5249.gdb 2010-02-03 13:51:51.081254207 +0100
@@ -0,0 +1,231 @@
+#define addresses
+
+set $mbar = 0x10000001
+set $mbar2 = 0x80000001
+
+# MBAR address space
+set $rsr = $mbar - 1 + 0x00
+set $sypcr = $mbar - 1 + 0x01
+set $swivr = $mbar - 1 + 0x02
+set $swsr = $mbar - 1 + 0x03
+set $mpark = $mbar - 1 + 0x0C
+
+set $ipr = $mbar - 1 + 0x40
+set $imr = $mbar - 1 + 0x44
+set $icr0 = $mbar - 1 + 0x4C
+set $icr1 = $mbar - 1 + 0x4D
+set $icr2 = $mbar - 1 + 0x4E
+set $icr3 = $mbar - 1 + 0x4F
+set $icr4 = $mbar - 1 + 0x50
+set $icr5 = $mbar - 1 + 0x51
+set $icr6 = $mbar - 1 + 0x52
+set $icr7 = $mbar - 1 + 0x53
+set $icr8 = $mbar - 1 + 0x54
+set $icr9 = $mbar - 1 + 0x55
+set $icr10 = $mbar - 1 + 0x56
+set $icr11 = $mbar - 1 + 0x57
+
+set $csar0 = $mbar - 1 + 0x80
+set $csmr0 = $mbar - 1 + 0x84
+set $cscr0 = $mbar - 1 + 0x88
+set $csar1 = $mbar - 1 + 0x8C
+set $csmr1 = $mbar - 1 + 0x90
+set $cscr1 = $mbar - 1 + 0x94
+set $csar2 = $mbar - 1 + 0x98
+set $csmr2 = $mbar - 1 + 0x9C
+set $cscr2 = $mbar - 1 + 0xA0
+set $csar3 = $mbar - 1 + 0xA4
+set $csmr3 = $mbar - 1 + 0xA8
+set $cscr3 = $mbar - 1 + 0xAC
+
+set $dcr = $mbar - 1 + 0x100
+set $dacr0 = $mbar - 1 + 0x108
+set $dmr0 = $mbar - 1 + 0x10C
+set $dacr1 = $mbar - 1 + 0x110
+set $dmr1 = $mbar - 1 + 0x114
+
+set $tmr0 = $mbar - 1 + 0x140
+set $trr0 = $mbar - 1 + 0x144
+set $tcr0 = $mbar - 1 + 0x148
+set $tcn0 = $mbar - 1 + 0x14C
+set $ter0 = $mbar - 1 + 0x150
+
+set $tmr1 = $mbar - 1 + 0x180
+set $trr1 = $mbar - 1 + 0x184
+set $tcr1 = $mbar - 1 + 0x188
+set $tcn1 = $mbar - 1 + 0x18C
+set $ter1 = $mbar - 1 + 0x190
+
+set $umr10 = $mbar - 1 + 0x1C0
+set $umr20 = $umr10
+set $usr0 = $mbar - 1 + 0x1C4
+set $ucsr0 = $usr0
+set $ucr0 = $mbar - 1 + 0x1C8
+set $urb0 = $mbar - 1 + 0x1CC
+set $utb0 = $urb0
+set $uipcr0 = $mbar - 1 + 0x1D0
+set $uacr0 = $uipcr0
+set $uisr0 = $mbar - 1 + 0x1D4
+set $uimr0 = $uisr0
+set $ubg10 = $mbar - 1 + 0x1D8
+set $ubg20 = $mbar - 1 + 0x1DC
+set $uivr0 = $mbar - 1 + 0x1F0
+set $uip0 = $mbar - 1 + 0x1F4
+set $uop10 = $mbar - 1 + 0x1F8
+set $uop00 = $mbar - 1 + 0x1FC
+
+set $umr11 = $mbar - 1 + 0x200
+set $umr21 = $umr11
+set $usr1 = $mbar - 1 + 0x204
+set $ucsr1 = $usr1
+set $ucr1 = $mbar - 1 + 0x208
+set $urb1 = $mbar - 1 + 0x20C
+set $utb1 = $urb1
+set $uipcr1 = $mbar - 1 + 0x210
+set $uacr1 = $uipcr1
+set $uisr1 = $mbar - 1 + 0x214
+set $uimr1 = $uisr1
+set $ubg11 = $mbar - 1 + 0x218
+set $ubg21 = $mbar - 1 + 0x21C
+set $uivr1 = $mbar - 1 + 0x230
+set $uip1 = $mbar - 1 + 0x234
+set $uop11 = $mbar - 1 + 0x238
+set $uop01 = $mbar - 1 + 0x23C
+
+set $madr = $mbar - 1 + 0x280
+set $mfdr = $mbar - 1 + 0x284
+set $mbcr = $mbar - 1 + 0x288
+set $mbsr = $mbar - 1 + 0x28C
+set $mbdr = $mbar - 1 + 0x290
+
+set $sar0 = $mbar - 1 + 0x300
+set $dar0 = $mbar - 1 + 0x304
+set $dcr0 = $mbar - 1 + 0x308
+set $bcr0 = $mbar - 1 + 0x30C
+set $dsr0 = $mbar - 1 + 0x310
+set $divr0 = $mbar - 1 + 0x314
+
+set $sar1 = $mbar - 1 + 0x340
+set $dar1 = $mbar - 1 + 0x344
+set $dcr1 = $mbar - 1 + 0x348
+set $bcr1 = $mbar - 1 + 0x34C
+set $dsr1 = $mbar - 1 + 0x350
+set $divr1 = $mbar - 1 + 0x354
+
+set $sar2 = $mbar - 1 + 0x380
+set $dar2 = $mbar - 1 + 0x384
+set $dcr2 = $mbar - 1 + 0x388
+set $bcr2 = $mbar - 1 + 0x38C
+set $dsr2 = $mbar - 1 + 0x390
+set $divr2 = $mbar - 1 + 0x394
+
+set $sar3 = $mbar - 1 + 0x3C0
+set $dar3 = $mbar - 1 + 0x3C4
+set $dcr3 = $mbar - 1 + 0x3C8
+set $bcr3 = $mbar - 1 + 0x3CC
+set $dsr3 = $mbar - 1 + 0x3D0
+set $divr3 = $mbar - 1 + 0x3D4
+
+set $qspiqmr = $mbar - 1 + 0x400
+set $qspiqdlyr = $mbar - 1 + 0x404
+set $qspiqwr = $mbar - 1 + 0x408
+set $qspiqir = $mbar - 1 + 0x40C
+set $qspiqar = $mbar - 1 + 0x410
+set $qspiqdr = $mbar - 1 + 0x414
+
+# MBAR2 address space
+set $gpio-read = $mbar2 - 1 + 0x00
+set $gpio-out = $mbar2 - 1 + 0x04
+set $gpio-enable = $mbar2 - 1 + 0x08
+set $gpio-function = $mbar2 - 1 + 0x0C
+set $iis1config = $mbar2 - 1 + 0x10
+set $iis2config = $mbar2 - 1 + 0x14
+set $iis3config = $mbar2 - 1 + 0x18
+set $iis4config = $mbar2 - 1 + 0x1C
+set $ebu1config = $mbar2 - 1 + 0x20
+set $ebu1rcvcchannel1 = $mbar2 - 1 + 0x24
+set $ebutxcchannel1 = $mbar2 - 1 + 0x28
+set $ebutxcchannel2 = $mbar2 - 1 + 0x2C
+set $dataincontrol = $mbar2 - 1 + 0x30
+set $pdir1-l = $mbar2 - 1 + 0x34
+set $pdor1-l = $pdir1-l
+set $pdir3-l = $mbar2 - 1 + 0x44
+set $pdor1-r = $pdir3-l
+set $pdir1-r = $mbar2 - 1 + 0x54
+set $pdor2-l = $pdir1-r
+set $pdir3-r = $mbar2 - 1 + 0x64
+set $pdor2-r = $pdir3-r
+set $pdir2 = $mbar2 - 1 + 0x74
+set $pdor3 = $pdir2
+set $uchanneltransmit = $mbar2 - 1 + 0x84
+set $u1channelreceive = $mbar2 - 1 + 0x88
+set $q1channelreceive = $mbar2 - 1 + 0x8C
+set $cdtextcontrol = $mbar2 - 1 + 0x92
+set $interrupten = $mbar2 - 1 + 0x94
+set $interruptclear = $mbar2 - 1 + 0x98
+set $interruptstat = $interruptclear
+set $dmaconfig = $mbar2 - 1 + 0x9F
+set $phaseconfig = $mbar2 - 1 + 0xA3
+set $xtrim = $mbar2 - 1 + 0xA6
+set $freqmeas = $mbar2 - 1 + 0xA8
+
+set $gpio1-read = $mbar2 - 1 + 0xB0
+set $gpio1-out = $mbar2 - 1 + 0xB4
+set $gpio1-enable = $mbar2 - 1 + 0xB8
+set $gpio1-function = $mbar2 - 1 + 0xBC
+
+set $gpio-int-stat = $mbar2 - 1 + 0xC0
+set $gpio-int-clear = $gpio-int-stat
+set $gpio-int-enable = $mbar2 - 1 + 0xC4
+
+set $blockcontrol = $mbar2 - 1 + 0xCA
+set $audioglob = $mbar2 - 1 + 0xCE
+set $ebu2config = $mbar2 - 1 + 0xD0
+set $ebu2rcvcchannel1 = $mbar2 - 1 + 0xD4
+set $u2channelreceive = $mbar2 - 1 + 0xD8
+set $q2channelreceive = $mbar2 - 1 + 0xDC
+
+set $interruptstat3 = $mbar2 - 1 + 0xE0
+set $interruptclear3 = $interruptstat3
+set $interrupten3 = $mbar2 - 1 + 0xE4
+
+set $intpri1 = $mbar2 - 1 + 0x140
+set $intpri2 = $mbar2 - 1 + 0x144
+set $intpri3 = $mbar2 - 1 + 0x148
+set $intpri4 = $mbar2 - 1 + 0x14C
+set $intpri5 = $mbar2 - 1 + 0x150
+set $intpri6 = $mbar2 - 1 + 0x154
+set $intpri7 = $mbar2 - 1 + 0x158
+set $intpri8 = $mbar2 - 1 + 0x15C
+
+set $spurvec = $mbar2 - 1 + 0x167
+set $intbase = $mbar2 - 1 + 0x16B
+
+set $pllcontrol = $mbar2 - 1 + 0x180
+
+set $dmaroute = $mbar2 - 1 + 0x188
+set $ideconfig1 = $mbar2 - 1 + 0x18C
+set $ideconfig2 = $mbar2 - 1 + 0x190
+set $iperroradr = $mbar2 - 1 + 0x194
+set $extraint = $mbar2 - 1 + 0x198
+
+set $adconfig = $mbar2 - 1 + 0x402
+set $advalue = $mbar2 - 1 + 0x406
+
+set $madr2 = $mbar2 - 1 + 0x440
+set $mfdr2 = $mbar2 - 1 + 0x444
+set $mbcr2 = $mbar2 - 1 + 0x448
+set $mbsr2 = $mbar2 - 1 + 0x44C
+set $mbdr2 = $mbar2 - 1 + 0x450
+
+set $flashmediaconfig = $mbar2 - 1 + 0x460
+set $flashmediacmd1 = $mbar2 - 1 + 0x464
+set $flashmediacmd2 = $mbar2 - 1 + 0x468
+set $flashmediadata1 = $mbar2 - 1 + 0x46C
+set $flashmediadata2 = $mbar2 - 1 + 0x470
+set $flashmediastatus = $mbar2 - 1 + 0x474
+set $flashmediainten = $mbar2 - 1 + 0x478
+set $flashmediaintstat= $mbar2 - 1 + 0x47C
+set $flashmediaintclear = $flashmediaintstat
+
+end
diff -ruN m68k-bdm-1.4-pre4/m68k/gdbserver/m68k-bdm-low.c m68k-bdm-1.4-pre4.wo/m68k/gdbserver/m68k-bdm-low.c
--- m68k-bdm-1.4-pre4/m68k/gdbserver/m68k-bdm-low.c 2008-09-09 13:48:50.000000000 +0200
+++ m68k-bdm-1.4-pre4.wo/m68k/gdbserver/m68k-bdm-low.c 2010-02-04 12:24:11.123903747 +0100
@@ -76,7 +76,7 @@
#define M68K_BDM_MARCH_CF52223 (7)
#define M68K_BDM_MARCH_CF5307 (8)
#define M68K_BDM_MARCH_CFV4E (9)
-
+#define M68K_BDM_MARCH_CF5249 (10)
/*
* The CPU labels.
*/
@@ -90,6 +90,7 @@
#define M68K_BDM_MARCH_CF52223_LABEL "CF52223"
#define M68K_BDM_MARCH_CF5307_LABEL "CF5307"
#define M68K_BDM_MARCH_CFV4E_LABEL "CFV4E"
+#define M68K_BDM_MARCH_CF5249_LABEL "CF5249"

/*
* The size of the register in bits.
@@ -153,6 +154,9 @@
extern const int m68k_bdm_cf5307_reg_map_size;
extern const struct m68k_bdm_reg_mapping m68k_bdm_cfv4e_reg_map[];
extern const int m68k_bdm_cfv4e_reg_map_size;
+extern const struct m68k_bdm_reg_mapping m68k_bdm_cf5249_reg_map[];
+extern const int m68k_bdm_cf5249_reg_map_size;
+

/*
* Must match the type of CPU index at the start of this file.
@@ -177,7 +181,9 @@
/* 8 */ { "m68k-cf5307.xml",
m68k_bdm_cf5307_reg_map, &m68k_bdm_cf5307_reg_map_size, 1, 1 },
/* 9 */ { "m68k-cfv4e.xml",
- m68k_bdm_cfv4e_reg_map, &m68k_bdm_cfv4e_reg_map_size, 2, 4 }
+ m68k_bdm_cfv4e_reg_map, &m68k_bdm_cfv4e_reg_map_size, 2, 4 },
+ /* 10 */ { "m68k-cf5249.xml",
+ m68k_bdm_cf5249_reg_map, &m68k_bdm_cf5249_reg_map_size, 1, 1 }
};

const char *m68k_bdm_expedite_regs[] = { "sp", "fp", "pc", 0 };
@@ -280,6 +286,8 @@
"\t-D\tDriver debug level. More than one for more debug.\n" \
"\t-d\tBDM Library debug level. More than one for more debug.\n" \
"\t-t time\tDelay timing for the parallel ports.\n" \
+ "\t-m target\tOverwrite autodetection of the target.\n" \
+ "\t\tUset -m list to see available targets.\n" \
"\tdevice\tThe device to connect to such as /dev/bdmcf0.\n",
PACKAGE_STRING, PACKAGE_NAME);
}
@@ -1394,6 +1402,7 @@
int delay = -1;
int driver_debug_level = 0;
int debug_level = 0;
+ char target_autodetect = 1;

warning_prefix = "m68k-bdm-gdbserver";

@@ -1425,6 +1434,51 @@
case 'h':
m68k_bdm_help ();
break;
+ case 'm':
+ arg++;
+ if ((strncmp(argv[arg],"cf5206",6) == 0) || (strncmp(argv[arg],"cf5206e",7) == 0)) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5200;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5200_LABEL;
+ }
+ else if (strncmp(argv[arg],"cf5235",6) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5235;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5235_LABEL;
+ }
+ else if (strncmp(argv[arg],"cf5249",6) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5249;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5249_LABEL;
+ }
+ else if (strncmp(argv[arg],"cf5272",6) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5272;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5272_LABEL;
+ }
+ else if (strncmp(argv[arg],"cf5282",6) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5282;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5282_LABEL;
+ }
+ else if ((strncmp(argv[arg],"cf52223",7) == 0) || (strncmp(argv[arg],"cf52225",7) == 0) ) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF52223;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5282_LABEL;
+ }
+ else if (strncmp(argv[arg],"cf5307",6) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5307;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5307_LABEL;
+ }
+ else if (strncmp(argv[arg],"cfv4",6) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CFV4E;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CFV4E_LABEL;
+ }
+ else if (strncmp(argv[arg],"cpu32",5) == 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CPU32;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CPU32_LABEL;
+ }
+ else
+ {
+ fatal("%s","Supported targets: cf5206,cf5206e,cf5235,cf5249,cf5272,cf5282,cf52223,cf52235,cf5307,cfv4,cpu32");
+ }
+ printf_filtered("Selected target: %s\n", m68k_bdm_cpu_label);
+ target_autodetect = 0;
+ break;
default:
fatal ("m68k-bdm: invalid option: %s, try -h", argv[arg]);
break;
@@ -1540,51 +1594,53 @@
m68k_bdm_report_error ();
m68k_bdm_cf_debug_ver = (csr >> 20) & 0x0f;

+ if (target_autodetect) {
/*
* If the processor is a version 0 read the PC and VBR
* an if they can be read read the mbar. If that fails
* we have a 5282.
*/
- if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_A) {
- unsigned long junk;
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5200;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5200_LABEL;
- if ((bdmReadSystemRegister (BDM_REG_RPC, &junk) == 0) &&
- (bdmReadSystemRegister (BDM_REG_VBR, &junk) == 0)) {
- if (bdmReadControlRegister (0xc0f, &junk) < 0) {
- /* XCSR on the 5235 */
- if (bdmReadDebugRegister (0x1, &junk) < 0) {
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5282;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5282_LABEL;
- printf_filtered ("m68k-bdm: detected MCF5282\n");
+ if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_A) {
+ unsigned long junk;
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5200;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5200_LABEL;
+ if ((bdmReadSystemRegister (BDM_REG_RPC, &junk) == 0) &&
+ (bdmReadSystemRegister (BDM_REG_VBR, &junk) == 0)) {
+ if (bdmReadControlRegister (0xc0f, &junk) < 0) {
+ /* XCSR on the 5235 */
+ if (bdmReadDebugRegister (0x1, &junk) < 0) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5282;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5282_LABEL;
+ printf_filtered ("m68k-bdm: detected MCF5282\n");
+ }
+ else {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5235;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5235_LABEL;
+ printf_filtered ("m68k-bdm: detected MCF5235\n");
+ }
}
else {
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5235;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5235_LABEL;
- printf_filtered ("m68k-bdm: detected MCF5235\n");
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5272;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5272_LABEL;
+ printf_filtered ("m68k-bdm: detected V2 core\n");
}
}
- else {
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5272;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5272_LABEL;
- printf_filtered ("m68k-bdm: detected V2 core\n");
- }
+ } else if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_B_PLUS) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF52223;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF52223_LABEL;
+ printf_filtered ("m68k-bdm: detected MCF52223 (MCF52235)\n");
+ } else if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_B) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5307;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5307_LABEL;
+ printf_filtered ("m68k-bdm: detected MCF5307\n");
+ } else if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_C) {
+ m68k_bdm_cpu_type = M68K_BDM_MARCH_CFV4E;
+ m68k_bdm_cpu_label = M68K_BDM_MARCH_CFV4E_LABEL;
+ printf_filtered ("m68k-bdm: detected V4e core\n");
+ } else {
+ bdmClose ();
+ error ("m68k-bdm: unknown processor debug version.");
}
- } else if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_B_PLUS) {
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CF52223;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CF52223_LABEL;
- printf_filtered ("m68k-bdm: detected MCF52223 (MCF52235)\n");
- } else if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_B) {
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5307;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5307_LABEL;
- printf_filtered ("m68k-bdm: detected MCF5307\n");
- } else if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_C) {
- m68k_bdm_cpu_type = M68K_BDM_MARCH_CFV4E;
- m68k_bdm_cpu_label = M68K_BDM_MARCH_CFV4E_LABEL;
- printf_filtered ("m68k-bdm: detected V4e core\n");
- } else {
- bdmClose ();
- error ("m68k-bdm: unknown processor debug version.");
}
break;

@@ -1597,7 +1653,7 @@
m68k_bdm_cpu_label, m68k_bdm_dev_name);
if (m68k_bdm_cpu_family == BDM_COLDFIRE)
{
- char* cf_type = "5206(e)/5235/5272/5282";
+ char* cf_type = "5206(e)/5235/5249/5272/5282";
m68k_bdm_ptid = 0x5200;
if (m68k_bdm_cf_debug_ver == M68K_BDM_VER_B) {
cf_type = "5307/5407";
diff -ruN m68k-bdm-1.4-pre4/m68k/gdbserver/m68k-cf5249-regs.c m68k-bdm-1.4-pre4.wo/m68k/gdbserver/m68k-cf5249-regs.c
--- m68k-bdm-1.4-pre4/m68k/gdbserver/m68k-cf5249-regs.c 1970-01-01 01:00:00.000000000 +0100
+++ m68k-bdm-1.4-pre4.wo/m68k/gdbserver/m68k-cf5249-regs.c 2010-02-03 14:10:50.997251250 +0100
@@ -0,0 +1,76 @@
+/* BDM/m68k specific low level interface, for the remote server for GDB.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008 Chris Johns ([email protected]).
+
+ This file is part of M68K BDM.
+
+ 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/>.
+
+ The code in the this file is based on the GDB server code in GDB and
+ the code in M68K BDM GDB patch file called 'remote-m68k-bdm.c'.
+ Based on:
+ 1. `A Background Debug Mode Driver Package for Motorola's
+ 16-bit and 32-Bit Microcontrollers', Scott Howard, Motorola
+ Canada, 1993.
+ 2. `Linux device driver for public domain BDM Interface',
+ M. Schraut, Technische Universitaet Muenchen, Lehrstuhl
+ fuer Prozessrechner, 1995. */
+
+
+#include "m68k-bdm-low.h"
+
+/*
+ * Coldfire Register set, MCF5249.
+ */
+
+struct m68k_bdm_reg_mapping m68k_bdm_cf5249_reg_map[] = {
+ { "d0", M68K_BDM_REG_TYPE_INT32, 0, BDM_REG_D0, 0 },
+ { "d1", M68K_BDM_REG_TYPE_INT32, 1, BDM_REG_D1, 0 },
+ { "d2", M68K_BDM_REG_TYPE_INT32, 2, BDM_REG_D2, 0 },
+ { "d3", M68K_BDM_REG_TYPE_INT32, 3, BDM_REG_D3, 0 },
+ { "d4", M68K_BDM_REG_TYPE_INT32, 4, BDM_REG_D4, 0 },
+ { "d5", M68K_BDM_REG_TYPE_INT32, 5, BDM_REG_D5, 0 },
+ { "d6", M68K_BDM_REG_TYPE_INT32, 6, BDM_REG_D6, 0 },
+ { "d7", M68K_BDM_REG_TYPE_INT32, 7, BDM_REG_D7, 0 },
+ { "a0", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 8, BDM_REG_A0, 0 },
+ { "a1", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 9, BDM_REG_A1, 0 },
+ { "a2", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 10, BDM_REG_A2, 0 },
+ { "a3", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 11, BDM_REG_A3, 0 },
+ { "a4", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 12, BDM_REG_A4, 0 },
+ { "a5", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 13, BDM_REG_A5, 0 },
+ { "fp", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 14, BDM_REG_A6, 0 },
+ { "sp", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 15, BDM_REG_A7, 0 },
+ { "ps", M68K_BDM_REG_TYPE_INT32, 16, BDM_REG_SR, 0 },
+ { "pc", M68K_BDM_REG_TYPE_INT32, 17, BDM_REG_RPC, 0 },
+ { "vbr", M68K_BDM_REG_TYPE_VOID_DATA_PTR, 18, BDM_REG_CTRL (0x801), M68K_BDM_CF_VBR_FLAGS },
+ { "cacr", M68K_BDM_REG_TYPE_INT32, 19, BDM_REG_CTRL (0x002), REG_NON_CACHEABLE },
+ { "acr0", M68K_BDM_REG_TYPE_INT32, 20, BDM_REG_CTRL (0x004), REG_NON_CACHEABLE },
+ { "acr1", M68K_BDM_REG_TYPE_INT32, 21, BDM_REG_CTRL (0x005), REG_NON_CACHEABLE },
+ { "rambar0",M68K_BDM_REG_TYPE_INT32, 22, BDM_REG_CTRL (0xc04), REG_NON_CACHEABLE },
+ { "rambar1",M68K_BDM_REG_TYPE_INT32, 23, BDM_REG_CTRL (0xc05), REG_NON_CACHEABLE },
+ { "mbar", M68K_BDM_REG_TYPE_INT32, 24, BDM_REG_CTRL (0xc0f), REG_NON_CACHEABLE },
+ { "mbar2", M68K_BDM_REG_TYPE_INT32, 25, BDM_REG_CTRL (0xc0e), REG_NON_CACHEABLE },
+ { "csr", M68K_BDM_REG_TYPE_INT32, 26, BDM_REG_DEBUG (0x0), REG_NOT_ACCESSABLE },
+ { "aatr", M68K_BDM_REG_TYPE_INT32, 27, BDM_REG_DEBUG (0x6), REG_NOT_ACCESSABLE },
+ { "tdr", M68K_BDM_REG_TYPE_INT32, 28, BDM_REG_DEBUG (0x7), REG_NOT_ACCESSABLE },
+ { "pbr", M68K_BDM_REG_TYPE_INT32, 29, BDM_REG_DEBUG (0x8), REG_NOT_ACCESSABLE },
+ { "pbmr", M68K_BDM_REG_TYPE_INT32, 30, BDM_REG_DEBUG (0x9), REG_NOT_ACCESSABLE },
+ { "abhr", M68K_BDM_REG_TYPE_INT32, 31, BDM_REG_DEBUG (0xc), REG_NOT_ACCESSABLE },
+ { "ablr", M68K_BDM_REG_TYPE_INT32, 32, BDM_REG_DEBUG (0xd), REG_NOT_ACCESSABLE },
+ { "dbr", M68K_BDM_REG_TYPE_INT32, 33, BDM_REG_DEBUG (0xe), REG_NOT_ACCESSABLE },
+ { "dbmr", M68K_BDM_REG_TYPE_INT32, 34, BDM_REG_DEBUG (0xf), REG_NOT_ACCESSABLE }
+};
+
+const int m68k_bdm_cf5249_reg_map_size = M68K_BDM_REG_NUMBER (m68k_bdm_cf5249_reg_map);
+
diff -ruN m68k-bdm-1.4-pre4/m68k/gdbserver/m68k-cf5249.xml m68k-bdm-1.4-pre4.wo/m68k/gdbserver/m68k-cf5249.xml
--- m68k-bdm-1.4-pre4/m68k/gdbserver/m68k-cf5249.xml 1970-01-01 01:00:00.000000000 +0100
+++ m68k-bdm-1.4-pre4.wo/m68k/gdbserver/m68k-cf5249.xml 2010-02-03 12:07:32.481250216 +0100
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007 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">
+<target>
+ <!-- The 68000 standard registers -->
+ <xi:include href="m68k-core.xml"/>
+ <!-- This is the name used m68k-tdep.c in GDB. -->
+ <feature name="org.gnu.gdb.coldfire.core">
+ <!-- The 5249 specific registers -->
+ <reg name="vbr" bitsize="32" group="system" regnum="18"/>
+ <reg name="cacr" bitsize="32" group="system" regnum="19"/>
+ <reg name="acr0" bitsize="32" group="system" regnum="20"/>
+ <reg name="acr1" bitsize="32" group="system" regnum="21"/>
+ <reg name="rambar0" bitsize="32" group="system" regnum="22"/>
+ <reg name="rambar1" bitsize="32" group="system" regnum="23"/>
+ <reg name="mbar" bitsize="32" group="system" regnum="24"/>
+ <reg name="mbar2" bitsize="32" group="system" regnum="25"/>
+ <reg name="csr" bitsize="32" group="debug" regnum="26"/>
+ <reg name="aatr" bitsize="32" group="debug" regnum="27"/>
+ <reg name="tdr" bitsize="32" group="debug" regnum="28"/>
+ <reg name="pbr" bitsize="32" group="debug" regnum="29"/>
+ <reg name="pbmr" bitsize="32" group="debug" regnum="30"/>
+ <reg name="abhr" bitsize="32" group="debug" regnum="31"/>
+ <reg name="ablr" bitsize="32" group="debug" regnum="32"/>
+ <reg name="dbr" bitsize="32" group="debug" regnum="33"/>
+ <reg name="dbmr" bitsize="32" group="debug" regnum="34"/>
+ </feature>
+</target>
diff -ruN m68k-bdm-1.4-pre4/m68k/gdbserver/Makefile.am m68k-bdm-1.4-pre4.wo/m68k/gdbserver/Makefile.am
--- m68k-bdm-1.4-pre4/m68k/gdbserver/Makefile.am 2008-06-16 02:01:21.000000000 +0200
+++ m68k-bdm-1.4-pre4.wo/m68k/gdbserver/Makefile.am 2010-02-03 14:14:03.713250454 +0100
@@ -31,7 +31,8 @@
$(srcdir)/m68k-cf5282.xml \
$(srcdir)/m68k-cf52223.xml \
$(srcdir)/m68k-cf5307.xml \
- $(srcdir)/m68k-cfv4e.xml
+ $(srcdir)/m68k-cfv4e.xml \
+ $(srcdir)/m68k-cf5249.xml

##
## Only way I know of anding in automake.
@@ -65,7 +66,7 @@
m68k-core-regs.c m68k-cpu32-regs.c m68k-cpu32plus-regs.c\
m68k-cf5200-regs.c m68k-cf52223-regs.c m68k-cf5235-regs.c \
m68k-cf5272-regs.c m68k-cf5282-regs.c m68k-cf5307-regs.c \
- m68k-cfv4e-regs.c
+ m68k-cfv4e-regs.c m68k-cf5249-regs.c

m68k_bdm_gdbserver_CPPFLAGS = \
@CFLAGS@ $(AM_CPPFLAGS)