Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
|
I am currently writing firmware for a project that uses the MC9S12DJ256 microcontroller. I am doing all of my developing in RAM with the NOICE debugger. Right now I am working on firmware updates that are stored in the flash and then copied from one half of the flash to the other. Is there any way to run out of RAM and still have access to flash? Jason M. Liszewski |
|
|
|
Jason, If you haven't read Freescale/Motorola AN2400/D, you should. It is a valuable summary of almost all you need to know about programming flash memory. It is no problem for a program executing from RAM to access flash locations. That is the way a lot of flash programming is done. Typically, you will have the RAM in some location below the flash window at 0x8000 - 0xBFFF. Write the code to run at the RAM location or make it position independent. To access the flash locations, set the PPAGE register to the page (NOT array Number) you want, and read or write to the "corresponding" address in the 0x8000 - 0xBFFF range. Other than keeping straight where the registers and RAM are, and what the "corresponding" location in flash is, its pretty straightforward. The main restriction is that you cannot execute code or read out of a flash array or block that is being programmed. In the case of the DJ256 there are 4 arrays, of 64 K bytes each, so that shouldn't be a problem for you, if you want to execute flash programming code from flash. Just make sure that you don't try to program the array that you are executing from. Steve Russell Nohau Emulators At 01:24 PM 10/26/2004, liszewski_jason wrote: >I am currently writing firmware for a project that uses the >MC9S12DJ256 microcontroller. I am doing all of my developing in RAM >with the NOICE debugger. Right now I am working on firmware updates >that are stored in the flash and then copied from one half of the >flash to the other. Is there any way to run out of RAM and still have >access to flash? > >Jason M. Liszewski > > >Yahoo! Groups Links |
|
|
|
Jason, also I recommend to look into recently published AN2720: "A Utility for Programming Single FLASH Array HCS12 MCUs, with Minimum RAM Overhead" which explains how you can program FLASH via small routine in Stack memory. http://www.freescale.com/files/microcontrollers/doc/app_note/AN2720.pd f So you can program/change the FLASH locatoins "on the fly", using only a few bytes of the Stack memory. Jasa --- In , Steve Russell <stever@n...> wrote: > Jason, > > If you haven't read Freescale/Motorola AN2400/D, you should. It is a > valuable summary of almost all you need to know about programming flash memory. > > It is no problem for a program executing from RAM to access flash > locations. That is the way a lot of flash programming is done. > > Typically, you will have the RAM in some location below the flash window at > 0x8000 - 0xBFFF. Write the code to run at the RAM location or make it > position independent. To access the flash locations, set the PPAGE > register to the page (NOT array Number) you want, and read or write to the > "corresponding" address in the 0x8000 - 0xBFFF range. > > Other than keeping straight where the registers and RAM are, and what the > "corresponding" location in flash is, its pretty straightforward. > > The main restriction is that you cannot execute code or read out of a flash > array or block that is being programmed. In the case of the DJ256 there > are 4 arrays, of 64 K bytes each, so that shouldn't be a problem for you, > if you want to execute flash programming code from flash. Just make sure > that you don't try to program the array that you are executing from. > > Steve Russell > Nohau Emulators > At 01:24 PM 10/26/2004, liszewski_jason wrote: > >I am currently writing firmware for a project that uses the > >MC9S12DJ256 microcontroller. I am doing all of my developing in RAM > >with the NOICE debugger. Right now I am working on firmware updates > >that are stored in the flash and then copied from one half of the > >flash to the other. Is there any way to run out of RAM and still have > >access to flash? > > > >Jason M. Liszewski > > > > > > > > > > > > > > > >Yahoo! Groups Links > > > > > > > |