Calculator Community > Calculator C

Nspire C Development

(1/2) > >>

apcalc:
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!!!!!!!

DJ Omnimaga:
glad you figured out ^^

apcalc:
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: ---//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

--- End code ---

bwang:
Post your modified code, if any.

apcalc:
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: ---#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;
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version