Question on Programming an HCS08

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question on Programming an HCS08

1,353 Views
Geomancer
Contributor I

I'm looking to use an HCS08 along with a Xilinx Spartan-6 FPGA, and I would greatly like to use the FPGA to perform the BDM functions (debugging and programming) in addition to interfacing with the computer.

 

My question is, can this easily be done from Code Warrior, or will it be quite a chore since I do not have an actual programmer with drivers?

 

My question is really, is there an option in CW to just spit out the S19 file on a serial port, and perform the bebug functions without their being special (ie proprietary) commands between a standard programmer and the PC?

 

I know I could get the programming accomplished thorough other means, but would like to do it within CW if possible and better yet get the in-circuit debugging.

 

If there is already documentation on this you can just point me to that. I saw the ones for the BDM interface itself so I'm set on that end.

 

Thanks!

Labels (1)
Tags (1)
0 Kudos
8 Replies

646 Views
Geomancer
Contributor I

Humm ... should I be asking in a different forum?

 

Otherwise I'll have to go with a PIC, as they have the documentation easily avalible. I was hopeing to go with Freescale as I have some experience with the devices and know the instruction set well.

0 Kudos

645 Views
kef
Specialist I
  • Humm ... should I be asking in a different forum?

You could ask more clearly. I read you post a couple of times and it still is not clear do you want to program your FPGA via S08, or do you want to program S08 via FPGA. See below

 

  • Otherwise I'll have to go with a PIC, as they have the documentation easily avalible.

Freescale documentation for BDM protocol and flash programming also is easily available. Just read your datasheets.

 

  • I'm looking to use an HCS08 along with a Xilinx Spartan-6 FPGA, and I would greatly like
  • to use the FPGA to perform the BDM functions (debugging and programming) in addition
  • to interfacing with the computer.

You should look into Development Support chapter in reference manual or data sheet for your derivative. Communication Details talks about BDM timing. BDC Commands talks about available BDM commands. Flash programming can be done writing using BDM commands to flash control rgisters and flash array. See Flash in Memory chapter.

  

  • My question is, can this easily be done from Code Warrior, or will it be quite a chore since I do not ]
  • have an actual programmer with drivers?

Do you mean you are going to write your own debugger driver for your own custom BDM interface, so that CW debugger will use your FPGA to program S08? Well, I don't know if such documentation is available. You may look into OSBDM forums, maybe you will manage to emulate OSBDM software and hardware on your FPGA.

 

  • My question is really, is there an option in CW to just spit out the S19 file on a serial port,

By default on each build CW makes S19 file and puts it in your projects bin folder. (Though, I'm not sure about bin folder location in CW 10.x).

 

 

  • and perform the bebug functions without their being special (ie proprietary) commands between
  • a standard programmer and the PC?

BDM commands are not proprietary! They are well documented. Breakpoints hardware and associated registers also are well documented. You can make you S08 go, halt and stop on breakpoints, so you can make your own debugger.

 

  • I know I could get the programming accomplished thorough other means, but would like to do
  • it within CW if possible and better yet get the in-circuit debugging.

So you are looking for CW debugger driver API? You want to make your own CW debugger driver? I don't know where to find such documentation 

0 Kudos

645 Views
Geomancer
Contributor I

My appologies if I was not clear.

 

Think of it as the following chain: PC <==> FPGA <==> HCS08

Where normally you have PC <==> Programmer <==> HCS08

 

I am 100% confident in the FPGA <==> HCS08 link, as you've mentioned that is clear in the datasheet and various other documentation, this is the BDM interface.

 

What is not clear, and what I would like to know, is the PC <==> Programmer interface. I can use Hyperterminal, or similar, to simply program the HCS08 since the S19 file structure which is well defined, and I can make the FPGA do the approriate BDM commands to program the HCS08.

 

What I would like though, is to use CW directly so that I can use the in-circuit debug features. But to do that, I need to know the PC <==> Programmer interface for an RS-232 serial link. For example, if I want to run thorugh my code line by line, what is sent on the RS-232 inteface when I click the "Next Step" button in CW? I assume it comprises multiple commands, from setting breakpoints to reading back registers. This is the documentation I would like.

0 Kudos

645 Views
rocco
Senior Contributor II

Hi Geomancer,

 

. . . Now I understand. Like Kef, I was confused by the first post.

 

It sounds like you wish to program the FPGA to emulate one of the CodeWarrior supported BDM interfaces. That's no small undertaking.

 

Except for the USBDM and the OSBDM (which is now obsolete), I know of no documentation for the inner-workings of the debugging interfaces. I am not familiar with any serial-port based interfaces either, as they seem to be all USB based now. So it is likely that you would need a USB interface as well, either internal or external to the FPGA.

 

If you look at the USBDM firmware, which is open-source, you can get an idea of what you would need to implement. I suspect that all prior BDM interfaces have been firmware-based, so coding it in an FPGA may need a considerable amount of resources. As FPGAs are not cheap, it may end up being an expensive way to go. I realize that you already have the FPGA on the board, but I suspect a debugging interface would require you to go to the next larger size (if it fits at all).

 

I would suggest just putting the M9S08JS16 on the board and using the standard USBDM firmware. That will give you a supported debugging interface with the USB interface on-chip. I think it would be a lot simpler and cheaper than trying to put all of that BDM firmware into an FPGA.

 

However, if there was documentation on writing a debugging driver for CodeWarrior, or even an existing low-level driver, then it might be a different story.

0 Kudos

645 Views
Geomancer
Contributor I

Thank you for your thoughts.

 

I was afraid that would be my only option, reverse engineering the open source firmware.

 

You'd be suprised what can fit in an FPGA though :smileyhappy:

 

I have 6,822 slices avalible and a PicoBlaze microprocessor only uses 26 of those slices :smileyvery-happy:

 

A PicoBlaze is an extreamly simple 8-bit MCU, but one can easily handle the FPGA->HCS08 interface conversion (and run at a 100 MHz speed which is far faster than the HCS08). I wanted to use an RS-232 interface because it does not require a driver on the PC to use. USB does though.

 

So why have the HCS08? They're far more sophisticated and while I could recreate one in the FPGA that's a huge task. My plan was to have the HCS08 be the brains, while the FPGA handles all the interfaces (things like Ethernet, HDMI, Audio, etc).

0 Kudos

645 Views
kef
Specialist I

Geomancer,

 

you may consider www.noicedebugger.com  debugger. They support <=64kB S08's and have serial monitor target. Serial protocol is pretty simple and it should be easy to implement on FPGA so that instead of running small serial monitor on S08, you may make FPGA handling debuggers commands and send required BDM commands to S08. I once did it for for S12. Instead of patching code with SWI instrucions to implement software breakpoints, I was manipulating S12 breakpoints registers. Worked well.

0 Kudos

645 Views
rocco
Senior Contributor II

Hi Geomancer,


Geomancer wrote:

 

You'd be surprised what can fit in an FPGA though :smileyhappy:

 

I have 6,822 slices available and a PicoBlaze microprocessor only uses 26 of those slices :smileyvery-happy:


No, I would not be surprised. I use them all of the time, but have yet to put a uC in one. I did not realize a uC could be so inexpensive.

 

I was imagining you having to code the USBDM firmware into VHDL or Verilog, and then compiling it into massive amounts of gates.

 


A PicoBlaze is an extremely simple 8-bit MCU, but one can easily handle the FPGA->HCS08 interface conversion (and run at a 100 MHz speed which is far faster than the HCS08). I wanted to use an RS-232 interface because it does not require a driver on the PC to use. USB does though.

That's great. It sounds like you would have sale-able IP if you can port the USBDM firmware to PicoBlaze.

 

But I don't think CodeWarior supports any serial-port debuggers. And if you can fully emulate the USBDM in PicoBlaze firmware, then the USB driver will be provided in CodeWarrior. You would also need to put some USB hardware in the FPGA.

 

Then there is the issue of newer computers not being equipped with serial ports. On my most recent board, where I used to update the firmware through the serial port on the prior generation board, I added an FTDI USB-to-serial chip so that I could use just a USB cable (and not a serial-port dongle, which was unreliable). The windows-supplied virtual-comm-port driver worked such that the programming software couldn't tell the difference.

 

So now I use a standard USBDM for debugging, and a virtual-comm-port over USB for configuration and firmware updates.

0 Kudos

646 Views
Geomancer
Contributor I

rocco wrote:

 

But I don't think CodeWarior supports any serial-port debuggers. And if you can fully emulate the USBDM in PicoBlaze firmware, then the USB driver will be provided in CodeWarrior. You would also need to put some USB hardware in the FPGA.

 

Then there is the issue of newer computers not being equipped with serial ports. On my most recent board, where I used to update the firmware through the serial port on the prior generation board, I added an FTDI USB-to-serial chip so that I could use just a USB cable (and not a serial-port dongle, which was unreliable). The windows-supplied virtual-comm-port driver worked such that the programming software couldn't tell the difference.

 



The FPGA does support USB, I have a development board that is decked in almost any interface you could think of. The challenge is fooling the Windows driver into believing it is connected to a programming Pod.

 

The P&E Cyclone Pro says it supports a serial interface with a PC which I think is my best bet. I can have the FPGA record what it recieves and use that to learn what commands CW is sending out through it.

 

It is the same with this FPGA as you mention for the serial port. In reality it is USB, but has a USB to Serial conversion chip to fool windows into thinking it's a standard COM port.

 

So it looks like my options are to either copy the OSBDM for a USB interface, or attempt to spoof the Cyclone Pro Serial link. Thank you both for your insights.

0 Kudos