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!
Yeah my question didn't get answered. I did look at the map file (same name as project file) and this I think is relevant but not too sure which one determine the overall memory being consumed and available.
Memory Map of the image
Image Entry point : 0x08000195
Load Region LR_IROM1 (Base: 0x08000000, Size: 0x00007738, Max: 0x00080000, ABSOLUTE)
Execution Region ER_IROM1 (Base: 0x08000000, Size: 0x00007724, Max: 0x00080000, ABSOLUTE)
You want to look at the IRAM usages (ie in the 0x20000000..0x200xxxxx ranges), that's where most of the variables are going to live.
The .MAP file describes usage in multiple places/ways.
You're at a point where you should step and breakpoint the code to understand how it gets into the situation.
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/