This message contains an entire topic ported from the WildRice - Coldfire forum. Freescale has received the approval from the WildRice administrator on seeding the Freescale forum with messages. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value as you search for answers to your questions. Freescale assumes no responsibility whatsoever with respect to Posted Material. For additional information, please see the Terms of Use - Message Boards and Community Forums. Thank You and Enjoy the Forum!
Mar 21, 2005, 9:59 AM Post #1 of 25 (516 views)
[ColdFire] custom 5206e board gdb initialization
--------------------------------------------------------------------------------
Hi ,
Well I have now compiled all the tools, I can access the BDM adaptor
on a linux PC, and now I want to load a binary image into my board's
internal SRAM and then burn it to flash.
This will test setting up the chip selects of my custom board.
I have created gdb scripts as follows:
define addresses
set $rambar = 0x20000001
set $mbar = 0x10000000
set $rom-base = 0xffe00000
set $ram-base = 0x30000000
set $rambar0 = 0xc04
set $rambar1 = 0xc05
set $mbar-reg = 0xc0f
set $cacr = 0x2
set $acr0 = 0x4
set $acr1 = 0x5
set $acr2 = 0x6
set $acr3 = 0x7
set $vbr = 0x801
set $simr = $mbar + 0x003
set $icr1 = $mbar + 0x014
set $icr2 = $mbar + 0x015
set $icr3 = $mbar + 0x016
set $icr4 = $mbar + 0x017
set $icr5 = $mbar + 0x018
set $icr6 = $mbar + 0x019
set $icr7 = $mbar + 0x01A
set $icr8 = $mbar + 0x01B
set $icr9 = $mbar + 0x01C
set $icr10 = $mbar + 0x01D
set $icr11 = $mbar + 0x01E
set $icr12 = $mbar + 0x01F
set $icr13 = $mbar + 0x020
set $icr14 = $mbar + 0x021
set $icr15 = $mbar + 0x022
set $imr = $mbar + 0x036
set $ipr = $mbar + 0x03A
set $rsr = $mbar + 0x040
set $sypcr = $mbar + 0x041
set $swivr = $mbar + 0x042
set $swsr = $mbar + 0x043
set $par = $mbar + 0x0ca
set $csar7 = $mbar + 0x0B8
set $csmr7 = $mbar + 0x0BC
set $cscr7 = $mbar + 0x0C2
set $dmcr = $mbar + 0x0C6
set $par = $mbar + 0x0CA
set $tmr1 = $mbar + 0x100
set $trr1 = $mbar + 0x104
set $tcr1 = $mbar + 0x108
set $tcn1 = $mbar + 0x10C
set $ter1 = $mbar + 0x111
set $tmr2 = $mbar + 0x120
set $trr2 = $mbar + 0x124
set $tcr2 = $mbar + 0x128
set $tcn2 = $mbar + 0x12C
set $ter2 = $mbar + 0x131
end
define setup-cs
set *((short*) $csar0) = 0xffe0
set *((short*) $csmr0) = 0x001f0000
set *((short*) $cscr0) = 0x05a3
set *((short*) $csar1) = 0x4001
set *((short*) $csmr1) = 0x00000000
set *((short*) $cscr1) = 0x0d23
set *((short*) $csar2) = 0x3000
set *((short*) $csmr2) = 0x001f0000
set *((short*) $cscr2) = 0x0503
set *((short*) $csar3) = 0x4000
set *((short*) $csmr3) = 0x000f0000
set *((short*) $cscr3) = 0x0d03
end
These gdb commands are in a file called mtpFlashPgm.gdb
So now I want to start up gdb
I execute
>m68k-bdm-elf-gdb -n -x $COLDFIRE/gdbScripts/mtpFlashPgm.gdb
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=m68k-bdm-elf".
(gdb) target bdm /dev/bdmcf0
trying kernel driver: /dev/bdmcf0
trying bdm server: localhost:/dev/bdmcf0
Detected V2 core
GDB target bdm connected to /dev/bdmcf0
Coldfire debug module version is 0 (5206(e)/5272/5282)
(gdb) bdm-reset
(gdb) help user-define
User-defined commands.
The commands in this class are those defined by the user.
Use the "define" command to define a command.
List of commands:
addresses -- User-defined
flash-erase -- User-defined
flash-program -- User-defined
flash-programstartaddr -- User-defined
flash-programword -- User-defined
initboard -- User-defined
setup-cs -- User-defined
setup-entry -- User-defined
setup-sram -- User-defined
Type "help" followed by command name for full documentation.
Command name abbreviations are allowed if unambiguous.
(gdb) addresses
No symbol table is loaded. Use the "file" command.
Why doesn't this work?
How can I directly access the 5206e registers directly, I want to
invalidate cache, while I am using the debugger.
(gdb) bdm-read-creg /x $cacr
Value can't be converted to integer.
Thanks for all your help
Jayne
--------------------------------------------------------------------
Mar 21, 2005, 3:19 PM
Post #2 of 25 (512 views)
[ColdFire] GNU (no)load [In reply to]
--------------------------------------------------------------------------------
Hi all ---
This should really go on a GNU mailing list, but ironically, while I've
found lists for "users and installers of GNU JEL" and "mcron" I haven't
found one for the simple old GNU compile-and-link chain. Any pointers
welcome!
My (today's) problem is this. I have a bunch of code that goes into
EEPROM, then a small bit that goes into RAM for faster execution. My
fast-execution assembly file says
==================================================================
.section timecritical
PrimedGo:
link a6,#64
movem.l #0xFFFF,(a7) | Save all registers to stack
... blah blah assembly code...
rte
.end
==================================================================
My linker command file says
==================================================================
MEMORY
{
.TEXT (RX) : ORIGIN = 0x00100000, LENGTH = 80k
.TEXT.RAM (RWX): ORIGIN = 0x60000400, LENGTH = 4k
.DATA (RW) : ORIGIN = 0x60004000, LENGTH = 12k
}
SECTIONS
{
.application_text : /* code and constants */
{
*(startup) *(.text) *(.strings) *(.rodata) *(.lit)
} > .TEXT
.ram_program : /* code running in ram instead of rom */
{
*(timecritical)
} > .TEXT.RAM
.initialized_data :
{
*(.data)
} > .DATA
.uninitialized_data :
{
. = ALIGN(0x4);
__bss_start = .;
*(.bss)
*(COMMON)
_end = ALIGN(0x8);
__end = _end;
} > .DATA
}
==================================================================
But when I link, I get the following in my .elf:
0 .application_text 000041ce 00100000 00100000 00002000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .ram_program 000003f8 60000400 60000400 00008020 2**0
CONTENTS, READONLY
2 .initialized_data 00000020 60004000 60004000 00008000 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .uninitialized_data 000009e0 60004020 60004020 00008020 2**2
ALLOC
... and nothing in the world I can do will get the LOAD attribute to
show up for the .ram_program section. There are lots of ways to set
NOLOAD, in the linker, in the assembler, but no way to tell it to go
ahead and LOAD this section. As a result, nothing shows up in any of my
object files. I've tried objcopy to change the attribute, no luck. It
will change every attribute other than LOAD.
Any suggestions?
Thanks as always ---
--Scott
--------------------------------------------------------------------
Mar 21, 2005, 3:22 PM
Post #3 of 25 (505 views)
Re: [ColdFire] custom 5206e board gdb initialization [In reply to]
--------------------------------------------------------------------------------
Jayne Dickinson wrote:
>
> set $rom-base = 0xffe00000
I think this is saying '$rom' minus 'base' and GDB is assuming 'base' is
a symbol.
>
> How can I directly access the 5206e registers directly, I want to
> invalidate cache, while I am using the debugger.
>
> (gdb) bdm-read-creg /x $cacr
> Value can't be converted to integer.
>
What happens if you do not supply the '/x' option ?
The 5206e registers should be defined, ie try 'info reg' and if you get
a no selected frame issue 'select 0' first.
--
Chris Johns
--------------------------------------------------------------------
Mar 22, 2005, 6:46 AM
Post #4 of 25 (505 views)
Re: [ColdFire] custom 5206e board gdb initialization [In reply to]
--------------------------------------------------------------------------------
Thanks Chris,
I started m68k-bdm-elf-gdb and can now see the registers...but
bdm-read-creg $cacr isn't returning the value of the cacr register
Here's my trace of what I performed this morning.....
>m68k-bdm-elf-gdb -n -x $COLDFIRE/gdbScripts/mtpStart.gdb bblock.elf
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=m68k-bdm-elf"...
(gdb) target bdm /dev/bdmcf0
trying kernel driver: /dev/bdmcf0
trying bdm server: localhost:/dev/bdmcf0
Detected V2 core
GDB target bdm connected to /dev/bdmcf0
Coldfire debug module version is 0 (5206(e)/5272/5282)
(gdb) info registers
No selected frame.
(gdb) select 0
Current language: auto; currently c++
(gdb) bdm-read-creg $cacr
Value can't be converted to integer.
(gdb) bdm-read-creg $mbase
Value can't be converted to integer.
(gdb) info registers
d0 0x1 1
d1 0x10000c0 16777408
d2 0xd2 210
d3 0xd3 211
d4 0xd4 212
d5 0xd5 213
d6 0x10000000 268435456
d7 0xd7 215
a0 0x10000000 0x10000000
a1 0x3000ed48 0x3000ed48
a2 0xffe12a80 0xffe12a80
a3 0xa3 0xa3
a4 0xa4 0xa4
a5 0xa5 0xa5
fp 0x20000000 0x20000000
sp 0x20000000 0x20000000
ps 0x2700 9984
pc 0xffe00000 0xffe00000 <_VECTOR_TABLE>
vbr 0x74 116
cacr 0x0 0
acr0 0x0 0
acr1 0x0 0
rambar 0x20000000 536870912
mbar 0x10000000 268435456
macsr 0x8 8
mask 0xffff5555 -43691
acc 0xff4d0166 -11730586
csr 0x1000000 16777216
aatr 0x5 5
tdr 0x40000000 1073741824
pbr 0x0 0
pbmr 0x0 0
abhr 0x0 0
ablr 0x0 0
dbr 0x0 0
dbmr 0x0 0
(gdb)
(gdb) hb main
Hardware assisted breakpoint 1 at 0xffe02f34: file main.c, line 140.
(gdb) run
Starting program:
/home/jayned/mtpDev/mtpRev3Baseline/BootBlock/bblock.elf
BDM driver error: No response to BDM request
(gdb)
On Mon, 2005-03-21 at 16:22, Chris Johns wrote:
> Jayne Dickinson wrote:
> >
> > set $rom-base = 0xffe00000
>
> I think this is saying '$rom' minus 'base' and GDB is assuming 'base' is
> a symbol.
>
> >
> > How can I directly access the 5206e registers directly, I want to
> > invalidate cache, while I am using the debugger.
> >
> > (gdb) bdm-read-creg /x $cacr
> > Value can't be converted to integer.
> >
>
> What happens if you do not supply the '/x' option ?
>
> The 5206e registers should be defined, ie try 'info reg' and if you get
> a no selected frame issue 'select 0' first.
--------------------------------------------------------------------
Mar 22, 2005, 7:08 AM
Post #5 of 25 (504 views)
Re: [ColdFire] custom 5206e board gdb initialization [In reply to]
--------------------------------------------------------------------------------
Don't do run - try 'cont' or 'c'
Mark
Message from Jayne Dickinson
received on 03/22/2005
09:46 AM
03/22/2005 Jayne Dickinson 09:46 AM
To: Mark C.
cc:
Subject: Re: [ColdFire] custom 5206e board gdb initialization
Thanks Chris,
I started m68k-bdm-elf-gdb and can now see the registers...but
bdm-read-creg $cacr isn't returning the value of the cacr register
Here's my trace of what I performed this morning.....
>m68k-bdm-elf-gdb -n -x $COLDFIRE/gdbScripts/mtpStart.gdb bblock.elf
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=m68k-bdm-elf"...
(gdb) target bdm /dev/bdmcf0
trying kernel driver: /dev/bdmcf0
trying bdm server: localhost:/dev/bdmcf0
Detected V2 core
GDB target bdm connected to /dev/bdmcf0
Coldfire debug module version is 0 (5206(e)/5272/5282)
(gdb) info registers
No selected frame.
(gdb) select 0
Current language: auto; currently c++
(gdb) bdm-read-creg $cacr
Value can't be converted to integer.
(gdb) bdm-read-creg $mbase
Value can't be converted to integer.
(gdb) info registers
d0 0x1 1
d1 0x10000c0 16777408
d2 0xd2 210
d3 0xd3 211
d4 0xd4 212
d5 0xd5 213
d6 0x10000000 268435456
d7 0xd7 215
a0 0x10000000 0x10000000
a1 0x3000ed48 0x3000ed48
a2 0xffe12a80 0xffe12a80
a3 0xa3 0xa3
a4 0xa4 0xa4
a5 0xa5 0xa5
fp 0x20000000 0x20000000
sp 0x20000000 0x20000000
ps 0x2700 9984
pc 0xffe00000 0xffe00000 <_VECTOR_TABLE>
vbr 0x74 116
cacr 0x0 0
acr0 0x0 0
acr1 0x0 0
rambar 0x20000000 536870912
mbar 0x10000000 268435456
macsr 0x8 8
mask 0xffff5555 -43691
acc 0xff4d0166 -11730586
csr 0x1000000 16777216
aatr 0x5 5
tdr 0x40000000 1073741824
pbr 0x0 0
pbmr 0x0 0
abhr 0x0 0
ablr 0x0 0
dbr 0x0 0
dbmr 0x0 0
(gdb)
(gdb) hb main
Hardware assisted breakpoint 1 at 0xffe02f34: file main.c, line 140.
(gdb) run
Starting program:
/home/jayned/mtpDev/mtpRev3Baseline/BootBlock/bblock.elf
BDM driver error: No response to BDM request
(gdb)
On Mon, 2005-03-21 at 16:22, Chris Johns wrote:
> Jayne Dickinson wrote:
> >
> > set $rom-base = 0xffe00000
>
> I think this is saying '$rom' minus 'base' and GDB is assuming 'base' is
> a symbol.
>
> >
> > How can I directly access the 5206e registers directly, I want to
> > invalidate cache, while I am using the debugger.
> >
> > (gdb) bdm-read-creg /x $cacr
> > Value can't be converted to integer.
> >
>
> What happens if you do not supply the '/x' option ?
>
> The 5206e registers should be defined, ie try 'info reg' and if you get
> a no selected frame issue 'select 0' first.
--------------------------------------------------------------------
Message Edited by Dietrich on 04-03-2006 10:46 AM
Message Edited by Dietrich on 04-04-2006 09:05 PM