This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

High RAM Application Questions

According to the *.map file the .bss (RAM) usage for my Application is 0x16b8 or 5816 bytes. This is obviously a very high RAM Application, likely due to the abundance of app_timers I use. I am using SDK6.1 and SD7.1. I want to make sure I'm not going to run into RAM issues at RUN-TIME. With this RAM spec in the .map file do I need to modify the gcc_startup_nrf51.s ? Or modify any other files to account for this RAM usage? Any other considerations I should be mindful of? Thank you for your advisement Nordic.

-DC

Parents
  • Don't totally understand the question. If the app links without error and fits in the available space, it works, the link script has a check for this. The startup file is entirely generic and just copies things from one place to another, it doesn't matter if it copies 1 byte, 10 bytes or 16Kb.

    What issues were you concerned about, perhaps I'm just missing the point?

    That is a lot of RAM usage, the map file should tell you what it's all used for, although they're annoyingly tricky to read, you might want to confirm to yourself that it is app timer usage (they use that much??) and not something else.

Reply
  • Don't totally understand the question. If the app links without error and fits in the available space, it works, the link script has a check for this. The startup file is entirely generic and just copies things from one place to another, it doesn't matter if it copies 1 byte, 10 bytes or 16Kb.

    What issues were you concerned about, perhaps I'm just missing the point?

    That is a lot of RAM usage, the map file should tell you what it's all used for, although they're annoyingly tricky to read, you might want to confirm to yourself that it is app timer usage (they use that much??) and not something else.

Children
  • My question was specifically about run-time RAM usage. The project compiles, links and programs fine. But since I've designedd such a RAM heavy application I was to make sure I have enough headroom for whatever is happening during run-time. I've set my APP_TIMER_MAX to 4 above what I actually use, and set the queue to 2 more than the total number of app_timers, just to be sure.

    More than anything I just want to make sure there isn't some consideration i should be making when using so many app_timers (besides the obvious ones like settings the max, and using the scheduler). Thanks for the reply RK

  • if you look in the .ld file there should be a check that ram doesn't overflow into stack. As long as you pass that, and your stack stays within limits during runtime, you're good to go. That's one of the benefits of having static RAM allocation instead of using heap/malloc() etc, if it links, it runs.

  • I have seen this blog, thought using Eclipse it is not quite as useful. I do not have any malloc() is my code.

  • We have seen (seemly at random) when I go to press the button, the chip seems to grind to a halt. This can happen at any point. Within 2hrs of programming or +3weeks. I had suspected that something to do with the app_button module was causing this. Since the Button Module uses the scheduler, along with App_timers and SoftDevice. Could these 3 items all using the Scheduler at the same time potentially cause a CPU freeze?

    I have recently bumped up the SCHED_QUEUE_SIZE to 30 (from 18). Is there a rule of thumb for setting this? We have 20 app_timers, 2 other misc app_sched_event_put handlers, app_button and the SoftDevice. Thanks for the help.

  • CPUs don't freeze, they get in loops, they go to fault handlers when they detect error conditions, and they are very good at finding seemingly impossible race conditions, but they don't just stop working. Your CPU is running and it's doing something even though your board is unresponsive. What does your hardfault handler do, just loop, how about your app error handler, does it turn on some LEDs or raise a GPIO line you can check externally? When the device becomes unresponsive can you get a debugger attached to it and find out where it is?

Related