From: Philipp K. K. <pk...@sp...> - 2018-02-08 13:35:36
|
Am 08.02.2018 um 14:05 schrieb Maarten Brock: >> According to the datasheet, the C8051F120 has 256 B __idata memory that >> can be used for the stack. By default, SDCC uses the the 128B __data >> memory (the lower part half of __idata) for the stack. And indeed, when >> compiling a program using --model-large --stack-auto, it only uses >> __data and runs out of stack space soon. >> SDCC has the --xstack option to place the stack in the 256 B __pdata. >> >> But is using the 256 B __idata for the stack possible in SDCC? >> >> Philipp > > SDCC already uses the full 256 bytes of __idata (minus registers, bits, > and allocated variables and spills in __data/__idata). I don't understand > why you believe it doesn't. > > Using --xstack is less efficient than without. But it places return > addresses on normal stack and data on xstack. Further xstack can use the > full 256 bytes of __pdata. So it provides more stack space. > > Maarten I had a recursive test program that seemed to crash after using about what I thought was about 128 B of stack space. But apparently that program used even more stack space (I hadn't accounted for the stack usage from a printf() call and there is probably more to be found). Sorry for the noise. Philipp |