Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
October 8, 2009 - 9:00am
|
Hello, Thank you for quickly answer last time. We need tables larger than 256 Bytes. For that time we create function like that: void f1(char tab){ void main(void){ But it's very cmplicated when we handle very large table. Do exist better solution. Regards, Coucou |
Hi,
The STM8 is not able to handle objects on stack that are more than "255 bytes deep". This is because the "SP+offset" addressing mode uses a 1-byte offset.
So the easiest way to handle your problem is to put your table in RAM, not on the stack. There are 2 way to do this:
1) Specify the array as static in your function. The array will be visible only within your function, and will NOT be initialized upon function entry.
2) Declare the array as global (outside of a function)
3) Another alternative, if you do not want your code to be modified, is to use the Raisonance-specific LARGESTACK option. You can then address objects further than 255 bytes deep on stack, but the generated code is ugly, so this option should be used only as a last resort.
Regards,
Bruno