- How can I determine the stack size being used by the tasks through the MAP file generated?
- How to determine the sizes of the stack and heap in the RAM of ARM
- How to determine if more stack size is required to be assigned for the tasks?
IAR for ARM running Micrium OS-III - Understanding memory usage
474 Views Asked by Nikhil Gupta At
1
There are 1 best solutions below
Related Questions in MEMORY
- 9 Digit Addresses in Hexadecimal System in MacOS
- Memory location changing from 0 to 1 consistently on Mac
- Would event listeners prevent garbage collecting objects referenced in outer function scopes?
- tensorrt inference problem: CPU memory leak
- How to estimate the memory size of a binary voxelized geometry?
- Java Memory UTF-16 Vs UTF-8
- Spring Boot application container memory footprint (Java 21)
- Low memory Windows CE
- How to throw an error when a program acesses a block of memory created by you that has been deallocated by a call of free?
- Golang bufio.Scanner: token too long
- Get the address and size of a loaded shared object on memory from C
- In Redis Databases how do we need to calculate the table size
- ClickHouse Materialized View consuming a lot of Memory and CPU
- How to reduce memory usage for large matrix calculations?
- How to use memray with Gunicorn or flask dev server?
Related Questions in EMBEDDED
- MSP430F5529 on the MSPEXP430F5529LP: UART is not actually transmitting despite seemingly correct setup. What is wrong?
- A FPGA Project Proposal where I can use both PS and PL
- Program doesn't run after DFU
- Sending struct through queue
- How to generate a VPI warpmap for polynomial distortion correction?
- How to present this example concept in UML: Using 2 LCD displays in C/C++
- CLion: Debug via St-Link
- Portenta H7 Baremetal Development and a Little Guidance on Embedded System Learning Roadmap
- STM32 RTC3 Mixed Mode: Writing TR resets SSR
- Unable to read value from gpio set as input
- Mbed TLS: in-place en-/decryption for OAEP doesn't seem to work
- Shared variable read from low priority thread in preemptive scheduling
- Own Pattern / framework for interfacing with components in C
- Performance Difference Between Global Variable and Local Variable in Embedded Systems
- Comparing analog signal from Electret mic with samples
Related Questions in IAR
- PC-Lint on IAR not understanding std::atomic<>
- changing white space character in IAR embedded
- How can i download IAR EWARM 8.30.1
- Running a C code developed in IAR on Windows
- Initializing Global Variables in IAR
- Writing problem after placing a group of variables in a specific section with IAR arm linker
- Timers window of the ThreadX IAR plugin crashing IAR when a 10th timer is created
- Memory intersection problem in IAR Embedded Workbench
- how to make a common linker for keil and IAR
- extern const declaration as pointer causes hard fault in C?
- How to create a test.out file to sue for Unity Ceedling testing framework in IAR compiler
- Using IAR Embedded Workbench to configure an Arduino Due through J-link, the debugger never reaches the main function of my C-Code
- STM32 Stop mode
- IAR Workbench color customization
- How to choose FlexSpi channel in IAR
Related Questions in MICRIUM
- Stack overflow after call to OSStartHighRdy (uC/OS-III)
- Calculating the Stack usage in RTOS application
- Micrium File system partition issue
- Micrium uC/FS file system Mount delay
- What is source of IID 0x7ffffff error in CCES debugger, and how to fix it properly?
- Find out if an object on a specific address is a pointer
- How to bind to a broadcast address in Micrium
- uC/OS-III Systick & Peripheral timer0 for PWM interfere
- UC/OS III semaphore inside ISR sometimes does not work
- Micrium OS -III Timer callback function not getting called
- IAR for ARM running Micrium OS-III - Understanding memory usage
- FATFS on ST32 with device configured as USB drive
- micrium file system get amount of space left
- Robot Middleware (OpenRTM, OROCOS, RSCA, ASEBA etc.) support port to an RTOS(Micrium, QNX, Keil, FreeRTOS?
- typecast to a not typedefined struct
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If you are running the latest version of IAR EWARM, there is a built in tool that you will find very helpful with these questions.
For your first question, you will need to search in the map file for the name of each task's stack. In this case, the map file isn't that helpful, as you would likely be better off searching your project for the
CPU_STKtype, as that will give you results with all properly defined stacks. If you do look in the map file, you may see a line like this:This means that
MainStack(presumably a stack for aMainTask) is sized as 0x1000 or 4096 bytes. The first column is symbol name, the second is location in the address space, the third is size, the fourth is type (Data, Code), the fifth is scope (Lc = local, Gb = Global), and the last column is object module it is located in.If instead you search the project for instances of
CPU_STKyou would find the following:This gives you the same information that
MainStackis size 4096, but by searching for CPU_STK, it will also give you results for other tasks, so you may actually see the following in your results:So, now you can see that there's also an
AuxStack(presumably for anAuxTask), and it is 512 bytes. This would require to searches in the map file for specific stack names to get results, so I would find this easier.For this one, you'll want to dig into either the linker configuration file, or the linker section in the options. The easier way is through the options. Go to your project options, and then the Linker item on the left. Under the configuration tab, select Edit..., and then go to the Stack/Heap tab. This will give you easy access to the sizes that IAR will use to allocate the HEAP and CSTACK memory regions in the linker.
Alternatively, you can dig into the
.icffile and you may find a set of lines like so:It could also look completely different! It's hard to give a generalized answer for this one, so you're best off looking in the options. In the code above, though, you can see
CSTACKandHEAPhave their sizes defined by the symbols defined earlier in the file. You can follow these definitions to get the size. Your linker file could be very different from this, though, so as I said, it's really hard to give a general answer.Newer versions of IAR have a great utility that can determine the stack depth required by any function. In project options, under Linker in the Advanced tab, you can check "Enable stack usage analysis". When you enable this, your map file will contain root functions and their maximum call chain. For example, my
MainTasklooks like this:So, this is telling me that MainTask is an uncalled function (which it is not called directly, but by function pointer, which IAR cannot resolve automatically), and it requires 396 bytes of stack. Below it, it will show you the call chain that adds up to 396 bytes.
Of note with this tool is that if you use function pointers and indirect calls, IAR cannot automatically figure out where these lead. There are a set of
pragmadirectives that can be used to tell it what possible functions are called at an indirect calling point, and you'll need to put these in to get a 100% accurate stack depth.An alternative is to run the program on your hardware, but let the OS monitor for stack overflows. Micrium has a page about detecting stack overflows here: Detecting Task Stack Overflows. Additionally, here is the documentation on a function to get information about a task's stack usage: OSTaskStkChk()