diff --git a/presets/arm32/serialout.c b/presets/arm32/serialout.c new file mode 100644 index 00000000..b3090a31 --- /dev/null +++ b/presets/arm32/serialout.c @@ -0,0 +1,7 @@ + +#define SERIAL_OUT ((int*)0x4000048) + +void putchar_(char c) { + *SERIAL_OUT = c; +} + diff --git a/presets/arm32/sieve.c b/presets/arm32/sieve.c new file mode 100644 index 00000000..0d7f4e3b --- /dev/null +++ b/presets/arm32/sieve.c @@ -0,0 +1,35 @@ + +#include +#include + +#define true 1 +#define false 0 +#define size 8190 +#define sizepl 8191 + +//#link "serialout.c" + +main() { + char flags[sizepl]; + int i, prime, k, count, iter; + printf("Running benchmark...\n"); + for (iter = 1; iter <= 10; iter ++) { + count=0; + for (i = 0; i <= size; i++) + flags[i] = true; + for (i = 0; i <= size; i++) { + if (flags[i]) { + prime = i + i + 3; + k = i + prime; + while (k <= size) { + flags[k] = false; + k += prime; + } + count = count + 1; + } + } + } + printf("Primes: %d\n", count); + return 0; +} + diff --git a/presets/arm32/skeleton.armtcc b/presets/arm32/skeleton.armtcc index d00f2cd9..7d902706 100644 --- a/presets/arm32/skeleton.armtcc +++ b/presets/arm32/skeleton.armtcc @@ -2,15 +2,10 @@ #include #include -#define SERIAL_OUT ((int*)0x4000048) - -void putchar_(char c) { - *SERIAL_OUT = c; -} +//#link "serialout.c" int main() { - int x = 2024*2; - x /= 2; // TODO: we need this to bring in __aeabi_uldivmod() etc. + int x = 2024; printf("Hello World! %d\n", x); return 0; } diff --git a/src/platform/arm32.ts b/src/platform/arm32.ts index 4a593e71..01110bd8 100644 --- a/src/platform/arm32.ts +++ b/src/platform/arm32.ts @@ -65,6 +65,7 @@ class ARM32Platform extends BaseARMMachinePlatform implements Plat {name:'ROM',start:0x0000000,size:0x100000,type:'ram'}, {name:'I/O',start:0x4000000,size:0x100,type:'io'}, ] } }; + getPlatformName() { return "ARM7"; } getDebugTree() { return this.machine.cpu.getDebugTree(); } disassemble(pc:number, read:(addr:number)=>number) : DisasmLine { var is_thumb = this.machine.cpu.isThumb(); diff --git a/src/worker/fs/arm32-fs.zip b/src/worker/fs/arm32-fs.zip index 49cb5161..f8ee993d 100644 Binary files a/src/worker/fs/arm32-fs.zip and b/src/worker/fs/arm32-fs.zip differ diff --git a/src/worker/lib/arm32/libc.a b/src/worker/lib/arm32/libc.a index 9c7553d3..ba6fe7b1 100644 Binary files a/src/worker/lib/arm32/libc.a and b/src/worker/lib/arm32/libc.a differ diff --git a/src/worker/lib/arm32/libtcc1.a b/src/worker/lib/arm32/libtcc1.a deleted file mode 100644 index 8817120e..00000000 Binary files a/src/worker/lib/arm32/libtcc1.a and /dev/null differ diff --git a/src/worker/platforms.ts b/src/worker/platforms.ts index 63559b34..c0d1fae0 100644 --- a/src/worker/platforms.ts +++ b/src/worker/platforms.ts @@ -359,9 +359,8 @@ export var PLATFORM_PARAMS = { arch: 'arm32', define: ['__ARM__', 'DISABLE_UNIMPLEMENTED_LIBC_APIS', 'PRINTF_ALIAS_STANDARD_FUNCTION_NAMES_SOFT'], extra_compile_args: ['-I./arch/arm/include', '-I./openlibm/include', '-I./openlibm/src', '-I./printf/src'], - extra_link_files: ['crt0.c', 'libtcc1.a', 'libc.a'], - extra_link_args: ['-ltcc1', '-lc'], - crt0: 'crt0.c', + extra_link_files: ['crt0.c', 'libc.a'], + extra_link_args: ['crt0.c', '-lc'], }, }; diff --git a/src/worker/tools/arm.ts b/src/worker/tools/arm.ts index be231230..5f3a4a54 100644 --- a/src/worker/tools/arm.ts +++ b/src/worker/tools/arm.ts @@ -352,9 +352,6 @@ export async function linkARMTCC(step: BuildStep): Promise { if (params.define) { params.define.forEach((x) => args.push('-D' + x)); } - if (params.crt0) { - args.push(params.crt0); - } args = args.concat(step.files); if (params.extra_link_args) { args = args.concat(params.extra_link_args);