[En-Nut-Discussion] Can't run avr-gccdbg only with internal stack
bon at elektron.ikp.physik.tu-darmstadt.de
Thu Sep 20 15:34:35 CEST 2012
>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:
Harald> Hi all, about 2 weeks ago the trunk was building without errors
Harald> for all AVR based boards. It now fails with
Harald> #error "Can't run avr-gccdbg only with internal stack"
When testing the USB1287 setup, at some point in time nothing worked any
more. So I got back to the CAN128 setup and old code and nothing worked
either. All boards are without external RAM .
Heavy headscratching. I spend several days. Instrumenting the code with
LED blink showed that NutInit was reached, and even main(NutMain). But
Nutsleep didn't honor the timeout and no task switching worked. So I tried
even SIMULAVR with the CAN128 and all I got was a simulavr crash with the
ELPM instruction. More headscratching. Finally I tried another setup, this
time nutconfigured with -mavr-gcc against all other tested setup so long
compiled with -mavr-gccdbg, and things started working again.
If I understand configuration right, -mavr-gccdbg results in
NUT_THREAD_STACK_MULT set to "3" and without other ".conf" options 3*1024
Bytes are used for the main stack and 3* 128 bytes are used for the idle
thread. With 4 K internal RAM, very few RAM is left, probably heavy loaded
with many debug strings in RAM and this was probably the cause for my errors.
So I decided to add a test so that others don't step into that trap. As a
starting point the test requires 1000 Bytes left. Maybe that is to ample. But
to save others from that trap, I strongly suggest to have such a test.
Some test is needed that makes sure "stacks + heap + data < RAM". But at
Runtime at startup we don't have any common output channel so only a compile
time test seems sensible needed. But this compile time test needs some
heuristics. Let's work on tha heuristics.
N.B. I send a patch to simulavr that enabled the EPLM instruction...
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the En-Nut-Discussion