Jump to content
43oh

Available memory after running my program


Recommended Posts

I am using MSP432P401R in energia . I would like to see the available memory in RAM after running my program.

 

I found a previous post related to this in http://forum.43oh.com/topic/2969-application-ram-usage/ . But i am still stuck.

 

I am using Memory free library of arduino  ( http://playground.arduino.cc/Code/AvailableMemory ) and i am getting errors like  

 

C:\DOCUME~1\James\LOCALS~1\Temp\build4403779855877337752.tmp/Flasher2.cpp:178: undefined reference to `__brkval'
C:\DOCUME~1\James\LOCALS~1\Temp\build4403779855877337752.tmp/Flasher2.cpp:178: undefined reference to `__heap_start'

I think  __brkval ,  __heap_start are pointers to locations in memory (http://jon.oxer.com....duinoMemory.pdf) . 

 

What is the corresponding pointers to be used in energia. Any other way to find the availble free memory in RAm in energia (MSP432).
 

Link to post
Share on other sites

With memory free I assume you mean heap and stack usage/free.

 

There is a nifty monitor Sketch that will exactly tell you that. You can find it in File->Examples->10.MultiTasking->Monitor.

 

MSP432's implementation of the Wiring language is based on TI-RTOS which gives you Multi Tasking support (Hence Energia MT). You can easily integrate this monitor Sketch into your program:

 

1: Open up your program.

2: Create a new tab named Monitor.

3: Open up the Monitor example.

4: Copy paste the Monitor Sketch into your new Monitor tab.

5: Verify and upload.

 

Note that the baudrate of the Monitor Sketch is set to 9600 by default. So make sure that if you are using Serial in your Sketch, that the 2 match their baudrate.

Now open up the Serial monitor and the Line ending pull down in the Serial monitor to "Carriage Return".

 

Now type help in the input window at the top of the Serial monitor and hit the Send button. For statistics on all Sketches send stats.

 

Robert

Link to post
Share on other sites

It will look something like this:

> help
Available commands:
  dm	  dump memory
  wm	  write to memory (32 bits)
  wm2	  write to memory (16 bits)
  wm1	  write to memory (8 bits)
  dw	  digitalWrite to pin
  dr	  digitalRead from pin
  aw	  analogWrite to pin
  ar	  analogRead from pin
  pri	  Set task priority
  spi	  SPI transfer
  stats	  Print CPU utlization info
  help	  Get information on commands. Usage: help [command]
> 
> stats
Total CPU Load: 0.1

Task info:
 task: Idle/0x200004ec, pri: 0, stack usage: 336/1024, mode: READY load: 99.8
 task: mon_loop/0x200023b8, pri: 2, stack usage: 668/2048, mode: RUNNING load: 0.1

Hwi stack usage: 440/1024

Heap usage: 2312/56400
Link to post
Share on other sites
  • 2 weeks later...

Thanks for pointing out. I ran my program as mentioned above and got the below results.

 

stats
Total CPU Load: 0.6
 
Task info:
 task: Idle/0x200004f8, pri: 0, stack usage: 336/1024, mode: READY load: 99.3
 task: mon_loop/0x200026b8, pri: 2, stack usage: 704/2048, mode: RUNNING load: 0.1
 task: loopsketch_oct04a/0x20002f38, pri: 2, stack usage: 2048/2048, mode: BLOCKED load: 0.4
 
Hwi stack usage: 448/1024
 
Heap usage: 4488/55632

 

I think the stack is getting overflow. If i further increase my array size, then my program does not work.

 

I tried in CCS it was working. I guess the stack can be set in CCS and its enough to support my program.

 

Similarly how can i increase the stack size in energia.    

 

Thanks for the help

Andrew

Link to post
Share on other sites

I am sorry as i cant post my sketch . 

Yes the data i am handling is large . So i need to increase the stack.

When i used CCS , My program was working good when i increased the stack size.

So kindly provide me the steps in increasing the stack size in energia.

Any help would be great..:)

 

Thank You 

Andrew

Link to post
Share on other sites

You can change the stack size manually by editing the main.template located in energia/tools/ino2cpp/1.0.2/templates/msp432/

 

The following are the paths to the root of that directory:

 

  1. On GNU/Linuxes: ~/.arduino15/packages/
  2. On Windows: %APPDATA%\Arduino15\packages\
  3. On MacOSXes: ~/Library/Arduino15/packages/

Edit the file main.template in the directory shown above + energia/tools/ino2cpp/1.0.2/templates/msp432/

 

Look for:

taskParams.stackSize = 0x800;

Then change it to the stack size you think would be appropriate.

 

Robert

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...