From 74fe5e24beb14b00ce3d69e5a3010c520d4bf8e5 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Sat, 4 Dec 2021 13:41:35 +0900 Subject: Initial: vram write test --- 01-ctest/Makefile | 3 +++ 01-ctest/main.c | 18 ++++++++++++++++++ 01-ctest/start.S | 25 +++++++++++++++++++++++++ 01-ctest/test.h | 5 +++++ 4 files changed, 51 insertions(+) create mode 100644 01-ctest/Makefile create mode 100644 01-ctest/main.c create mode 100644 01-ctest/start.S create mode 100644 01-ctest/test.h (limited to '01-ctest') diff --git a/01-ctest/Makefile b/01-ctest/Makefile new file mode 100644 index 0000000..84e84e4 --- /dev/null +++ b/01-ctest/Makefile @@ -0,0 +1,3 @@ +TARGET:=dispctest.elf +OBJS:=start.o main.o +include ../common.mk diff --git a/01-ctest/main.c b/01-ctest/main.c new file mode 100644 index 0000000..fb7ec73 --- /dev/null +++ b/01-ctest/main.c @@ -0,0 +1,18 @@ +#include + +enum { + DISPH = 480, + DISPW = 800, +}; + +void cstart(void) +{ + uint16_t * const dptr = (uint16_t *)0x14800000; + + for (int y = 0; y < DISPH; y++) { + for (int x = 0; x < DISPW; x++) { + dptr[y*DISPW+x] = ((x&1)^(y&1)) ? 0 : 0xffff; + } + } +} + diff --git a/01-ctest/start.S b/01-ctest/start.S new file mode 100644 index 0000000..933bf48 --- /dev/null +++ b/01-ctest/start.S @@ -0,0 +1,25 @@ +#define VRAMADDR 0x14800000 +#define DISPH 480 +#define DISPW 800 + +#define DRAM_START 0xa0000000 +#define DRAM_END 0xa4000000 + +.globl start +.arm +start: + @setup stack + ldr sp, =(DRAM_END) + @initialize bss + ldr r0, =_edata + ldr r1, =_end + mov r2, #0 +.Lbssloop: + cmp r0, r1 + bhs .Lbssloopend + stmia r0!, {r2} + b .Lbssloop +.Lbssloopend: + blx cstart +.Lhalt: + b .Lhalt diff --git a/01-ctest/test.h b/01-ctest/test.h new file mode 100644 index 0000000..6290759 --- /dev/null +++ b/01-ctest/test.h @@ -0,0 +1,5 @@ +#ifndef MYON_TEST_H_INCLUDED +#define MYON_TEST_H_INCLUDED +int add(int a, int b); +int addt(int a, int b) __attribute__((target("thumb"))); +#endif // MYON_TEST_H_INCLUDED -- cgit v1.2.3