Browse Source

update conway example to use zz9k_env.h

pull/1/head
mntmn 7 months ago
parent
commit
af9d5a247a
3 changed files with 6 additions and 12 deletions
  1. 2
    2
      conway/build-conway.sh
  2. BIN
      conway/conway.bin
  3. 4
    10
      conway/conway.c

+ 2
- 2
conway/build-conway.sh View File

@@ -1,10 +1,10 @@
COMPILE="arm-none-eabi-gcc -std=gnu99 -nostdlib -O5 -c -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard -I../lib"
COMPILE="arm-none-eabi-gcc -std=gnu99 -nostdlib -O5 -c -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard -I../lib -I../include"
LINK="arm-none-eabi-gcc -T ../link.ld -std=gnu99 -nostdlib -O5 -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard"
NAME=conway

mkdir -p build

$COMPILE -I. -o build/conway.o conway.c
$COMPILE -I. -o build/$NAME.o $NAME.c
$COMPILE -o build/idiv.o ../lib/div/idiv.S
$COMPILE -o build/idivmod.o ../lib/div/idivmod.S
$COMPILE -o build/ldivmod.o ../lib/div/ldivmod.S

BIN
conway/conway.bin View File


+ 4
- 10
conway/conway.c View File

@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <unistd.h>
#include "printf/printf.h"
#include "zz9k_env.h"

// matrix width and height
#define CONW_W 640
@@ -10,13 +11,13 @@ unsigned char univ[CONW_H][CONW_W];
unsigned char new[CONW_H][CONW_W];

void __aeabi_idiv0(int r) {
printf("__aeabi_idiv0()!\n");
while (1) {
printf("__aeabi_idiv0()!\n");
}
}
void __aeabi_ldiv0(int r) {
printf("__aeabi_idiv0()!\n");
while (1) {
printf("__aeabi_idiv0()!\n");
}
}

@@ -77,17 +78,10 @@ void init(int w, int h) {
}
}

struct ZZ9K_ENV {
uint32_t api_version;
uint32_t argv[8];
uint32_t argc;
int (*fn_putchar)(char);
};

struct ZZ9K_ENV* _zz9k_env;

void _putchar(char c) {
_zz9k_env->fn_putchar(c);
_zz9k_env->putchar(c);
};

int did_init = 0;

Loading…
Cancel
Save