freemyipod r529 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r528‎ | r529 | r530 >
Date:01:46, 6 February 2011
Author:theseven
Status:new
Tags:
Comment:
Helloworld: Remove library testing crap, make it a real hello world program again
Modified paths:
  • /apps/helloworld/Makefile (modified) (history)
  • /apps/helloworld/main.c (modified) (history)

Diff [purge]

Index: apps/helloworld/main.c
@@ -1,41 +1,10 @@
22 #include "emcoreapp.h"
3 -#include "libui.h"
43
54
6 -void main();
7 -EMCORE_APP_HEADER("Hello world", main, 127)
 5+static void main()
 6+{
 7+ cputc(3, "Hello, world!\n");
 8+}
89
910
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 @@
22 NAME := helloworld
33 STACKSIZE := 4096
4 -COMPRESS := false
 4+COMPRESS := true
55
66 EMCOREDIR ?= ../../emcore/trunk/
7 -LIBPNGDIR ?= ../../libs/png/
87
98 ifeq ($(shell uname),WindowsNT)
109 CCACHE :=
@@ -18,7 +17,7 @@
1918 OBJCOPY := $(CROSS)objcopy
2019 ELF2ECA := $(CROSS)elf2emcoreapp
2120
22 -LIBINCLUDES := -I$(LIBPNGDIR)/export
 21+LIBINCLUDES :=
2322
2423 CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
2524 LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
@@ -105,18 +104,17 @@
106105 endif
107106 @$(CC) -c $(CFLAGS) -o $@ $<
108107
109 -build/version.h: version.h .svn/entries build
 108+build/version.h: version.h .svn/entries
110109 @echo [PP] $<
111110 ifeq ($(shell uname),WindowsNT)
 111+ @-if not exist build md build
112112 @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
113113 else
 114+ @-mkdir -p build
114115 @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
115116 endif
116117
117 -build:
118 - @mkdir $@
119 -
120118 clean:
121 - rm -rf build
 119+ @rm -rf build
122120
123121 .PHONY: all clean $(NAME)