Author Topic: Nspire C Development  (Read 5256 times)

0 Members and 1 Guest are viewing this topic.

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Nspire C Development
« on: July 03, 2010, 11:02:45 pm »
Hi.  I have been trying to set up a C development environment for my computer (running Windows 7).  In the Ndless development readme, it says, after downloading MinGW to "* Copy Ndless/Makefile.config.tpl to Ndless/Makefile.config and configure the latter".  I am kind of new to C programming/programming in general and using things like the command prompt on the computer and I have no idea what this statement means.  Could someone explain what I have to do in this step?  Thank you in advance!!

Also, Do I only need to downlaod MinGW, MSYS, and YAGARTO, or do I need the other files listed below in the readme?  Thanks! :)

EDIT *********************

Nevermind. I was able to compile the Ndless demo tonight, so I think I am ok!!!!!!!
« Last Edit: July 03, 2010, 11:35:10 pm by apcalc »


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nspire C Development
« Reply #1 on: July 03, 2010, 11:48:22 pm »
glad you figured out ^^

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Nspire C Development
« Reply #2 on: July 05, 2010, 11:16:43 pm »
I think I may actually have a problem with my C compiling :(

When I compile the Ndless demo, it runs correctly when you first start it (which led me to believe I had it working) but after crashing the emulator with a few of my own programs, I went back and compiled the demo again.  I discovered, sadly, that the demo runs until I hit a key.  Escape will work to exit the program, but when I press any of the other keys for commands in the program (*,/,t,c) it just freezes.  I have not idea what could be causing this, but I suspect that this may be caused by the newer versio of YAGARTO that I am using.  I had to edit the makefile (source below) and I thought I did everything right, but I may be wrong.  Also, although the esc key works in the demo, it will not work in any other programs I make, even if I just take all of the code out of the Ndless demo except the escape part. Does anyone here know what could be causing this? Thank you very much for your help!

Edit- In case this is needed, I am on Windows 7 using MinGW, MSYS, and YAGARTO
Code: [Select]
//Make File
NSPIRE_HARDWARE ?= NON_CAS

AS = arm-none-eabi-as
ASFLAGS = -mcpu=arm7tdmi
GCC = arm-none-eabi-gcc
GCCFLAGS = -mcpu=arm7tdmi -Os -Wall -W -fpic -fno-merge-constants
LD = arm-none-eabi-ld
LDFLAGS =
OBJCOPY = arm-none-eabi-objcopy
HEADERSDIR=../headers
SYSTEMDIR=../system
TOOLSDIR=../../tools
OBJ = main.o syscalls.o utils.o vector.o particle.o particle_system.o gravity_particles.o

all: demo

.c.o:
$(GCC) $(GCCFLAGS) -c -I$(HEADERSDIR) -D $(NSPIRE_HARDWARE) $<

demo: $(OBJ)
@rm -rf [email protected]
$(GCC) $(GCCFLAGS) $(LDFLAGS) -T $(SYSTEMDIR)/ldscript $(SYSTEMDIR)/crt0.s $^ -o [email protected]
$(OBJCOPY) -O binary [email protected] [email protected]
mkdir -p ../../res/$(NSPIRE_HARDWARE)
$(TOOLSDIR)/MakeTNS/MakeTNS [email protected] ../../res/$(NSPIRE_HARDWARE)/[email protected]
rm -f [email protected] [email protected]

.PHONY: clean

clean:
@rm -rf *.bin *.elf *.o
« Last Edit: July 05, 2010, 11:17:28 pm by apcalc »


Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire C Development
« Reply #3 on: July 05, 2010, 11:26:16 pm »
Post your modified code, if any.

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Nspire C Development
« Reply #4 on: July 06, 2010, 09:44:55 am »
Here is an example of a program that causes a problem.  It compiles successfully, but when I send it to the calculator it shows the dialog box and then freezes.  Also, this is just the start of a simple tunnel program I was writing to get used to the syntax, at this point, all it should do is show the dialog box and wait until escape is pressed.  Although this code made me discover this problem, it is still there even if I used a completly unmodified version of the Ndless demo (I tried a fresh downloaded copy).

Code: [Select]
#include <os.h>
#include "utils.h"
#include "common.h"

asm(".string \"PRG\"\n");

int main(void) {
unsigned char marker[]={0x18,0x3c,0x7e,0xff};
int c,key,lengthchange,ycord,leftx,length;
unsigned long int score;
float spritepos;
clearScreen();
showSimpleDialogBox("TI-Nspire Tunnel","TI-Nspire Tunnel\n\nUse the Left and Right keys to control your ship!");
clearScreen();
score=0;
lengthchange=1;
spritepos=77;
score=0;
leftx=45;
length=81;
c=0;

for(ycord=0;ycord<SCREEN_HEIGHT;ycord++) {
  c=rand(2);
  if (c==0) {
    leftx--;
  }
  else if (c==1) {
    leftx++;
  }
}
ycord=0;
while(!isKeyPressed(KEY_NSPIRE_ESC));
return 0;
}


Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Nspire C Development
« Reply #5 on: July 06, 2010, 10:06:40 pm »
I think I found the old version of YAGARTO on the source forge page with the arm-elf instead of the arm-none-eabi.  Should I try downloading this in a separate folder and see if that fixes my compiling errors, or is it something more complicated that is causing this?