Omnimaga
Calculator Community => TI Calculators => Calculator C => Topic started 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:
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:
$ 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:
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:
-
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)
-
Nice that should be useful :D
Thanks apcalc fro posting this :D
-
Excellent :)
This should be stickied. Someday, this sub-forum will have many threads in it, and this tutorial will be hard to find.
-
Stickied
-
Some fixes and improvements to the Ndless demo Makefile were performed after Ndless 1.0, in the public part of the SVN repository.
-
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.
-
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:
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.
-
You should use YAGARTO, it's much more windows-friendly.
-
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:
#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.
-
If I say make, it says no target specified
-
If I say make, it says no target specified
Did you successfully compile the Ndless demo.
In MSYS, type:
cd <Path to Ndless directory>/src/arm/demo
make
Post the message you get.
-
Yes I have
-
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
-
Apcalc, here is my result
-
It works fine for me. :)
Glad to hear you got it working. :)
-
Wait, you have ndless? Are you affected by the power management bug?
Also, is showSimpleDialogBox for the nspire only?
A google search says yes.
-
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
-
I would like to, but I use my TI-84+ Keypad, and for some reason, that is also affected by the bug :/
-
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. :)
-
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)
-
The folder trick helps (putting reset in a folder named a), though with the 84+ keypad, there's not much in terms of software.
-
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 :/
-
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. :)
-
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 :/
-
Tutorial updated for Ndless Version 1.1. :)
-
Glad to hear ^^
-
Thanks apcalc. Everything is correct except the link to Ndless :)
-
Oops. I missed that link. It is fixed now. :) Thanks ExtendeD!
-
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.
-
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.
-
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?
-
The sf link must have changed. I will fix this in a second.
-
Ok, thank you :)
-
Fixed! :)
-
nvmd, I fixed it
my path variable wasnt set
-
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.
-
Like this:
cd /c/ndless-1.7/
-
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.
-
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. :)
-
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?
-
Ndless 2.0 does support OSes from 1.7 to 2.1.
-
Cool to hear :D
-
Can I do this with a 2.0 OS Nspire? Do I need to do anything differently?
-
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! :)
-
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.
-
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 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?
-
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
-
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
-
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/
-
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.
-
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.
-
yes
-
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?
-
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.
-
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!
-
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.
-
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".
-
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.
-
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)
-
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. :)
-
well it's impossible for everything to be possible, because if everything is possible, then it's possible that everything is impossible.
-
Nice paradox PeonHero,
-
I just got this to work on my first try. Funny since I am new to all of these procedures except installing YAGARTO. :thumbsup:
-
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! :)
-
Good to hear. Good luck in your Nspire development. Feel free to ask questions. :D
-
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.
-
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
-
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.
-
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.
-
how do you do this on linux mint 10?
-
I don't know about mint, but http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction describes the setup for Ubuntu.
-
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.
-
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?
-
1) Did the install script for the underlying ARM toolchain run to completion successfully ?
2) Does nspire-gcc have +x (executable) permissions ?
-
[edit] didn't see Lionel's post.
-
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.
-
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" ;)
-
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.
-
Ah, OK :)
Interesting, because this is the script that worked for me and that I contributed to Hackspire, with these exact versions.
-
Is there any other way to set up the toolchain? Sorry, I'm kind of a Linux noob. :(
-
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/
-
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 :)
-
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.
-
Well, I did that at first, but then realized that it wasn't the good gcc :)
-
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)
-
scince this isnt that old....
does this work for ndless 3.1?
you know, to set everything up
-
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
-
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
-
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. ;)
-
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??
-
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
-
ok, i moved it and changed the path for it to its new location on C, but im still getting that same error
-
/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...
-
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.
-
this is windows 7
and msys
-
Oh, lol. I don't know what could be the problem then, if you have the PATH set correctly.
-
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
-
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 :)