| Index: apps/helloworld/main.c |
| — | — | @@ -1,41 +1,10 @@ |
| 2 | 2 | #include "emcoreapp.h"
|
| 3 | | -#include "libui.h"
|
| 4 | 3 |
|
| 5 | 4 |
|
| 6 | | -void main();
|
| 7 | | -EMCORE_APP_HEADER("Hello world", main, 127)
|
| | 5 | +static void main()
|
| | 6 | +{
|
| | 7 | + cputc(3, "Hello, world!\n");
|
| | 8 | +}
|
| 8 | 9 |
|
| 9 | 10 |
|
| 10 | | -void main()
|
| 11 | | -{
|
| 12 | | - struct emcorelib_header* libui = get_library(0x49554365, LIBUI_API_VERSION, LIBSOURCE_FILESYSTEM, "/ui.emcorelib");
|
| 13 | | - if (!libui) panicf(PANIC_KILLTHREAD, "Could not load UI library!");
|
| 14 | | - struct libui_api* ui = (struct libui_api*)libui->api;
|
| 15 | | - void* srcbuf = memalign(0x10, 92160);
|
| 16 | | - int fd = file_open("/test.lcd", O_RDONLY);
|
| 17 | | - read(fd, srcbuf, 92160);
|
| 18 | | - close(fd);
|
| 19 | | - displaylcd(194, 319, 0, 239, srcbuf, 0);
|
| 20 | | - fd = file_open("/test.raw", O_RDONLY);
|
| 21 | | - read(fd, srcbuf, 92160);
|
| 22 | | - close(fd);
|
| 23 | | - void* framebuf = malloc(61440);
|
| 24 | | - int count = 30720;
|
| 25 | | - char* in = (char*)srcbuf;
|
| 26 | | - short* out = (short*)framebuf;
|
| 27 | | - while (count--)
|
| 28 | | - {
|
| 29 | | - int b = *in++ >> 3;
|
| 30 | | - int g = *in++ >> 2;
|
| 31 | | - int r = *in++ >> 3;
|
| 32 | | - *out++ = (r << 11) | (g << 5) | b;
|
| 33 | | - }
|
| 34 | | - displaylcd(0, 127, 0, 239, framebuf, 0);
|
| 35 | | - ui->dither(128, 240, srcbuf, 0, 0, 128, framebuf, 0, 0, 128);
|
| 36 | | - free(srcbuf);
|
| 37 | | - displaylcd(128, 255, 0, 239, framebuf, 0);
|
| 38 | | - displaylcd_sync();
|
| 39 | | - free(framebuf);
|
| 40 | | - release_library(libui);
|
| 41 | | - library_unload(libui);
|
| 42 | | -}
|
| | 11 | +EMCORE_APP_HEADER("Hello world", main, 127)
|
| Index: apps/helloworld/Makefile |
| — | — | @@ -1,9 +1,8 @@ |
| 2 | 2 | NAME := helloworld
|
| 3 | 3 | STACKSIZE := 4096
|
| 4 | | -COMPRESS := false
|
| | 4 | +COMPRESS := true
|
| 5 | 5 |
|
| 6 | 6 | EMCOREDIR ?= ../../emcore/trunk/
|
| 7 | | -LIBPNGDIR ?= ../../libs/png/
|
| 8 | 7 |
|
| 9 | 8 | ifeq ($(shell uname),WindowsNT)
|
| 10 | 9 | CCACHE :=
|
| — | — | @@ -18,7 +17,7 @@ |
| 19 | 18 | OBJCOPY := $(CROSS)objcopy
|
| 20 | 19 | ELF2ECA := $(CROSS)elf2emcoreapp
|
| 21 | 20 |
|
| 22 | | -LIBINCLUDES := -I$(LIBPNGDIR)/export
|
| | 21 | +LIBINCLUDES :=
|
| 23 | 22 |
|
| 24 | 23 | CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
|
| 25 | 24 | LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
| — | — | @@ -105,18 +104,17 @@ |
| 106 | 105 | endif
|
| 107 | 106 | @$(CC) -c $(CFLAGS) -o $@ $<
|
| 108 | 107 |
|
| 109 | | -build/version.h: version.h .svn/entries build
|
| | 108 | +build/version.h: version.h .svn/entries
|
| 110 | 109 | @echo [PP] $<
|
| 111 | 110 | ifeq ($(shell uname),WindowsNT)
|
| | 111 | + @-if not exist build md build
|
| 112 | 112 | @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 113 | 113 | else
|
| | 114 | + @-mkdir -p build
|
| 114 | 115 | @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 115 | 116 | endif
|
| 116 | 117 |
|
| 117 | | -build:
|
| 118 | | - @mkdir $@
|
| 119 | | -
|
| 120 | 118 | clean:
|
| 121 | | - rm -rf build
|
| | 119 | + @rm -rf build
|
| 122 | 120 |
|
| 123 | 121 | .PHONY: all clean $(NAME)
|