2.13. Stack and Heap and C Libraries

When the Eclipse Flash Programmer plug-in calls a method in your flash algorithm it creates a stack of at least 256 bytes. This means you can perform a limited number of method calls internally within your flash algorithm and store local variables on the stack.

Flash algorithms are linked against either the microlib or standard C libraries. This means you can use the standard C library functions in your flash algorithm. The C libraries also supply helper code, such as integer division, for processors that do not provide this functionality natively.

When running the flash test harness in a debugger such as RVD, the debugger initializes the C library heap. This means you can use C library functions such as malloc() during testing. However, no heap is initialized when flash algorithms are run from the Eclipse Flash Programmer plug-in, so you must not use heap-based C library functions in your final flash algorithm.

Similarly, debuggers such as RVD provide semihosting facilities that allow you to use printf() in your code and have the output appear in the debugger. Using printf() and other semihosted calls in your flash algorithm is useful for debugging and testing. However, you must not use semihosted calls in the algorithm you import into the flash programmer because the flash programmer does not support semihosting.

Copyright © 2007. All rights reserved.DAI0190A