Ok, so I made the decision to go ahead and start learning C for nspire, because I like c++. Yea, I know the two aren't so close, but some things carry from one to the other.
I've gotten the setup nailed down sortof, I've run into a problem though...
me@mygatewaylaptop-NV55S:~/nspiresdk/projects/helloworld$ make
nspire-gcc -Os -Wall -W -marm -I /home/myhome/nspiresdk/ndless/include/ -c hello.c
nspire-ld hello.o -o helloworld.elf
/bin/nspire-ld: line 54: cd: /bin/../system: No such file or directory
make: *** [helloworld.tns] Error 1
I went with the linking option, making links in /bin to point to the correct files, and nspire-gcc runs just fine. I do have the bin folder in my path now though, so I've got it dually covered. There is a /home/myhome/nspiresdk/ndless/system, there is no /system. Something might be wrong with the linked files, I might have to just remove them.
My makefile I stole from the samples given, here it is:
GCC = nspire-gcc
LD = nspire-ld
GCCFLAGS = -Os -Wall -W -marm -I /home/myhome/nspiresdk/ndless/include/
LDFLAGS =
OBJCOPY := "$(shell which arm-elf-objcopy 2>/dev/null)"
ifeq (${OBJCOPY},"")
OBJCOPY := arm-none-eabi-objcopy
endif
EXE = helloworld.tns
OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
DISTDIR = .
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(GCCFLAGS) -c $<
$(EXE): $(OBJS)
$(LD) $^ -o $(@:.tns=.elf) $(LDFLAGS)
mkdir -p $(DISTDIR)
$(OBJCOPY) -O binary $(@:.tns=.elf) $(DISTDIR)/$@
clean:
rm -f *.o *.elf
rm -f $(DISTDIR)/$(EXE)
and if you want source code, its really simple, I took the helloworld sample.
#include <os.h>
#include <nspireio2.h>
int main(void) {
nio_console csl;
lcd_ingray();
clrscr();
// 53 columns, 29 rows. 0px offset for x/y. Background color 0 (black), foreground color 15 (white)
nio_InitConsole(&csl, 53, 29, 0, 0, 0, 15);
nio_DrawConsole(&csl);
nio_printf(&csl, "hello world!");
wait_key_pressed();
nio_CleanUp(&csl);
return 0;
}
This is probably quite a simple solve, but I don't know my way around the nspire complier/linker yet.