cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration of unused program memory

sukrubahadirarslan
Associate III
Posted on December 15, 2013 at 13:23

Hello.

I use STM3210C-eval board. I program it with Keil V4.70.0.0 . I want to fill the unused memory area so if program counter corrupt and jumps to unused area , I create an reset.

How do ı fill unused area with reset vector ?
3 REPLIES 3
chen
Associate II
Posted on December 16, 2013 at 11:44

It does not work like that.

If the program resides in internal Flash - unprogramed Flash defaults to 0xff.

If your program ever jumps to an area of un-programmed Flash, all the 0xff

will result in invalid op-codes (invalid machine code).

This in turn will generate an IRQ (which one I forget).

So all you have to do is to make the ISRs (the ones you are not

coding yourself to so something) do a reset.

FYI - most debuggers and programmers (like ST Link Util) will allow you

to fill memory (RAM or Flash) BUT do not do it unless you know what

you are doing!

frankmeyer9
Associate II
Posted on December 16, 2013 at 12:01

If your program ever jumps to an area of un-programmed Flash, all the 0xff

will result in invalid op-codes (invalid machine code).

This in turn will generate an IRQ (which one I forget).

BTW, the Microchip PIC12/16/18 have this ''feature'' the OP is asking for.

This MCUs interpret 0xFF as instruction code ''NOP'', so busy-ignoring unprogrammed Flash and unimplemented memory in his small 64k adress range.

I don't view this as an advantage, rather a method to hide bad programming style and subtle bugs ...

Posted on December 16, 2013 at 12:56

I haven't done it recently, but Keil used to be able to use the scatter file to fill memory regions.

http://www.keil.com/support/docs/3407.htm

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..