Contents|Index|Previous|Next

I/O support code

Most applications use calls to the standard C library. However, when you initially link libc.a, several I/O functions are undefined. If you don’t plan on doing any I/O, you’re OK; otherwise, you need to create two I/O functions: open() and close(). These don’t need to be fully supported unless you have a file system, so they are normally stubbed out, using kill().

sbrk()is also a stub, since you can’t do process control on an embedded system, only needed by applications that do dynamic memory allocation. It uses the variable, _end, which is set in the linker script.

The following routines are also used for optimization.

-inbyte
Returns a single byte from the console.

-outbyte
Used for low-level debugging, takes an argument for print() and prints a byte out to the console (typically used for ASCII text).