chipKIT® Development Platform

Inspired by Arduino™

Linking errors when compiling and linking for Max32

Created Tue, 19 Apr 2016 21:17:12 +0000 by twgray


twgray

Tue, 19 Apr 2016 21:17:12 +0000

I am getting the following 2 errors during the link phase of a sketch for Max32:

bin/ld Error: Not enough memory for stack (4112 bytes needed, 48 bytes available)

/bin/ld: small-data section exceeds 64KB; lower small-data size limit (see option -G)

Can someone point me in the right direction to fix this?


majenko

Tue, 19 Apr 2016 21:24:54 +0000

Basically it's telling you that you have too much data in your program. Do you have a massive array declared anywhere?


twgray

Tue, 19 Apr 2016 22:25:03 +0000

OK, I managed to fix the heap and stack errors by adding --defsym=_min_heap_size=1000 --defsym=_min_stack_size=4000 to the linker flags, but I'm really unclear about the small data seg error. I realize it is complaining that data assigned to the 64K small data segment is to big, but I don't know how to 'fix' it. No, I don't have any huge >64K arrays defined, but even if I did, there should be a way of designating them not to use that segment of memory. If I understand correctly this is a Mips only problem. There should be some way to tell data to use a medium or large data segment for >64K blocks, but I'm not clear on how to do it.

Thanks for the reply.


EmbeddedMan

Tue, 19 Apr 2016 22:50:56 +0000

Twrgray,

What version of MPIDE/chipKIT-core are you using? There have been some changes in the options to the linker and compiler in the past year or so that may have an impact on your errors.

*Brian


twgray

Wed, 20 Apr 2016 01:30:44 +0000

I am using mpide-0150-linux64-20150820, what I believe the latest version.

I have even added -mno-extern-sdata -mno-local-sdata -G0 to the CPPFLAGS which should, if I understand the docs correctly, turn off the small data segment all together, but it made no difference. Admittedly, I may be misinterpreting these last 3 flags.


EmbeddedMan

Wed, 20 Apr 2016 23:55:19 +0000

That is a pretty old version. I'd give Arduino IDE 1.6.7 a try, with chipKIT-core v1.1.0 installed within it. You can find direction here : http://chipkit.net/wiki/index.php?title=ChipKIT_core

Maybe that will help resolve your linker issue - maybe not. But it's worth a shot.

*Brian