arm: merged libc and libtcc1

This commit is contained in:
Steven Hugg 2023-12-30 16:25:16 -05:00
parent 70eee2bdae
commit 9142328468
9 changed files with 47 additions and 13 deletions

View File

@ -0,0 +1,7 @@
#define SERIAL_OUT ((int*)0x4000048)
void putchar_(char c) {
*SERIAL_OUT = c;
}

35
presets/arm32/sieve.c Normal file
View File

@ -0,0 +1,35 @@
#include <string.h>
#include <stdio.h>
#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;
}

View File

@ -2,15 +2,10 @@
#include <string.h>
#include <stdio.h>
#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;
}

View File

@ -65,6 +65,7 @@ class ARM32Platform extends BaseARMMachinePlatform<ARM32Machine> 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();

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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'],
},
};

View File

@ -352,9 +352,6 @@ export async function linkARMTCC(step: BuildStep): Promise<WorkerResult> {
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);