Thorvard 14 Posted May 19, 2014 Share Posted May 19, 2014 I have trouble debugging a suspected memory leak, is there method to read the head and stack pointer in Energia? regards, Thorvard Quote Link to post Share on other sites
roadrunner84 466 Posted May 19, 2014 Share Posted May 19, 2014 There is no heap pointer. The stack pointer should be readable, but there is not built in debugger in Energia. Quote Link to post Share on other sites
oPossum 1,083 Posted May 19, 2014 Share Posted May 19, 2014 This may work for getting the stack pointer... unsigned * get_sp(void) { unsigned n; return &n; } spirilis 1 Quote Link to post Share on other sites
pabigot 355 Posted May 19, 2014 Share Posted May 19, 2014 This may work for getting the stack pointer... unsigned * get_sp(void) { unsigned n; return &n; } Egads. Yes, I suppose it may work. The standard "intrinsic" in CCS is _get_SP_register() and msp430-elf-gcc should provide the same. mspgcc provides __read_stack_register() (it might not have the alias, in which case energia should probably add it). Any toolchain should have something that does this for you without having to introduce undefined behavior. oPossum 1 Quote Link to post Share on other sites
energia 485 Posted May 19, 2014 Share Posted May 19, 2014 @@Thorvard does the suspected Sketch use the String library? What part of the code library do you suspect has the memory leak? Would be great if you could post the Sketch and provide a descriptions of what makes you suspect that there is a memory leak. Quote Link to post Share on other sites
Thorvard 14 Posted May 19, 2014 Author Share Posted May 19, 2014 Sorry, can't post the sketch, im using the webduino webserver.h library which is using string.h and streaming.h, i suspect the problem is somewhere deep in there. Im also using fatfs, adafruits cc300_mdns, rtclib, WiFi and WiFiUDP libraries. The sketch worked well until i added the fatfs wrapper, had to use soft spi for the fatfs because somehow a second hardware spi crashes the cc3000. The extra memory the fatfs uses seem to make the webduino code unstable. i suspect the heap is hitting the stack and then the code crashes somewhere in webserver.h. I've read the CCS6 beta can import energia sketches, i should give it a try. Sorry i can't get more specific or post a sketch, i'm working on a device i plan to get patented, but this is quite complicated and expensive. Oh i nearly forgot, im using the Tiva-C Launchpad + CC3000 Booster pack + SD Card breakoutboard from ITead Studio. regards, Thorvard Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.