Author Topic: Ndless SDK Setup Linux  (Read 2904 times)

0 Members and 1 Guest are viewing this topic.

Offline Ti-Programmer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 84
  • Rating: +3/-0
  • Whats this? so many features...
    • View Profile
    • Ti-Programmer's website
Ndless SDK Setup Linux
« on: March 26, 2013, 04:47:36 pm »
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...

Code: [Select]
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:

Code: [Select]
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.

Code: [Select]
#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.
Spoiler For Sig:







Offline Ti-Programmer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 84
  • Rating: +3/-0
  • Whats this? so many features...
    • View Profile
    • Ti-Programmer's website
Re: Ndless SDK Setup Linux
« Reply #1 on: March 26, 2013, 05:51:55 pm »
Yea that was dumb on my part, the links were what were causing problems. Thanks for the help guys :P hahaha I got it fixed.
Spoiler For Sig:







Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Ndless SDK Setup Linux
« Reply #2 on: March 28, 2013, 08:08:05 am »
Hmm, I had this problem too. Are you sure that it works all right now? Since for me everything was offset
I'm not a nerd but I pretend:

Offline Ti-Programmer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 84
  • Rating: +3/-0
  • Whats this? so many features...
    • View Profile
    • Ti-Programmer's website
Re: Ndless SDK Setup Linux
« Reply #3 on: March 29, 2013, 07:37:02 pm »
Yea, remove the links in /bin, they don't work like they should. I added the bin folder to my path in ~/.bashrc, so I didn't really need links. It compiles and programs work on calc for me.
Spoiler For Sig: