MCF5235 Flash Execution Problem

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

MCF5235 Flash Execution Problem

1,127 Views
aergin
Contributor I

I am having a strange problem in my code.  I can run my code perfectly out of RAM on my MCF5235 but when I install the same code in flash and start it, the device crashes.  After much debugging, I was able to find the exact spot the device is crashing and it doesnt make much sense.  It hits a spot inside of nested if-statements where it will not continue on.  I thought that it may have a problem with what is in the if-statement parameters, so I replaced them all with if(1) and I still get the same problem.  It is like it reaches a point in the code that it refuses to execute another if-statment.

 

if(1)

{

  if(1)   --CRASH HERE

  { 

  }

 

Even I add a printf or any other operation between the nested if-statments.  It still crashes at the same spot.  

if(1)

{

  printf(...)

  x = x + 1;

  if(1)   --CRASH HERE

  { 

  }

 

When I connect to the device to see where it is, it is always lost in some random memory space.  Does anyone have any suggestions or let me know if you need clarification on this problem.  

 

I am locked into using Codewarrior v6.4 for CF.  Thanks

Labels (1)
0 Kudos
Reply
1 Reply

715 Views
ChrisJohns
Contributor I

You could try and set a hardware break point on an instruction around there and then single step at the instruction level.

 

BDM supports debugging flash problems this way and I assume the Codewarrior tools can handle this (I am not a Codewarrior user, rather a GDB and BDM user (developer)).

 

If you get to the breakpoint I would check your RAM memory map is what you expect, eg stack, .data, .bss and heap.

 

I would also check interrupts are being handled correctly. It could be an interrupt occurs at the same point in time after reset and so it appears like the code is broken but it is ok. BDM single stepping instructions will mask interrupts.

0 Kudos
Reply