From e5d61f594f04639728af455ee2c3f01b0408145f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20B=C3=A9rub=C3=A9?= Date: Fri, 30 Aug 2024 16:32:37 -0400 Subject: [PATCH] Identifying Anyka chips and adding an additional toolchain for this platform --- build.sh | 16 +++++++++++++--- src/compat.c | 1 + src/hal/support.c | 13 ++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index ad84e70..4e79382 100755 --- a/build.sh +++ b/build.sh @@ -1,15 +1,20 @@ #!/bin/sh DL="https://github.com/openipc/firmware/releases/download/latest" EXT="tgz" +PRE="linux" toolchain() { if [ ! -e toolchain/$1 ]; then wget -c -q $DL/$1.$EXT -P $PWD mkdir -p toolchain/$1 - tar -xf $1.$EXT -C toolchain/$1 --strip-components=1 || exit 1 + if [ "$EXT" = "zip" ]; then + unzip $1.$EXT || exit 1 + else + tar -xf $1.$EXT -C toolchain/$1 --strip-components=1 || exit 1 + fi rm -f $1.$EXT fi - make -j $(nproc) -C src -B CC=$PWD/toolchain/$1/bin/$2-linux-gcc OPT="$OPT $3" + make -j $(nproc) -C src -B CC=$PWD/toolchain/$1/bin/$2-$PRE-gcc OPT="$OPT $3" } if [ "$2" = "debug" ]; then @@ -19,7 +24,12 @@ else fi if [ "$1" = "arm-musl" ]; then - toolchain cortex_a7_thumb2-gcc13-musl-4_9 arm + toolchain cortex_a7_thumb2-gcc13-musl-4_9 arm +elif [ "$1" = "arm9-glibc" ]; then + DL="https://github.com/Lamobo/Lamobo-D1/raw/master/compiler" + EXT="tar.bz2" + PRE="none-linux-gnueabi" + toolchain arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu arm "-ldl -lm -lpthread -lrt -std=gnu99" elif [ "$1" = "arm9-musl3" ]; then toolchain arm926t-gcc13-musl-3_0 arm elif [ "$1" = "arm9-musl4" ]; then diff --git a/src/compat.c b/src/compat.c index 9f3a486..d97c57e 100644 --- a/src/compat.c +++ b/src/compat.c @@ -26,6 +26,7 @@ int sTaT(const char *path, struct _stat_ *buf) #endif void __assert(void) {} +void akuio_clean_invalidate_dcache(void) {} void backtrace(void) {} void backtrace_symbols(void) {} void __ctype_b(void) {} diff --git a/src/hal/support.c b/src/hal/support.c index b5ccf48..f1f455e 100644 --- a/src/hal/support.c +++ b/src/hal/support.c @@ -184,10 +184,17 @@ void hal_identify(void) { return; } - if (!access("/sys/devices/platform/ak39-uart.0", F_OK)) { + if (!access("/sys/devices/platform/ak39-uart.0", F_OK) && + hal_registry(0x08000000, &val, OP_READ)) { plat = HAL_PLATFORM_AK; - strcpy(chip, "AK3918"); - strcpy(family, "anyka"); + strcpy(chip, "AK3918E"); + switch(val) { + case 0x20120100: strcat(chip, "V100"); break; + case 0x20150200: strcat(chip, "V200"); break; + case 0x20160100: strcat(chip, "V300"); break; + case 0x20160101: strcat(chip, "V330"); break; + } + strcpy(family, "AK3918"); chnCount = AK_VENC_CHN_NUM; chnState = (hal_chnstate*)ak_state; //aud_thread = ak_audio_thread;