Omnimaga

Calculator Community => TI Calculators => Calculator C => Topic started by: apcalc on July 10, 2010, 12:15:20 pm

Title: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 10, 2010, 12:15:20 pm
TI-Nspire C Development Set Up For Ndless Version 1.7

Many people on this website, including myself, have had questions/problems on setting up a C development environment for the TI-Nspire. Because of this, I thought I would write this tutorial to clearly describe the steps to set up a development environment, compile a file, and describe some of the common errors when compiling.

Setting up a Windows C development environment

Two programs are needed for a Windows C development environment:  MSYS, and the YAGARTO toolchain.  You will also need a copy of Ndless for some tools needed to compile.

First, you must install MSYS, which is, according to its website "MSYS, a contraction of "Minimal SYStem", is a Bourne Shell command line interpreter system. Offered as an alternative to Microsoft's cmd.exe, this provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform; it includes a small selection of Unix tools, chosen to facilitate that objective, and using it is a necessary prerequisite for building mingwPORTs."  Here is the link to install MSYS.

http://sourceforge.net/projects/mingw/files/MSYS/BaseSystem/msys-core/msys-1.0.11/MSYS-1.0.11.exe/download

Then, you must install YAGARTO, which is a GNU ARM toolchain for Windows.  When you install, make sure the box "Add YAGARTO's to your PATH variable" is checked.  Here is the link.

http://sourceforge.net/projects/yagarto/

Finally, you have to add the Ndless /sdk/bin Directory to your path variable.  If you are running Windows Vista or Windows 7, you can add to the Path variable by press the "Windows" key.  Then, type Path in the search field and choose option two, "Edit the system environment variables".  A dialog box should open up; click "Environment Variables" near the bottom of the dialog box.  A new dialog box should pop up; in the second field, navigate to the "Path" variable and click "edit", then add the Ndless /sdk/bin directory to the end of the list.

To confirm that you have successfully added to the path variable, open the command prompt and type:

Code: [Select]
echo %path%

It should be at the end of the list.

You now have all of the components needed for a C development environment for Windows.  In the next section, I will explain how to compile a file.

Compiling a file

For this example, we will compile the Ndless demo.  First, it is probably best to start with a fresh copy of Ndless, which can be downloaded from the following link.  After you download, unzip the file and remember the file directory to the folder.  You will need this soon.

http://www.ticalc.org/archives/files/fileinfo/426/42626.html

Now, open MSYS and set the current directory to the folder in Ndless that contains the Ndless demo.  Do this by typing "cd <Place Ndless folder path here>/src/samples/particles.  Now type "make".  The Ndless demo should have successfully compiled! You should have received the message:

Code: [Select]
$ make
nspire-gcc -Os -Wall -W -c main.c
nspire-gcc -Os -Wall -W -c utils.c
nspire-gcc -Os -Wall -W -c vector.c
nspire-gcc -Os -Wall -W -c particle.c
nspire-gcc -Os -Wall -W -c particle_system.c
nspire-gcc -Os -Wall -W -c gravity_particles.c
nspire-ld  main.o utils.o vector.o particle.o particle_system.o gravity_particles.o -o particles.elf
arm-none-eabi-objcopy -O binary particles.elf ../../calcbin/samples/particles.tns

If you received this message, or something close to it, you are now ready to start developing in C for the Nspire!  The easiest way to do so is simply to edit the "main.c" file.  Look in the files "common.h", "utils.h", and "os.h" to find commands you can use.  Likewise, there are several functions in the Nspire libraries, which are documented at hackspire (http://hackspire.unsads.com).  Also, there are some very useful header files in the tread "Post your Nspire routines here" here at Omnimaga.  If you did not receive this message shown above, you probably received an error message.  In the next section, I will list common error messages and methods to fix them.

Common Error Messages

If you are getting an error message about a file not being found (such as MakeTNS.exe, FlashEdit.exe, nsprie-gcc), make sure you added the bin/ of Ndless to your path variable.  Check this by opening a command prompt window and typing:

Code: [Select]
echo %PATH%

Note:  If you are attempting to build Ndless and you are getting errors, please ensure that the following directories are in your path:
1. MSYS /bin
2. MinGW /bin
3. Ndless Root /bin (created by "make" in the tools directory of Ndless)
4. 7zip Root
5. YAGARTO /bin

If the Ndless /sdk/bin/ directory is not listed in the %PATH% list, follow the procedure above to add it.

If your error message is not listed here, or you have any other questions about the instillation process, feel free to post a reply below and I will try to edit this post and add new error messages here. Thank you!  Good luck developing!

Also, If you do not like using notepad/wordpad to type your code in a text editor with colorized syntax, you can use different text editors such as gedit, Programmers Notepad 2, and Notepad++, all of which have syntax highlighting for C code.

In addition, you can also use the Eclipse C/C++ IDE for developing Ndless programs.  More information on setting up this IDE, and linking it with the GDB Debugging support incorporated into the TI-Nspire Emulator Ncubate can be found in this video on YouTube:

Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: fb39ca4 on July 10, 2010, 01:17:37 pm
I found it easier to install YAGARTO tools (at least in windows), which can be run from cmd.exe, so I can just create a batch file that just contains "make".
Download YAGARTO tools:
http://www.yagarto.de/download/yagarto/yagarto-tools-20100703-setup.exe (http://www.yagarto.de/download/yagarto/yagarto-tools-20100703-setup.exe)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on July 10, 2010, 02:48:27 pm
Nice that should be useful :D

Thanks apcalc fro posting this :D
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: bwang on July 10, 2010, 03:39:30 pm
Excellent :)
This should be stickied. Someday, this sub-forum will have many threads in it, and this tutorial will be hard to find.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on July 10, 2010, 10:54:53 pm
Stickied
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on July 11, 2010, 01:36:20 am
Some fixes and improvements to the Ndless demo Makefile were performed after Ndless 1.0, in the public part of the SVN repository.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 22, 2010, 02:27:03 pm
ok I am having a problem, as seen in this video




Heck with it, can someone give the the source code for saying "hello world", that is compatible with the nspire, if I can just make that I can go from there.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: bwang on July 22, 2010, 04:07:09 pm
You should start by trying to compile the Ndless demo with no modifications. If that works, you know your dev environment is working.
Like so:
Code: [Select]
cd <ndless root directory>/src/arm/demo
make
Post any errors you get here.
Alternatively, you can grab skeleton-windows.zip from the first post here (http://ourl.ca/4852), unzip it, cd to the directory it unzipped to, and run 'make'. This has the advantage containing only what you need to compile, which makes it easier to distribute your sources when you release.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: fb39ca4 on July 22, 2010, 04:11:09 pm
You should use YAGARTO, it's much more windows-friendly.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 22, 2010, 05:24:22 pm
qazz, in the video, you are typing "make test".  Try only typing "make", then press enter.  When I type "make main", I get the same error message.  Also, here is the code for a program that will display "Hello World" in a dialog box:

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

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

int main(void) {
showSimpleDialogBox("Hello World!","Hello World");
return 0;
}

Also, attached is a .tns file of that code compiled.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 22, 2010, 05:44:17 pm
If I say make, it says no target specified
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 22, 2010, 05:46:37 pm
If I say make, it says no target specified

Did you successfully compile the Ndless demo.

In MSYS, type:

Code: [Select]
cd <Path to Ndless directory>/src/arm/demo
make

Post the message you get.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 22, 2010, 06:08:23 pm
Yes I have
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 22, 2010, 06:10:10 pm
Ok, If you have successfully compiled the Ndless, demo, try opening the main.c file in the demo, erase the contents, and replace it with the code for the "hello world" program above.  You may just not have the right header files in the directory to compile
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 22, 2010, 08:57:35 pm
Apcalc, here is my result
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 22, 2010, 09:03:44 pm
It works fine for me. :)

Glad to hear you got it working. :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 22, 2010, 09:05:41 pm
Wait, you have ndless? Are you affected by the power management bug?

Also, is showSimpleDialogBox for the nspire only?

A google search says yes.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 22, 2010, 09:08:22 pm
Yes, I have Ndless on my calculator and on the emulator.  I tested the program on the emulator.

Unfourtonately, I am affected by the power management bug.  It is annoying at first, but if you use calc84's reset program, it is not as bad.

As far as I know, showSimpleDialogBox is only for the Nspire
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 22, 2010, 09:17:13 pm
I would like to, but I use my TI-84+ Keypad, and for some reason, that is also affected by the bug :/
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Galandros on July 23, 2010, 11:42:51 am
I was waiting for this.
Bookmarked the url for now but I will try to compile a demo someday.

If I tried to make this myself, I would end up doing a post like this. Hopefully someone did first. :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on July 29, 2010, 03:58:07 pm
It is annoying at first, but if you use calc84's reset program, it is not as bad.
Except when you always forget to move the cursor over it or over the folder it's in everytime you turn off the calc x.x (which is why at one point I gave up x.x)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: fb39ca4 on July 29, 2010, 04:54:23 pm
The folder trick helps (putting reset in a folder named a), though with the 84+ keypad, there's not much in terms of software.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on July 29, 2010, 05:01:04 pm
It is annoying at first, but if you use calc84's reset program, it is not as bad.
Except when you always forget to move the cursor over it or over the folder it's in everytime you turn off the calc x.x (which is why at one point I gave up x.x)


I totally agree with you, it is the one reason I dont have ndless now :/
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 29, 2010, 05:03:47 pm
As fb39ca4 said, just put it into a folder that is easy to access (at top or bottom of list, maybe in a separate folder named "a") so it is easy to navigate to blindly.  Then, if you forget to put the cursor over it, just hit home, 6, up a few times to get to the top, left to close the folder if it is open, right to open it, then enter, and it should work. :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on July 29, 2010, 08:36:22 pm
Yeah I know, this is what I did too, but I always forgot to select the folder I needed. Also, didn't moving up moved the cursor completly at the bottom of the list when it was at the top or vice versa? Some calc menus does that IIRC, so basically putting it at the top or bottom wouldn't make a difference if it was the case.  Also I never could figure out a similar way to fix the power management issue when using the 84+ key pad for 84+ mode :/
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on July 31, 2010, 12:05:51 pm
Tutorial updated for Ndless Version 1.1. :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on July 31, 2010, 05:06:37 pm
Glad to hear ^^
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ExtendeD on August 01, 2010, 03:07:09 am
Thanks apcalc. Everything is correct except the link to Ndless :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on August 03, 2010, 12:31:34 pm
Oops. I missed that link.  It is fixed now. :) Thanks ExtendeD!
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Myntal on August 17, 2010, 08:09:35 pm
Okay, I tried to make demo and I got Error 127. It also says Make: nspire-gcc: Command not found. I check the echo and ndless bin\ is there.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on August 17, 2010, 09:26:00 pm
Make sure you are using Ndless Version 1.1.  The previous version did not have this file.

EDIT: While reading the IRC logs, I saw that you downloaded DevKitARM (I think that is the name?)  I am not sure if that is compatible with nspire-gcc.  It might require YAGARTO.  Likewise, make sure the path to DevKitARM is in your path variable.  If not, just add the /bin directory of DevKitARM to your path variable using process described in the tutorial.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: _player1537 on August 24, 2010, 11:12:05 pm
I just tried the link for MSYS, and it doesn't seem to be working for me.  It says "[file directory]/msys.exe can not be found".  Can someone else double check?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on August 24, 2010, 11:12:42 pm
The sf link must have changed.  I will fix this in a second.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: _player1537 on August 24, 2010, 11:13:05 pm
Ok, thank you :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on August 24, 2010, 11:14:41 pm
Fixed! :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: qazz42 on September 09, 2010, 08:36:01 am
nvmd, I fixed it

my path variable wasnt set
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: fb39ca4 on December 05, 2010, 03:19:11 pm
How would I navigate to the directory "c:\ndless-v1.7\" in MSYS? Before ndless 1.7 came out, I used yagarto tools, which worked in cmd, but now I have to use the MSYS terminal.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on December 05, 2010, 03:19:51 pm
Like this:

Code: [Select]
cd /c/ndless-1.7/
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ExtendeD on December 05, 2010, 05:19:05 pm
fb39ca4: have a look at the tutorial (http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction) which gives other commands you should know.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on January 03, 2011, 03:55:57 pm
I know this is kinda useless now that all of this information is available on Hackspire, but I updated this to include information for Ndless 1.7 in case someone looking to set up a development environment comes across this before Hackspire. :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on January 04, 2011, 02:46:55 pm
Cool. Something I wonder: Will a Ndless 2.0 program work on Ndless 1.7? Some people might prefer Ndless 1.7 so they can stick to the smaller OS 1.7. Or does Ndless 2.0 run on OS 1.7 too?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ExtendeD on January 04, 2011, 04:14:13 pm
Ndless 2.0 does support OSes from 1.7 to 2.1.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on January 04, 2011, 04:24:01 pm
Cool to hear :D
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ruler501 on January 20, 2011, 09:11:45 pm
Can I do this with a 2.0 OS Nspire? Do I need to do anything differently?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on January 23, 2011, 03:18:29 pm
Sorry for the late response.

This tutorial should work for developing files for the Nspire with OS 2.0, provided that you have Ndless 2.0 on the calculator! :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 14, 2011, 09:27:15 pm
This is a very helpful thread. Is there any way to program C on the go? Instead of plugging it into the computer and programming something on eclipse, then importing it onto the calculator, is there a way to program C on the go just like programming TI Basic on the TI 83 calculators? Just wondering, if there is any device, ever, not just a calculator that you are able to create applications and programs on, anywhere.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on February 14, 2011, 09:28:36 pm
Hi! Welcome to Omnimaga! :)

This is not possible on the Nspire, but it has been done before, namely with the TI-89 series of calculators.  A C-Development environment program, named GTC, was made that allowed C development directly on the calc.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 15, 2011, 03:58:49 pm
I wanna get a TI-89 calculator now, but I searched GTC on google and went directly to the website, however the website seems to be down and I wasn't able to find it anywhere else, not even in the download section of this site. Where else can I get it?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on February 15, 2011, 04:13:34 pm
The google cache still works:
http://webcache.googleusercontent.com/search?q=cache:B7qCcbiSKusJ:gtc.ti-fr.com/+gtc+89&cd=1&hl=en&ct=clnk&gl=us&source=www.google.com
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 15, 2011, 08:03:02 pm
Wow that is ingenious, the download links actually work from the google cache! I'll make a guide or something on how to program C on the calculator IF there isn't one already up, and IF I figure out how to myself, but feel free to do this first if you already know how and have the resources
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on February 15, 2011, 08:05:54 pm
As for programming in C on a calculator, these tutorials exist for the TI-89 (actually, I used them myself to learn C):
http://www.technoplaza.net/programming/
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 15, 2011, 09:44:36 pm
Ah, but this tutorial is how to program C on the calculator, on the computer. I wanted to write a tutorial on how to program C on the calculator, on the calculator.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on February 15, 2011, 09:54:21 pm
Yeah, that might be an issue. :(

Although, I think those tutorials still do apply to a good degree.  GTC is based on the TIGCC libs, which is what techno plaza bases their tutorials on.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Steelm on February 15, 2011, 10:08:50 pm
yes
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 15, 2011, 10:42:46 pm
So I also heard that TI-83+ and TI-84+ can link to the internet (http://www.cemetech.net/news.php?id=439)
BUT, it does not talk about TI-89 Titanium, would it still be possible to connect the TI-89 titanium to the internet?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on February 15, 2011, 11:51:34 pm
On a side note welcome to the forums new members :D

I am sure connecting a TI-89 to the internets is possible, although unfortunately almost nobody program for the TI-89 anymore, so it could take a long while before somebody ports CALCnet 2.2 to 68K calcs.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 16, 2011, 12:14:15 am
Agh, why did they stop developing programs for the TI-89? I mean it's almost 500x better than the TI-83+ and TI-84+ models!
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on February 16, 2011, 01:16:01 am
1) A long-time member of the 68K community that I will not name, but that many older members here heard about, have pretty much scared everyone away from the 68K scene with his endless trolling and unnecessary bashing of people hard work on projects. Some of it happened on ticalc.org in TiLP/TiEmu or 68K programs/POTY-related news, but the worst of it happened on 68K forums like yAronet and TI-Gen. People got so sick of him that they lost interest in 68K programming. Even some people from other forums that never interacted with him in any way stopped programming because of him. He recently faded away and got banned from the 68K French forum he was active on the most, but it's too late to repair the damage he did.

2) TI stopped doing marketting for the 68K series after the TI-Nspire came out. No new OS came out since 2006 either. There is speculation in the TI community that TI may even discontinue these models in the next few years, replaced by the TI-Nspire CAS. Point #2 certainly doesn't help the platform popularity. The same thing happened to the TI-86 after the TI-83 Plus became popular.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on February 16, 2011, 02:08:10 am
To those definite causes of TI-68k (89/92+/V200/89T) C/ASM programming being less popular than "modern TI-Z80" (83+/83+SE/84+/84+SE) ASM programming is, I'll add that due to the CAS, the TI-68k platform is forbidden in some standardized tests across multiple countries (starting with the USA). This significantly narrows the audience of the platform, and consequently the number of potential programmers. Despite the fact that the 68000 is more easily programmable in C than the Z80 is.
(technically, the 92 & 92 II models are TI-68k models as well, but they're both older and much harder to work with in C/ASM, so hardly anyone does)

Some of the latest ground-breaking programs for the TI-68k platform have been programmed mostly by someone previously known as a TI-Z80 expert, namely Brandon Wilson, with PS3JB89 and what is currently being called "Linky".
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on February 16, 2011, 03:19:02 am
Oh right, I forgot about the CAS, and didn't the 92/v200 got banned from tests due to the QWERTY keyboard too?

I remember 68K C used to be more popular than z80 calcs because on ticalc.org they used to split the 68K POTY in two surveys, but again staff were mostly 68K calc owners so they couldn't feature many z80 programs.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: fb39ca4 on February 17, 2011, 08:28:47 pm
Hi! Welcome to Omnimaga! :)

This is not possible on the Nspire, but it has been done before, namely with the TI-89 series of calculators.  A C-Development environment program, named GTC, was made that allowed C development directly on the calc.
I wouldn't say it is not possible. Gcc and the various tools it requires just need to be ported over. (Not that I'm going to do it or anything, but still,it is a possibility)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on February 17, 2011, 08:35:29 pm
Hi! Welcome to Omnimaga! :)

This is not possible on the Nspire, but it has been done before, namely with the TI-89 series of calculators.  A C-Development environment program, named GTC, was made that allowed C development directly on the calc.
I wouldn't say it is not possible. Gcc and the various tools it requires just need to be ported over. (Not that I'm going to do it or anything, but still,it is a possibility)

When I said it is "not possible", I meant that it is not possible at this time! :)

Sorry for any confusion I may have caused. :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: PeonHero on February 19, 2011, 11:13:09 pm
well it's impossible for everything to be possible, because if everything is possible, then it's possible that everything is impossible.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Jonius7 on February 22, 2011, 05:24:22 pm
Nice paradox PeonHero,
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: BrownyTCat on February 26, 2011, 09:43:09 pm
I just got this to work on my first try. Funny since I am new to all of these procedures except installing YAGARTO.  :thumbsup:
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: apcalc on February 26, 2011, 09:44:54 pm
I just got this to work on my first try. Funny since I am new to all of these procedures except installing YAGARTO.  ;D(http://www.omnimaga.org/Themes/default/images/gpbp_arrow_up.gif)

Good to hear! :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: DJ Omnimaga on February 28, 2011, 04:00:22 am
Good to hear. Good luck in your Nspire development. Feel free to ask questions. :D
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Munchor on March 04, 2011, 05:20:05 pm
I'm new to NSpire Development (C and Assembly) and there are a few things I'm curious about.

The files are .tns (Assembly files) but that's just to allow the Computer Link Software to read it, right?
C files are converted to Assembly when compiled?
I am gonna follow the tutorial later and then come back.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: shrear on March 04, 2011, 05:26:08 pm
yes and no if you mean "machine code"(hex) with assembly then 2*yes
but if you mean with assembly something like
...
add r1, r2
mov r3, #4
ldr r0, [r1]
...
then no
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: BrownyTCat on March 04, 2011, 07:56:50 pm
Good to hear. Good luck in your Nspire development. Feel free to ask questions. :D

Just 1 request. A working "Hello world". Puts() does nothing but crash, even when the file is unmodified.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ExtendeD on March 05, 2011, 03:05:28 am
Did you try samples/hello.tns? Does it crash?

puts() writes to the serial output, you won't see anything on real hardware unless you've built an adapter. But run from nspire_emu the text will be displayed on the DOS console.
There is currently no standard function to display text on the screen but several programs already integrate custom functions for this.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ruler501 on May 13, 2011, 07:51:18 pm
how do you do this on linux mint 10?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ExtendeD on May 14, 2011, 03:48:59 am
I don't know about mint, but http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction describes the setup for Ubuntu.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on May 14, 2011, 03:52:43 am
Yagarto is an arm-none-eabi toolchain (and that's what we want), while the Ubuntu toolchain is an arm-linux-gnueabi toolchain, AFAICT.

I'm currently in the process of further improving and documenting the script I use for creating an arm-none-eabi toolchain, re-testing it with GCC 4.5.3, Newlib 1.19.0 and GDB 7.2, and will post it to Hackspire :)
EDIT: done. http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction#On_other_Linux_distributions
But I think we want to remove the note about the Ubuntu/Mint package - it's not the toolchain flavor we're looking for.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on August 14, 2011, 12:02:41 pm
I've added blah/ndless2/sdk/bin to my PATH variable (in Ubuntu) but when after typing in "make" in the hello sample folder, I get this error: "make: execvp: nspire-gcc: Permission denied." If I type in "sudo make", I get "make: nspire-gcc: Command not found." What's wrong?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on August 14, 2011, 12:29:10 pm
1) Did the install script for the underlying ARM toolchain run to completion successfully ?
2) Does nspire-gcc have +x (executable) permissions ?
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: ExtendeD on August 14, 2011, 12:53:17 pm
[edit] didn't see Lionel's post.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on August 14, 2011, 12:57:51 pm
1. Yes, I have installed gcc-4.5-arm-linux-gnueabi and all of its dependencies correctly.
2. Yes, as well as everything else in the bin folder.

EDIT: If this helps anybody, the line after "command not found," it gives error 127.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on August 14, 2011, 01:23:11 pm
Quote
1. Yes, I have installed gcc-4.5-arm-linux-gnueabi and all of its dependencies correctly.
AFAICT, we usually compile the toolchain ourselves and use "none-eabi" instead of "linux-gnueabi" ;)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on August 14, 2011, 02:10:27 pm
I used the bash script here http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction (http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction) but it gives me an error during the installation of gcc. The console says: "checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES." and then the script exits.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on August 14, 2011, 02:38:53 pm
Ah, OK :)
Interesting, because this is the script that worked for me and that I contributed to Hackspire, with these exact versions.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on August 14, 2011, 02:59:46 pm
Is there any other way to set up the toolchain? Sorry, I'm kind of a Linux noob. :(
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on November 29, 2011, 03:10:44 pm
Revisiting the topic: jimbauwens is experiencing the same problem, while I am still not :(

I could successfully compile:
BINUTILS=binutils-2.22 # http://www.gnu.org/software/binutils/
GCC=gcc-4.6.2 # http://gcc.gnu.org/
NEWLIB=newlib-1.19.0 # http://sourceware.org/newlib/
GDB=gdb-7.3.1 # http://www.gnu.org/software/gdb/
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Jim Bauwens on November 29, 2011, 03:50:25 pm
Alright, got it to work (in Ubuntu 11.04).

I added "--with-system-zlib" to gcc step 1 and 2 because it always failed on the zlib part.
Also, be sure to add $HOME/bin to the PATH :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on November 29, 2011, 05:58:52 pm
I later got it set up without using the script by just installing everything though Synaptic. The problem I was having was that I had gcc-4.5-arm-linux-gnueabi installed, but not gcc-arm-linx-gnueabi, which was needed.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Jim Bauwens on November 30, 2011, 04:06:33 am
Well, I did that at first, but then realized that it wasn't the good gcc :)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on November 30, 2011, 05:33:49 pm
How are the gcc's different?

And btw, did anyone get Eclipse working (debugging Ndless programs) in linux? I can get it running, but it can't debug properly. (The settings are just different for some reason so I don't know what to change)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 21, 2012, 09:53:33 am
scince this isnt that old....
does this work for ndless 3.1?
you know, to set everything up
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Scipi on January 21, 2012, 11:58:43 am
I followed these instructions, which were actually quite simple to do ;)

http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction (http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction)

(666th post) XD
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 21, 2012, 04:17:08 pm
i tried that and now im getting this:
/c/ndless/sdk/bin/nspire-gcc: line 26 : command not found
this is after i type in the nspire-gcc command that they tell you to inorder to test it on hackspire
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Scipi on January 21, 2012, 04:36:09 pm
Hmm. Did you add all the directories to your path and are all the tools you need installed? Also make sure you are using the MSYS cmd thing. ;)
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 21, 2012, 04:41:02 pm
i am using the mysys command thing
the curent path is, starting with yagarto tools in my path:
C:\Program Files (x86)\yagarto-tools-20100703\bin;C:\ndless\sdk\bin
do i need to add more stuff to it??
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Scipi on January 21, 2012, 04:57:20 pm
Just so you know, you should use a path with no spaces in it. I would highly suggest moving the yagarto tools to C:\yagarto-tools-20100703
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 21, 2012, 06:11:20 pm
ok, i moved it and changed the path for it to  its new location on C, but im still getting that same error
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 22, 2012, 03:55:28 pm
/c/ndless/sdk/bin/nspire-gcc: line 26 : command not found
it seems that no matter what i do, i get this error  :banghead:
is it perhapse in the makefile itself??
i must have everything in the path correct because that poped up when i tried to compile the hello sample...
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on January 22, 2012, 07:14:29 pm
If this is in Linux, I had the exact same problem. I had gcc-4.5-arm-linux-gnueabi installed, but not gcc-arm-linx-gnueabi.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 22, 2012, 07:15:10 pm
this is windows 7
and msys
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: sammyMaX on January 22, 2012, 07:16:20 pm
Oh, lol. I don't know what could be the problem then, if you have the PATH set correctly.
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: jwalker on January 22, 2012, 07:17:17 pm
as far as i know it is
EDIT: just fixed it, dont use toxic_kittens link, go to hackspire and get the GNU ARM toolchain
Title: Re: Tutorial - Setting up C Development Environment for the TI-Nspire
Post by: Lionel Debroux on January 23, 2012, 01:15:57 am
Quote
I had gcc-4.5-arm-linux-gnueabi installed, but not gcc-arm-linux-gnueabi.
BTW, using the GNUEABI toolchain packaged by your distro may end up being a bad thing if Nucleus doesn't use GNUEABI, but standard EABI :)