# native builds
CC = gcc
-CFLAGS = -Wall
+CFLAGS = -Wall -I/usr/src/linux/include
# cross build
ARCH = arm-elf
CROSS_ROM_LDFLAGS = -Tlpc2220_rom.ld -nostartfiles -nostdlib
# build objects
-HOST_TARGET = lpcload fwdump
+HOST_TARGET = lpcload fwdump font2b
CROSS_TARGET = fwbc.hex fwflash.hex betty.hex
# betty deps
# all projects
all: $(HOST_TARGET) $(CROSS_TARGET)
-# bmp2b
+# bmp2b / font2b
links:
ln -sfv ../../api/bmp/bmp.{c,h} .
--- /dev/null
+/*
+ * font2b.c - convert linux console 8x8 font data to betty lcd ram layout
+ *
+ * author: hackbard@hackdaworld.org
+ *
+ * usage:
+ *
+ * first you have to adjust this file two times (see comments!)
+ * don't forget to rebuild.
+ *
+ * ./font2b > default_font.h
+ *
+ * ONLY 8x8 FONTS SUPPORTED!
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+// put your font data here!
+#include "/usr/src/linux/drivers/video/console/font_pearl_8x8.c"
+
+#define CHAR 1
+#define BINARY 2
+
+int main(int argc,char **argv) {
+
+ unsigned char *font_data;
+ int font,col,row;
+ unsigned char buf;
+ unsigned char stat;
+ int fd=0;
+
+ // adjust the font data pointer here!
+ font_data=(unsigned char *)fontdata_pearl8x8;
+
+ stat=CHAR;
+ if(argc==2) {
+ fd=open(argv[1],O_WRONLY);
+ if(fd<0) {
+ perror("file open");
+ return fd;
+ }
+ stat=BINARY;
+ }
+
+ if(stat==CHAR)
+ printf("const unsigned char default_font[%d]={\n",256*8*2);
+
+ for(font=0;font<=0xff;font++) {
+
+ /* print the font number */
+ printf("\t/* %d 0x%02x",font,font);
+ if((font>0x1f)&(font<0x7f))
+ printf(" %c */\n",font);
+ else
+ printf(" */\n");
+
+ /* print the array content of the font */
+ for(col=0;col<8;col++) {
+ buf=0;
+ for(row=0;row<8;row++)
+ buf|=(font_data[font*8+row]&(1<<(7-col)));
+ if(stat==CHAR) {
+ if(!(col%4))
+ printf("\t");
+ printf("0x%02x,0x%02x",buf,buf);
+ if((font!=0xff)|(col!=7))
+ printf(",");
+ if(col==3)
+ printf("\n");
+ }
+ else {
+ write(fd,&buf,1);
+ write(fd,&buf,1);
+ }
+ }
+ if(stat==CHAR)
+ printf("\n");
+ }
+
+ /* end */
+ if(stat==CHAR)
+ printf("};\n");
+ else
+ close(fd);
+
+ return 0;
+}
* bmp2b.c - converts colored bmp images to a format according to the lcd ram
(you need my bmb api [my-projects/api])
+* font2b.c - converts linux console fonts (only 8x8!) to the lcd ram format
+ you need to adjust the source or have the kernel source in
+ /usr/src/linux.
+
to be continued ...
important: