I spent some time this weekend on the problem, and understand it better now. Remember that this is a 'c32 platform; I haven't used the serial monitor on any other 'hc12 variant. Code ORG'ed at $4000 or at $c000 loads properly using the serial monitor. Upon reset, both code sets execute as expected. Code ORG'ed at $8000 does not load. The monitor writes the first two bytes of code to $8000 and $8001, then goes wild. Attempts to reset or otherwise communicate with the monitor fail. The only thing that restores comm with the monitor is power-cycling the target. I tried manually setting PPAGE prior to such a load, with no improvement. As it happens, I was developing a Win32 app that uses the serial monitor to download code to a 'c32 target. After repeatedly seeing the above failure mode, I recoded the app to handle writes to the paged block ($8000-$bfff) differently. If loading an S19 record would cause a write to an address in that page, the loader (called binload) instead writes that byte to the corresponding address in the lower fixed block ($4000-$7fff). For example, a write of $a9 to $8040 would instead go to $4040. This technique works because, following reset in RUN mode, the low bit of PPAGE is cleared, duplicating the lower fixed block to the paged block. Since the conents of that block were compiled to appear at $8000, the addresses are all correct. Naturally, this technique won't work too well with other 'hc12 variants. :-) I've completed work (for now) on the binload utility and placed it on my website at www.seanet.com/~karllunt. I've also uploaded a pdf version of the user's manual. binload is a menu-based DOS-style Win32 app. When it runs, you see a DOS-style window with a command prompt. binload is not a debugger, more of a loader. It does let you view and change bytes or words of memory, but it doesn't do trace or disassembly or other fancy stuff. It was built solely to move S19 files into a 'c32 target. binload also takes a set of command-line options that let you do a series of commands without ever opening the DOS window. Using the proper options, you can reset the target, erase flash, download code, and quit binload without ever having to enter a command or even see the command prompt. This lets you do rapid development cycles and even some production downloads. If you find any problems with binload, drop me an email at Karl "zeta_alpha2002" <zeta_alpha2002@ To: yahoo.com> cc: Subject: [68HC12] Re: S12 serial monitor on C32 01/23/2004 02:37 PM Please respond to 68HC12 Initially I org my code to start from $8000. That is how I ran into a problem with the Monitor. To get around it I re-org my code to start at $4000 and set MCUez parameters for non-banked. When my program were org at $8000 I did used the Monitor to run it. The reason it ran is that the monitor already manipulated the PPAGE. However when having the switch move to RUN the PPAGE hasn't been initialize so that the program that were there seem to vanish. Ergo nothing works. I haven't done this but maybe you could try org your code at $C000 then set PPAGE appropiately then jmp or jsr into $8000. Maybe Gordon may have an answer? Is there a fix to monitor for the 9S12C32? I played around with the 9S12C128 with monitor and there is no problem as far as I am aware. --- In , karl.lunt@a... wrote: > As you say, the flash is $4000-$7fff and $c000-$fff; my first post was > incorrect. > > I cannot find any accesses of the PPAGE register in the initial monitor > code, so I still don't understand how (or even if) my code at $8000 is > moving. > > I don't want to have to link my program in two 16K sections, nor should I > have to. The chip as it comes out of reset (without the monitor) has a > contiguous 32K flash map, even though the low 16K of this is actually a > mirror of the lowest, fixed, 16K section. Leaving the monitor intact > appears to break this somehow, and I'm trying to understand how. > > Karl > > > "zeta_alpha2002" > <zeta_alpha2002@ To: > yahoo.com> cc: > Subject: [68HC12] Re: S12 serial monitor on C32 > 01/23/2004 08:08 > AM > Please respond > to 68HC12 > > > > > Can someone enlighten me? The Tech Arts docs show that the C32 has > >a broken memory map > > >Can someone enlighten me? The Tech Arts docs show that the C32 has a > >broken memory map, with flash from $4000-$7fff and $8000-$ffff, > > I had the same problem. The FLASH is broken down as $4000 - $7FFF, > $C000 - $FFFF > > The loader manipulate the PPAGE to program $4000 - $7FFF > > You should write your code so that they reside at $4000 - $7FFF, > $C000 - $FFFF. This way you don't care about the PPAGE. > > With monitor these needs to be init. > > movb #$00,INITRG ;set registers at > $0000 > movb #$39,INITRM ;move and set ram > to end at > $3fff > > > --------------------To learn more about > Motorola Microcontrollers, please visit > http://www.motorola.com/mcu > o learn more about Motorola Microcontrollers, please visit > http://www.motorola.com/mcu > > ______________________________________________________________________ __ > This email has been scanned for all viruses by the MessageLabs Email > Security System. For more information on a proactive email security > service working around the clock, around the globe, visit > http://www.messagelabs.com > ______________________________________________________________________ __ ______________________________________________________________________ __ > This email has been scanned for all viruses by the MessageLabs Email > Security System. For more information on a proactive email security > service working around the clock, around the globe, visit > http://www.messagelabs.com > ______________________________________________________________________ __ --------------------To learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu o learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________ ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________ |