Is there any a way to determine how much ram/memory is being consumed by the entire project in keil uVision?
It looks like the program is using memory/addresses beyond the certain range allocated so I need to compute certain things.
Also, is there any profiler for ARM embedded systems (C++)?
Well to be honest, I recently started working on cortex M4 and still learning the features keil uVision has to offer.
Basically, my code was working fine (was outputting results as expected) until I started to add some more variables, which resulted in some garbage strings. In addition, I got an error saying as stated here -> http://www.keil.com/support/docs/814.htm.
I got a similar error initially which I fixed by adding an initialization file. I shall really appreciate your help!
Regards
The Getting Started Guide may be a big time saver, then, to learn about all the features: www2.keil.com/.../mdk5-getting-started.pdf[NC,L]
Whenever I see garbage in variables, I check my own code for: --how the variables are being initialized --if pointers are doing what I intended
Stepping through the code in debug mode should help you find the answer, especially if you can find where the bad values start appearing.
So this is you too? http://www.keil.com/forum/62625/
Won't the .MAP file describe the memory usage? Won't the Target IROM/IRAM settings constrain the LINKER to use just the memory that is physically available? Won't the startup.s file define the size of the stack and heap?
Make sure the stack is large enough to accommodate your auto/local variables. Make sure the heap is large enough to accommodate your malloc/new operations.
Start by observing what is FAILING, once you know the variables/data involved work backward to the point of origin, and to the places where it stops having the expected content vs the corrupt content.
If pointers were the issue, I don't think I should have gotten everything correct in the first place. I started getting garbage characters in output when I started declaring some other variables and functions, which makes me wonder if size or the consumption is an actual cause.
Thanks for the response.
I am not using new or malloc so I guess I shouldn't be concerned about heap size. Just to be sure, startup.s file states the stack size of the program or what we have in total? According to the startup.s file, Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>. Is number of bytes stated in hexadecimal here 'cause usually it's a numeric value.
Just below that, it also states Stack_Size EQU 0x00000400. So I am not sure which one is which.
I couldn't find .MAP file in my project. :/
There may be a possibility that stack is getting full which is why it's putting out garbage.
Hello Huzaifa,
The startup defines the amount of stack available to the ARM C/C++ library, during startup, rather than any total RAM usage.
For a map file, go to Project => Options for Target => Listing tab => Linker Listing. Enable this option.
Have you looked in the code yet to find where the issue starts?
Thanks, Zack
Stack_Size EQU 0x00000400 ; Make this bigger, evaluate how much you use
The former reference is for the "wizard view"
The .MAP should be in the output directory, as I recall you can double click the top of the project to have it loaded.
Thanks for the response. Right so is it Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> or Stack_Size EQU 0x00000400?
Also, if this is the available stack, how do I determine how much is being used by my program because that will help me determine if things are going beyond the limit or not.
I did debug my code, and I can't seem to find an issue. I mean as I continue to step in, it outputs as expected except for a few of them. If add even more variables, everything will be messed up (filled with random characters).
Below is just a simple representation (to give you an idea) of the outputs
a = 10
b = 100
è, ë 4 d, ë
d = 5
I forgot to include that Linker Listing is already marked. How do I access .map file?
So this is the stack size -> 0x00000400 ?
Is .map file a notepad file with the same name as the project inside Listings folder?
I found this inside the file; is this relevant?
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)