To summarize, I have a project which contains main.c, file.cpp, and file.hpp. In a header file, I have defined a class in which all the variables and functions are declared and they are defined in file.cpp. Note that I am using in simulation mode for STM32F401RE board.
At the start, when I was beginning to add stuff in my project, I got an error saying 'No read permission ....'. By looking that error up online, I figured out that I was missing initialization file with certain address range.
Everything in my program was working fine (was outputting as expected) till I added something more (functions and variables in particular). After adding a lot of stuff since that time, I got an error yet again saying *** error 65: access violation at 0xD1010BC8 : no 'read' permission.
Also I noticed as I started to add more stuff, the outputs in the debug viewer (using printf) started becoming garbage (some random characters). There's either a limitation of the size of the program I guess or something else that I am not sure about.
Does anyone know about it?
Shall appreciate it!
IROM1's starting address = 0x8000000 and SIZE = 0x80000 IRAM's starting address = 0x20000000 and SIZE = 0x18000
I guess I have to look at Call Stack + Locals window when debugging. If I am not wrong is that the variables stored in a stack? Can you tell what to exactly look for to determine stack overflow or anything of that sort.
Local/Auto variable consume space on the stack.
Your job would be to observe if the CPU ploughs off the end of the stack. You'd do this by a) knowing where the bottom is, b) checking you pointers for validity, c) checking the stack depth, etc.
If you don't understand how much space you could be using by walking the code and call trees you can also make the stack larger so it accommodates the worst case situation. If you are a PC developer you've probably got use to basically infinite stacks and expecting the OS to grow them as required. For embedded you've got to take some responsibility for yourself, and understand the ramifications of what you're coding, ie recursing 10 levels down using 10KB at each level.
Take some time to learn how the micro-controller works, and what constraints there are on resources.
An illustration was given here http://www.keil.com/forum/62659/