EmbeddedRelated.com
Forums
Memfault Beyond the Launch

MC 68360: first start by BDM with empty flash?

Started by Andreas Hadler January 14, 2005
Hello,

I'm designing a board based on the MC68360, and I'd like to wire some
Flash directly to CS0 (CSBOOT). I will provide a BDM-connector and use
this for the first start of the board.

On the first startup, I don't have any code in the Flash, so I have to
program the Flash via BDM. For this, I'd like to download a little
program into RAM - but hey, can I get access to my RAM right now? I
have to set MBAR to access the CS-registers. To set MBAR, according to
the data sheet, I have to use a MOVES-instruction.

Is any BDM out there, that supports a MOVES? Or is direct flash
programming by BDM my only option?

Andreas
-- 
Good judgment comes from experience. Unfortunately, the experience
usually comes from bad judgment.

"Andreas Hadler" <Andreas.Hadler@t-online.de> wrote in message
news:vtlgu0944cv5o54ohco777c0nsdd78mt6j@4ax.com...
> Hello, > > I'm designing a board based on the MC68360, and I'd like to wire some > Flash directly to CS0 (CSBOOT). I will provide a BDM-connector and use > this for the first start of the board. > > On the first startup, I don't have any code in the Flash, so I have to > program the Flash via BDM. For this, I'd like to download a little > program into RAM - but hey, can I get access to my RAM right now? I > have to set MBAR to access the CS-registers. To set MBAR, according to > the data sheet, I have to use a MOVES-instruction. > > Is any BDM out there, that supports a MOVES? Or is direct flash > programming by BDM my only option? > > Andreas > -- > Good judgment comes from experience. Unfortunately, the experience > usually comes from bad judgment. >
Look at www.macraigor.com - they have what you need... regards Dejan
On Sat, 15 Jan 2005 00:37:42 +0100, Andreas Hadler wrote:

> Hello, > > I'm designing a board based on the MC68360, and I'd like to wire some > Flash directly to CS0 (CSBOOT). I will provide a BDM-connector and use > this for the first start of the board. > > On the first startup, I don't have any code in the Flash, so I have to > program the Flash via BDM. For this, I'd like to download a little > program into RAM - but hey, can I get access to my RAM right now? I > have to set MBAR to access the CS-registers. To set MBAR, according to > the data sheet, I have to use a MOVES-instruction. > > Is any BDM out there, that supports a MOVES? Or is direct flash > programming by BDM my only option? > > Andreas
Via the BDM, you can read and write processor registers, system registers, memory, and memory-mapped peripherals. The basic idea is to use the BDM to set up the chip selects, clock module, ram module, and any other initialisation you need. You then download a flash programmer stub (as you suggested) to ram, and the flash image to a ram buffer (depending on sizes, the buffer may need to be used many times over). The BDM starts the burner program, which exists to the BDM with a "break" instruction. There are commercial programs that automate this - we have used P&E Micro's flasher program with their BDM unit. You can also roll your own - try sourceforge.net/projects/bdm/ as a starter. It's also quite possible (and practical) to use gdb scripts.
David <david.nospam@westcontrol.removethis.com> wrote:

>On Sat, 15 Jan 2005 00:37:42 +0100, Andreas Hadler wrote:
>> On the first startup, I don't have any code in the Flash, so I have to >> program the Flash via BDM. For this, I'd like to download a little >> program into RAM - but hey, can I get access to my RAM right now? I >> have to set MBAR to access the CS-registers. To set MBAR, according to >> the data sheet, I have to use a MOVES-instruction.
Sorry to follow up to my own posting, but I just discovered, that even Scott Howards's old BDM supports this by the "FC" command. That's enough to get access to MBAR - just "FC 7" and write to MBAR.
>Via the BDM, you can read and write processor registers, system registers, >memory, and memory-mapped peripherals. The basic idea is to use the BDM >to set up the chip selects, clock module, ram module, and any other >initialisation you need. You then download a flash programmer stub (as >you suggested) to ram, and the flash image to a ram buffer (depending on
Thanks, David. The problem with the 68360 is, that there are no special registers (chip selects etc.) available until you assign them a base address by writing to MBAR. So the only thing you can access is the memory adressed by CS0 (Flash, in my case). And MBAR is only accessable in CPU-Space, i.e. with a Function Code 7, which, again, by a program, can only be done using the MOVES-instruction after setting DFC and SFC. I just didn't saw a way to force the BDM to use the appropriate function code - maybe, I read the manual with my eyes wide shut. Thanks. Andreas -- It's not the things you don't know what gets you into trouble. It's the things you do know that just ain't so. - Will Rogers
Andreas Hadler wrote:

> Thanks, David. The problem with the 68360 is, that there are no > special registers (chip selects etc.) available until you assign them > a base address by writing to MBAR. So the only thing you can access is > the memory adressed by CS0 (Flash, in my case).
Years ago, I did a project using 2 68360s, one as a slave. Surprised when powering up the prototype- it kept resetting itself. The answer was that while the BDM inhibited the master watchdog, it did nothing about the slave, which timed out merrily and reset everything else. Boohoo. Had to add a buffer, OC of course, and this was before single- gate packages were widely available. I think Motorola missed a trick there. Paul Burke
On Mon, 17 Jan 2005 21:14:52 +0100, Andreas Hadler wrote:

> David <david.nospam@westcontrol.removethis.com> wrote: > >>On Sat, 15 Jan 2005 00:37:42 +0100, Andreas Hadler wrote: > >>> On the first startup, I don't have any code in the Flash, so I have to >>> program the Flash via BDM. For this, I'd like to download a little >>> program into RAM - but hey, can I get access to my RAM right now? I >>> have to set MBAR to access the CS-registers. To set MBAR, according to >>> the data sheet, I have to use a MOVES-instruction. > > Sorry to follow up to my own posting, but I just discovered, that even > Scott Howards's old BDM supports this by the "FC" command. That's > enough to get access to MBAR - just "FC 7" and write to MBAR. > >>Via the BDM, you can read and write processor registers, system registers, >>memory, and memory-mapped peripherals. The basic idea is to use the BDM >>to set up the chip selects, clock module, ram module, and any other >>initialisation you need. You then download a flash programmer stub (as >>you suggested) to ram, and the flash image to a ram buffer (depending on > > Thanks, David. The problem with the 68360 is, that there are no > special registers (chip selects etc.) available until you assign them > a base address by writing to MBAR. So the only thing you can access is > the memory adressed by CS0 (Flash, in my case). And MBAR is only > accessable in CPU-Space, i.e. with a Function Code 7, which, again, by > a program, can only be done using the MOVES-instruction after setting > DFC and SFC. I just didn't saw a way to force the BDM to use the > appropriate function code - maybe, I read the manual with my eyes wide > shut. >
I've only used the 68332 (and recently a ColdFire), which has doesn't have this problem. However, I note that in the bdm drivers on sourceforge, the drivers will automatically set the DFC and SFC when you access the MBAR register. David
> Thanks. > > Andreas

Memfault Beyond the Launch