Index: apps/testpattern/SOURCES |
— | — | @@ -0,0 +1 @@ |
| 2 | +main.c
|
Index: apps/testpattern/ls.x |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +ENTRY(__emcore_entrypoint)
|
| 3 | +OUTPUT_FORMAT(elf32-littlearm)
|
| 4 | +OUTPUT_ARCH(arm)
|
| 5 | +
|
| 6 | +MEMORY
|
| 7 | +{
|
| 8 | + VIRTUAL : ORIGIN = 0x00000000, LENGTH = 0x10000000
|
| 9 | +}
|
| 10 | +
|
| 11 | +SECTIONS
|
| 12 | +{
|
| 13 | + .text :
|
| 14 | + {
|
| 15 | + __emcore_app_base = .;
|
| 16 | + KEEP(.emcoreentrypoint*)
|
| 17 | + *(.emcoreentrypoint*)
|
| 18 | + *(.text*)
|
| 19 | + *(.glue_7)
|
| 20 | + *(.glue_7t)
|
| 21 | + . = ALIGN(0x10);
|
| 22 | + } > VIRTUAL
|
| 23 | +
|
| 24 | + .data :
|
| 25 | + {
|
| 26 | + *(.rodata*)
|
| 27 | + . = ALIGN(0x4);
|
| 28 | + *(.data*)
|
| 29 | + . = ALIGN(0x10);
|
| 30 | + } > VIRTUAL
|
| 31 | +
|
| 32 | + .bss (NOLOAD) :
|
| 33 | + {
|
| 34 | + *(.bss*)
|
| 35 | + *(COMMON)
|
| 36 | + } > VIRTUAL
|
| 37 | +
|
| 38 | + /DISCARD/ :
|
| 39 | + {
|
| 40 | + *(.eh_frame)
|
| 41 | + }
|
| 42 | +
|
| 43 | +}
|
Index: apps/testpattern/main.c |
— | — | @@ -0,0 +1,226 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2011 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#include "emcoreapp.h"
|
| 26 | +
|
| 27 | +
|
| 28 | +static void main()
|
| 29 | +{
|
| 30 | + int x, y, r;
|
| 31 | + int width = lcd_get_width();
|
| 32 | + int height = lcd_get_height();
|
| 33 | + int l1, s1, ls1, ss1, l2, s2, ls2, ss2, x1, y1, x2, y2, ox1, oy1, ox2, oy2;
|
| 34 | + if (width > height)
|
| 35 | + {
|
| 36 | + l1 = width;
|
| 37 | + s1 = height;
|
| 38 | + }
|
| 39 | + else
|
| 40 | + {
|
| 41 | + l1 = height;
|
| 42 | + s1 = width;
|
| 43 | + }
|
| 44 | + for (l2 = 0x40000000; l2 > l1; l2 >>= 1);
|
| 45 | + if ((l2 * 9) / 8 > l1) l2 >>= 1;
|
| 46 | + while ((l2 / 9) * 6 > s1) l2 >>= 1;
|
| 47 | + l1 = (l2 * 9) / 8;
|
| 48 | + s1 = l2 / 2;
|
| 49 | + s2 = s1 / 2;
|
| 50 | + if (height >= l1)
|
| 51 | + {
|
| 52 | + x1 = s1;
|
| 53 | + x2 = s2;
|
| 54 | + y1 = l1;
|
| 55 | + y2 = l2;
|
| 56 | + ls1 = 0;
|
| 57 | + ls2 = 0;
|
| 58 | + ss1 = 0;
|
| 59 | + ss2 = 0;
|
| 60 | + ox1 = (width - s1 - s2) / 2;
|
| 61 | + ox2 = ox1 + s1;
|
| 62 | + oy1 = (height - l1) / 2;
|
| 63 | + oy2 = oy1;
|
| 64 | + }
|
| 65 | + else
|
| 66 | + {
|
| 67 | + x1 = l1;
|
| 68 | + x2 = l2;
|
| 69 | + y1 = s1;
|
| 70 | + y2 = s2;
|
| 71 | + ls1 = 3 - 3 * l1 * s1;
|
| 72 | + ls2 = 3 - 3 * l2 * s2;
|
| 73 | + ss1 = l1 * 3 - 3;
|
| 74 | + ss2 = l2 * 3 - 3;
|
| 75 | + ox1 = (width - l1) / 2;
|
| 76 | + ox2 = ox1;
|
| 77 | + oy1 = (height - s1 - s2) / 2;
|
| 78 | + oy2 = oy1 + s1;
|
| 79 | + }
|
| 80 | +
|
| 81 | +
|
| 82 | + uint8_t* framebuf = (uint8_t*)malloc(s1 * l1 * 3);
|
| 83 | + if (!framebuf) panicf(PANIC_KILLTHREAD, "Out of memory!");
|
| 84 | +
|
| 85 | + int s = s1 / 4;
|
| 86 | + uint8_t* ptr = framebuf;
|
| 87 | + for (r = 0; r < 8; r++)
|
| 88 | + for (y = 0; y < s; y++)
|
| 89 | + {
|
| 90 | + for (x = 0; x < s; x++)
|
| 91 | + {
|
| 92 | + *ptr++ = 1 << r;
|
| 93 | + *ptr++ = 0;
|
| 94 | + *ptr++ = 0;
|
| 95 | + ptr += ss1;
|
| 96 | + }
|
| 97 | + for (x = 0; x < s; x++)
|
| 98 | + {
|
| 99 | + *ptr++ = 0;
|
| 100 | + *ptr++ = 1 << r;
|
| 101 | + *ptr++ = 0;
|
| 102 | + ptr += ss1;
|
| 103 | + }
|
| 104 | + for (x = 0; x < s; x++)
|
| 105 | + {
|
| 106 | + *ptr++ = 0;
|
| 107 | + *ptr++ = 0;
|
| 108 | + *ptr++ = 1 << r;
|
| 109 | + ptr += ss1;
|
| 110 | + }
|
| 111 | + for (x = 0; x < s; x++)
|
| 112 | + {
|
| 113 | + *ptr++ = 1 << r;
|
| 114 | + *ptr++ = 1 << r;
|
| 115 | + *ptr++ = 1 << r;
|
| 116 | + ptr += ss1;
|
| 117 | + }
|
| 118 | + ptr += ls1;
|
| 119 | + }
|
| 120 | + for (y = 0; y < s; y++)
|
| 121 | + {
|
| 122 | + for (x = 0; x < s; x++)
|
| 123 | + {
|
| 124 | + *ptr++ = 0xff;
|
| 125 | + *ptr++ = 0;
|
| 126 | + *ptr++ = 0;
|
| 127 | + ptr += ss1;
|
| 128 | + }
|
| 129 | + for (x = 0; x < s; x++)
|
| 130 | + {
|
| 131 | + *ptr++ = 0;
|
| 132 | + *ptr++ = 0xff;
|
| 133 | + *ptr++ = 0;
|
| 134 | + ptr += ss1;
|
| 135 | + }
|
| 136 | + for (x = 0; x < s; x++)
|
| 137 | + {
|
| 138 | + *ptr++ = 0;
|
| 139 | + *ptr++ = 0;
|
| 140 | + *ptr++ = 0xff;
|
| 141 | + ptr += ss1;
|
| 142 | + }
|
| 143 | + for (x = 0; x < s; x++)
|
| 144 | + {
|
| 145 | + *ptr++ = 0xff;
|
| 146 | + *ptr++ = 0xff;
|
| 147 | + *ptr++ = 0xff;
|
| 148 | + ptr += ss1;
|
| 149 | + }
|
| 150 | + ptr += ls1;
|
| 151 | + }
|
| 152 | + displaylcd(ox1, oy1, x1, y1, framebuf, 0, 0, x1);
|
| 153 | +
|
| 154 | + int sx = s2 / 8;
|
| 155 | + int sy = MAX(1, l2 / 256);
|
| 156 | + int i = 256 / (l2 / sy);
|
| 157 | + s = 8;
|
| 158 | + for (x = i; x > 1; x >>= 1) s--;
|
| 159 | + ptr = framebuf;
|
| 160 | + for (r = 0; r < 256; r += i)
|
| 161 | + for (y = 0; y < sy; y++)
|
| 162 | + {
|
| 163 | + for (x = 0; x < sx; x++)
|
| 164 | + {
|
| 165 | + *ptr++ = ~(r | (r >> s));
|
| 166 | + *ptr++ = ~(r | (r >> s));
|
| 167 | + *ptr++ = ~(r | (r >> s));
|
| 168 | + ptr += ss2;
|
| 169 | + }
|
| 170 | + for (x = 0; x < sx; x++)
|
| 171 | + {
|
| 172 | + *ptr++ = r | (r >> s);
|
| 173 | + *ptr++ = r | (r >> s);
|
| 174 | + *ptr++ = r | (r >> s);
|
| 175 | + ptr += ss2;
|
| 176 | + }
|
| 177 | + for (x = 0; x < sx; x++)
|
| 178 | + {
|
| 179 | + *ptr++ = 0;
|
| 180 | + *ptr++ = r | (r >> s);
|
| 181 | + *ptr++ = r | (r >> s);
|
| 182 | + ptr += ss2;
|
| 183 | + }
|
| 184 | + for (x = 0; x < sx; x++)
|
| 185 | + {
|
| 186 | + *ptr++ = r | (r >> s);
|
| 187 | + *ptr++ = 0;
|
| 188 | + *ptr++ = r | (r >> s);
|
| 189 | + ptr += ss2;
|
| 190 | + }
|
| 191 | + for (x = 0; x < sx; x++)
|
| 192 | + {
|
| 193 | + *ptr++ = r | (r >> s);
|
| 194 | + *ptr++ = r | (r >> s);
|
| 195 | + *ptr++ = 0;
|
| 196 | + ptr += ss2;
|
| 197 | + }
|
| 198 | + for (x = 0; x < sx; x++)
|
| 199 | + {
|
| 200 | + *ptr++ = r | (r >> s);
|
| 201 | + *ptr++ = 0;
|
| 202 | + *ptr++ = 0;
|
| 203 | + ptr += ss2;
|
| 204 | + }
|
| 205 | + for (x = 0; x < sx; x++)
|
| 206 | + {
|
| 207 | + *ptr++ = 0;
|
| 208 | + *ptr++ = r | (r >> s);
|
| 209 | + *ptr++ = 0;
|
| 210 | + ptr += ss2;
|
| 211 | + }
|
| 212 | + for (x = 0; x < sx; x++)
|
| 213 | + {
|
| 214 | + *ptr++ = 0;
|
| 215 | + *ptr++ = 0;
|
| 216 | + *ptr++ = r | (r >> s);
|
| 217 | + ptr += ss2;
|
| 218 | + }
|
| 219 | + ptr += ls2;
|
| 220 | + }
|
| 221 | + displaylcd(ox2, oy2, x2, y2, framebuf, 0, 0, x2);
|
| 222 | +
|
| 223 | + free(framebuf);
|
| 224 | +}
|
| 225 | +
|
| 226 | +
|
| 227 | +EMCORE_APP_HEADER("LCD test pattern generator", main, 127)
|
Index: apps/testpattern/version.h |
— | — | @@ -0,0 +1,36 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2010 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __VERSION_H__
|
| 26 | +#define __VERSION_H__
|
| 27 | +
|
| 28 | +
|
| 29 | +#define VERSION "0.0.1pre"
|
| 30 | +#define VERSION_MAJOR 0
|
| 31 | +#define VERSION_MINOR 0
|
| 32 | +#define VERSION_PATCH 1
|
| 33 | +#define VERSION_SVN "$REVISION$"
|
| 34 | +#define VERSION_SVN_INT $REVISIONINT$
|
| 35 | +
|
| 36 | +
|
| 37 | +#endif |
\ No newline at end of file |
Index: apps/testpattern/Makefile |
— | — | @@ -0,0 +1,121 @@ |
| 2 | +NAME := testpattern
|
| 3 | +STACKSIZE := 4096
|
| 4 | +COMPRESS := true
|
| 5 | +
|
| 6 | +EMCOREDIR ?= ../../emcore/trunk/
|
| 7 | +LIBUIDIR ?= ../../libs/ui/
|
| 8 | +
|
| 9 | +ifeq ($(shell uname),WindowsNT)
|
| 10 | +CCACHE :=
|
| 11 | +else
|
| 12 | +CCACHE := $(shell which ccache)
|
| 13 | +endif
|
| 14 | +
|
| 15 | +CROSS ?= arm-elf-eabi-
|
| 16 | +CC := $(CCACHE) $(CROSS)gcc
|
| 17 | +AS := $(CROSS)as
|
| 18 | +LD := $(CROSS)ld
|
| 19 | +OBJCOPY := $(CROSS)objcopy
|
| 20 | +ELF2ECA := $(CROSS)elf2emcoreapp
|
| 21 | +
|
| 22 | +LIBINCLUDES := -I$(LIBUIDIR)/export
|
| 23 | +
|
| 24 | +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 | +LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
| 26 | +
|
| 27 | +preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| 28 | +preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
|
| 29 | +
|
| 30 | +REVISION := $(shell svnversion .)
|
| 31 | +REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
| 32 | +
|
| 33 | +HELPERS := build/__emcore_armhelpers.o
|
| 34 | +
|
| 35 | +SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
| 36 | +OBJ := $(SRC:%.c=build/%.o)
|
| 37 | +OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
| 38 | +
|
| 39 | +all: $(NAME)
|
| 40 | +
|
| 41 | +-include $(OBJ:%=%.dep)
|
| 42 | +
|
| 43 | +$(NAME): build/$(NAME).emcoreapp
|
| 44 | +
|
| 45 | +build/$(NAME).emcoreapp: build/$(NAME).elf
|
| 46 | + @echo [EMCAPP] $<
|
| 47 | +ifeq ($(COMPRESS),true)
|
| 48 | + @$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
|
| 49 | +else
|
| 50 | + @$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
|
| 51 | +endif
|
| 52 | +
|
| 53 | +build/$(NAME).elf: ls.x $(OBJ)
|
| 54 | + @echo [LD] $@
|
| 55 | + @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
|
| 56 | +
|
| 57 | +build/%.o: %.c build/version.h
|
| 58 | + @echo [CC] $<
|
| 59 | +ifeq ($(shell uname),WindowsNT)
|
| 60 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 61 | +else
|
| 62 | + @-mkdir -p $(dir $@)
|
| 63 | +endif
|
| 64 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 65 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 66 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 67 | +ifeq ($(shell uname),WindowsNT)
|
| 68 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 69 | +else
|
| 70 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 71 | +endif
|
| 72 | + @rm -f $@.dep.tmp
|
| 73 | +
|
| 74 | +build/%.o: %.S build/version.h
|
| 75 | + @echo [CC] $<
|
| 76 | +ifeq ($(shell uname),WindowsNT)
|
| 77 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 78 | +else
|
| 79 | + @-mkdir -p $(dir $@)
|
| 80 | +endif
|
| 81 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 82 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| 83 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| 84 | +ifeq ($(shell uname),WindowsNT)
|
| 85 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| 86 | +else
|
| 87 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| 88 | +endif
|
| 89 | + @rm -f $@.dep.tmp
|
| 90 | +
|
| 91 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.c
|
| 92 | + @echo [CC] $<
|
| 93 | +ifeq ($(shell uname),WindowsNT)
|
| 94 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 95 | +else
|
| 96 | + @-mkdir -p $(dir $@)
|
| 97 | +endif
|
| 98 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 99 | +
|
| 100 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.S
|
| 101 | + @echo [CC] $<
|
| 102 | +ifeq ($(shell uname),WindowsNT)
|
| 103 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| 104 | +else
|
| 105 | + @-mkdir -p $(dir $@)
|
| 106 | +endif
|
| 107 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| 108 | +
|
| 109 | +build/version.h: version.h .svn/entries
|
| 110 | + @echo [PP] $<
|
| 111 | +ifeq ($(shell uname),WindowsNT)
|
| 112 | + @-if not exist build md build
|
| 113 | + @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 114 | +else
|
| 115 | + @-mkdir -p build
|
| 116 | + @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 117 | +endif
|
| 118 | +
|
| 119 | +clean:
|
| 120 | + @rm -rf build
|
| 121 | +
|
| 122 | +.PHONY: all clean $(NAME)
|
Index: apps/testpattern |
Property changes on: apps/testpattern |
___________________________________________________________________ |
Added: svn:ignore |
## -0,0 +1 ## |
| 123 | +build |