alot of stuff, mostly testing

This commit is contained in:
franchiopin 2024-05-20 21:32:41 +01:00
parent 613fde5a61
commit dabd9dda17
12 changed files with 119 additions and 0 deletions

17
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/franchioping/NSpire/Ndless/ndless-sdk/include/*"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-arm"
}
],
"version": 4
}

View File

@ -12,6 +12,7 @@ main:
mov r9, sp
sub sp, sp, #s_SIZE // Reserve space for state ADDED
mov r4, #0
mov r6, #s_SIZE
1: subs r6, r6, #4
@ -19,6 +20,9 @@ main:
bne 1b
str r5, [r9, #s_saved_sp]
@ Get our folder path
add r4, r9, #s_path
mov r2, r4

1
testing/.buildver Normal file
View File

@ -0,0 +1 @@
5

61
testing/Makefile Normal file
View File

@ -0,0 +1,61 @@
DEBUG = FALSE
BLD_FILE ?= .buildver
# Initiate BLD_FILE if not exists
buildver_create := $(shell if ! test -f $(BLD_FILE); then echo 0 > $(BLD_FILE); fi)
# Prepare callable function. This function updates BLD_FILE
buildver = $(shell echo $$(($$(cat $(BLD_FILE)) + 1)) > $(BLD_FILE))
VER = buildver
GCC = nspire-gcc
AS = nspire-as
GXX = nspire-g++
LD = nspire-ld
GENZEHN = genzehn
EXE = nespire_mod_$(shell cat $(BLD_FILE))
GCCFLAGS = -Wall -W -marm
LDFLAGS =
ZEHNFLAGS = --name "$(EXE)"
ifeq ($(DEBUG),FALSE)
GCCFLAGS += -Os
else
GCCFLAGS += -O0 -g
endif
OBJS = $(patsubst %.c, %.o, $(shell find . -name \*.c))
OBJS += $(patsubst %.cpp, %.o, $(shell find . -name \*.cpp))
OBJS += $(patsubst %.S, %.o, $(shell find . -name \*.S))
DISTDIR = .
vpath %.tns $(DISTDIR)
vpath %.elf $(DISTDIR)
all: $(EXE).tns
%.o: %.c
$(GCC) $(GCCFLAGS) -c $< -o $@
%.o: %.cpp
$(GXX) $(GCCFLAGS) -c $< -o $@
%.o: %.S
$(AS) -c $< -o $@
$(EXE).elf: $(OBJS)
mkdir -p $(DISTDIR)
$(LD) $^ -o $@ $(LDFLAGS)
$(EXE).tns: $(EXE).elf
$(GENZEHN) --input $^ --output $@.zehn $(ZEHNFLAGS)
$(call buildver)
make-prg $@.zehn $@
rm $@.zehn
clean:
rm -f $(OBJS) $(DISTDIR)/$(EXE).tns $(DISTDIR)/$(EXE).elf $(DISTDIR)/$(EXE).zehn nespire_mod_*.elf nespire_mod_*.tns

3
testing/arm_util.S Normal file
View File

@ -0,0 +1,3 @@
.global arm_util_stuff
arm_util_stuff:
bx lr

BIN
testing/arm_util.o Normal file

Binary file not shown.

17
testing/main.S Normal file
View File

@ -0,0 +1,17 @@
.extern arm_util_stuff
.global main
main:
push {r4-r11, lr}
mov r9, sp
bl util_stuff
mov sp, r9
pop {r4-r11, pc}

BIN
testing/main.o Normal file

Binary file not shown.

BIN
testing/nespire_mod_4.elf Executable file

Binary file not shown.

BIN
testing/nespire_mod_4.tns Normal file

Binary file not shown.

16
testing/util.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <dirent.h>
#include <libndls.h>
void util_stuff();
void util_stuff(){
printf("Hello World!\n");
wait_key_pressed();
return;
}

BIN
testing/util.o Normal file

Binary file not shown.