Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:33:32+00:00 2026-05-23T05:33:32+00:00

When I give the Keil compiler the –callgraph option, it statically calculates the exact

  • 0

When I give the Keil compiler the “–callgraph” option,
it statically calculates the exact “Maximum Stack Usage” for me.

Alas, today it is giving me a “Maximum Stack Usage = 284 bytes + Unknown(Functions without stacksize…)” message, along with a list of “Functions with no stack information”.

Nigel Jones says that recursion is a really bad idea in embedded systems
(“Computing your stack size” 2009),
so I’ve been careful not to make any mutually recursive functions in this code.

Also, I make sure that none of my interrupt handlers ever re-enable interrupts until their final return-from-interrupt instruction, so I don’t need to worry about re-entrant interrupt handlers.

Without recursion or re-entrant interrupt handlers, it should able to statically determine the maximum stack usage.
(And so most of the answers to
How to determine maximum stack usage?
do not apply).
My understanding is that the software that handles the “–callgraph” option
first finds the maximum stack depth for each interrupt handler when it’s not interrupted by a higher-priority interrupt, and the maximum stack depth of the main() function when it is not interrupted.
Then it adds them all up to find the total (worst-case) maximum stack depth.
That occurs when the main() background task is at its maximum depth when it is interrupted by the lowest-priority interrupt, and that interrupt is at its maximum depth when it is interrupted by the next-lowest-priority interrupt, and so on.

I suspect the software that handles –callgraph is getting confused about the small assembly-language functions in the “Functions with no stack information” list.
The –callgraph documentation seems to imply that I need to manually calculate (or make a conservative estimate) how much stack they use — they’re very short, so that should be simple — and then “Use frame directives in assembly language code to describe how your code uses the stack.”
One of them is the initial startup code that resets the stack to zero before jumping to main() — so, in effect, this consumes zero stack.
Another one is the “Fault” interrupt handler that locks up in an infinite loop until I cycle the power — it’s safe to assume this consumes zero stack.

I’m using the Keil uVision V4.20.03.0 to compile code for the LM3S1968 ARM Cortex-M3.

So how do I use “frame directives” to tell the software that handles “–callgraph” how much stack these functions use?
Or is there some better approach to determine maximum stack usage?

(See How to determine maximum stack usage in embedded system with gcc? for almost the same question targeted to the gcc compiler.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:33:33+00:00Added an answer on May 23, 2026 at 5:33 am

    Use the –info=stack in the linker option. The map file will then include a stack usage for all functions with external linkage.

    In a single tasking environment, the stack usage for main() will give you the total requirement. If you are using an RTOS such as RTX where each task has its own stack, then you need to look at the stack usage for all task entry points, and then add some more (64 bytes in the case of RTX) for the task context storage.

    This and other techniques applicable to Keil and more generally are described here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I give the option for a user to delete a special offer on the
Give me some of your thoughts on which is a better coding practice/makes more
Give an algorithm to find a given element x (give the co-ordinates), in an
Give a linear-time algorithm to test whether a tree has a perfect matching, that
Give a base class Base , I want to write a method Test, like
Give an Image component, how can I tell the size [width and height] of
Please give me the direction of the best guidance on the Entity Framework.
To give an example of the kind of request that I can't figure out
Please give me the advantages and disadvantages of using the particular framework. Can give
i give users special URL with access key in it. users accessing the public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.