Libpayload: Difference between revisions

From coreboot
Jump to navigation Jump to search
(Provide starting text for libpayload)
 
m (Start libc coverage table)
Line 19: Line 19:
** directFB
** directFB
** TWIN
** TWIN
== Libc Coverage ==
{| border="0"
|- bgcolor="#6699ff"
! align="left" | Function/Macro/Variable
! align="left" | Status
|- bgcolor="#ff0000"
| colspan=2 align="center" | assert.h
|-
| <code>assert( )</code> (macro)
| style="background:red" | no
|- bgcolor="#ff0000"
| colspan=2 align="center" | ctype.h
|-
| <code>int isalnum(int character)</code>
| style="background:red" | no
|-
| <code>int isalpha(int character)</code>
| style="background:red" | no
|-
| <code>int iscntrl(int character)</code>
| style="background:red" | no
|-
| <code>int isdigit(int character)</code>
| style="background:red" | no
|-
| <code>int isgraph(int character)</code>
| style="background:red" | no
|-
| <code>int islower(int character)</code>
| style="background:red" | no
|-
| <code>int isprint(int character)</code>
| style="background:red" | no
|-
| <code>int ispunct(int character)</code>
| style="background:red" | no
|-
| <code>int isspace(int character)</code>
| style="background:red" | no
|-
| i<code>nt isupper(int character)</code>
| style="background:red" | no
|-
| <code>int isxdigit(int character)</code>
| style="background:red" | no
|- bgcolor="#ff0000"
| colspan=2 align="center" | errno.h
|-
| <code>errno</code> (global)
| style="background:red" | no
|- bgcolor="#ff0000"
| colspan=2 align="center" | float.h
|- bgcolor="#ff0000"
| colspan=2 align="center" | limits.h
|- bgcolor="#ff0000"
| colspan=2 align="center" | locale.h
|-
| <code>char *setlocale(int category, const char *locale)</code>
| style="background:red" | no
|-
| <code>struct lconv *localeconv(void)</code>
| style="background:red" | no
|- bgcolor="#ff0000"
| colspan=2 align="center" | math.h
|- colspan=2
| TODO
|- bgcolor="#ff0000"
| colspan=2 align="center" | setjmp.h
|- colspan=2
| TODO
|- bgcolor="#ff0000"
| colspan=2 align="center" | signal.h
|- colspan=2
| TODO
|- bgcolor="#ff0000"
| colspan=2 align="center" | stdarg.h
|- colspan=2
| TODO
|- bgcolor="#ff0000"
| colspan=2 align="center" | stddef.h
|- colspan=2
| TODO
|- bgcolor="#ffff00"
| colspan=2 align="center" | stdio.h
|- colspan=2
| TODO
|- bgcolor="#ffff00"
| colspan=2 align="center" | stdlib.h
|- colspan=2
| TODO
|- bgcolor="#ffff00"
| colspan=2 align="center" | string.h
|- colspan=2
| TODO
|- bgcolor="#ffff00"
| colspan=2 align="center" | time.h
|- colspan=2
| TODO
|}
{| border="1"
|- bgcolor="#ff0000"
| No Support
|- bgcolor="#ffff00"
| Partial Support
|- bgcolor="#00ff00"
| Full Support
|}


== Usage Example ==
== Usage Example ==

Revision as of 07:55, 7 March 2008

Overview

Currently a concept rather than shipping code, libpayload is a coreboot subproject that intends to provide a lightweight implementation of common and useful functions for coreboot payloads. The benefits of linking a coreboot payload against libpayload are:

  • payloads do not have to implement and maintain low-level code for I/O, common functions, etc,
  • payloads can be recompiled and deployed for CPU architectures supported by coreboot in the future,
  • libpayload functions tested and scrutinized outside payload development,
  • payloads themselves may be partly host-tested, e.g. against an emulation libpayload,
  • leads to the possibility of payloads using dynamic linking, reducing total payload footprint.

just give us a main() and a pocket full of dreams and we'll do the rest

Feature Wish List

  • Basics
    • coreboot services and structures (e.g. read CMOS, device tree)
    • subset of C-library functions (e.g. printf, puts, getch)
    • light ncurses from the Google Summer Of Code project
  • Fancies
    • directFB
    • TWIN

Libc Coverage

Function/Macro/Variable Status
assert.h
assert( ) (macro) no
ctype.h
int isalnum(int character) no
int isalpha(int character) no
int iscntrl(int character) no
int isdigit(int character) no
int isgraph(int character) no
int islower(int character) no
int isprint(int character) no
int ispunct(int character) no
int isspace(int character) no
int isupper(int character) no
int isxdigit(int character) no
errno.h
errno (global) no
float.h
limits.h
locale.h
char *setlocale(int category, const char *locale) no
struct lconv *localeconv(void) no
math.h
TODO
setjmp.h
TODO
signal.h
TODO
stdarg.h
TODO
stddef.h
TODO
stdio.h
TODO
stdlib.h
TODO
string.h
TODO
time.h
TODO


No Support
Partial Support
Full Support


Usage Example

hello_payload.c:

#include <stdio.h>

int main( void )
{
    printf( "Hello, world!\n" );
    return 0;
}

build:

libpayload-gcc -o hello_payload hello_payload.c