11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVRSt<strong>and</strong>ard Library And Memory Allocation FunctionsThe St<strong>and</strong>ard Library header file defines <strong>the</strong> macros NULL <strong>and</strong>RAND_MAX <strong>and</strong> typedefs size_t <strong>and</strong> declares <strong>the</strong> following functions. Note thatyou must initialize <strong>the</strong> heap with <strong>the</strong> _NewHeap call be<strong>for</strong>e using any of <strong>the</strong> memoryallocation routines (calloc, malloc, <strong>and</strong> realloc). int abs(int i)returns <strong>the</strong> absolute value of i. int atoi(char *s)converts <strong>the</strong> initial characters in s into an integer, or returns 0 if an error occurs. double atof(const char *s)converts <strong>the</strong> initial characters in s into a double <strong>and</strong> returns it. long atol(char *s)converts <strong>the</strong> initial characters in s into a long integer, or returns 0 if an erroroccurs. void *calloc(size_t nelem, size_t size)returns a memory chunk large enough to hold nelem number of objects, each ofsize size. The memory is initialized to zeros. It returns 0 if it cannot honor <strong>the</strong>request. void exit(status)terminates <strong>the</strong> program. Under an embedded <strong>environment</strong>, typically it simplyloops <strong>for</strong>ever <strong>and</strong> its main use is to act as <strong>the</strong> return point <strong>for</strong> <strong>the</strong> user mainfunction. void free(void *ptr)frees a previously allocated heap memory. char *ftoa(float f, int *status)converts a floating-point number to <strong>the</strong> its ASCII representation. It returns a staticbuffer of approximately 15 chars. If <strong>the</strong> input is out of range, *status is set to <strong>the</strong>constant, _FTOA_TOO_LARGE or _FTOA_TOO_SMALL, defined in stdlib.h,<strong>and</strong> 0 is returned. O<strong>the</strong>rwise, *status is set to 0 <strong>and</strong> <strong>the</strong> char buffer is returned.This version of <strong>the</strong> ftoa is fast but cannot h<strong>and</strong>le values outside of <strong>the</strong> rangelisted. Please contact us if you need a (much) larger version that h<strong>and</strong>les greaterranges.99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!