Nicholas Cooke

Flashing Code vs running in RAM

Discussion created by Nicholas Cooke on Nov 10, 2007
Latest reply on Nov 19, 2007 by Dumitru Negrea
I have code which uses most of the pins of the 52223 for GPIO, which I am using to control a graphics controller for an LCD.
My code works well running in RAM and the LCD comes alive without a problem. Now that I am going to run some graphics routines I need to run this code in FLASH. I managed ot get a small test routine to run in FLASH, without any changes to the stationery routines such as  mcf5222x_init().
In my graphics project I have commented out the Edge Port setup in mcf5222x_init () as I am using some of the IRQ lines as GPIO (IRQ 1, 3, 4, 5). I am only using the TX and RX lines of UART0 so have commented out the setup of the other lines in mcf5222x_uart_init() as the CTS etc are used as GPIO lines.
This code compiles and runs perfectly in RAM under Debug mode - BUT when written to the FLASH I get all sorts of problems.
The PIT timer works but when my counter indicates a timeout I get:-
Access error -- PC = 0x001D36 Attempted to write to write protected space coming out on my monitor.
At startup the code does not even get the LCD alive so I am obviously doing something wrong.
I am still trying to fathom out the Debugging using FLASH so any help here would be appreciated.
Is there something obvious that I am doing wrong with the stationery that is causing it to go tilt when running in FLASH??
Kind regards