Content originally posted in LPCWare by lpcentric on Thu Oct 06 22:26:05 MST 2011 I have a function to debug, but the variables view fails to show any of the local variables of that function. lpcxpresso board with lpc1769, lpc IDE 4.1.0 (latest version). I can use the memory browser to check that the variables are indeed on the stack (i, j). SP is 0x10007f28, so way short of the 2kb limit. No dynamic memory allocations are made by my program, but I believe the newlib C library allocates some stdio buffers that way. I provided a minimal stub for _sbrk as found in several online places. printf() works as expected, no other unexpected behaviour (except that my algorithm is still faulty).
The function looks like this:
enum_t func(char * data)
{
volatile unsigned int i = 0x7654321F;
uint8_t a, b;
uint8_t c, d;
uint8_t e, f;
char buffer[100];
volatile unsigned int j = 0xF1234567;
i++;
i--;
j++;
j--;
a = 0x6E;
Above stack pointer is after entering this function, so stack size is around 200 bytes at that point.
The variables view is completely empty, and there doesn't seem to be any way to add the stack variables.
What can be done about this? Looks like an IDE bug to me.
Content originally posted in LPCWare by lpcentric on Wed Oct 19 16:20:39 MST 2011 The workaround is to remove --gc-sections from the linker options. So there's a bug in there somewhere, or at least the description of --gc-sections doesn't imply to me that debugging information is removed from the output file.