Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
19 June, 2013, 20:11:27 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2] 3 4 ... 23   Go Down
  Print  
Author Topic: nSDL 1.1.1 Anniversary Edition—The Ultimate TI-Nspire Graphics Library! -  (Read 16025 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Online Online

Gender: Male
Last Login: Today at 20:09:39
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50639


Total Post Ratings: +2640

View Profile WWW
« Reply #15 on: 10 February, 2012, 10:18:04 »
0

This is good to hear Hoffa Smiley
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
ruler501
Crazy Freshman
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 07:29:20
Date Registered: 08 November, 2010, 02:32:33
Location: In a cave with two spots of light and lots of meat
Posts: 2391


Total Post Ratings: +49

View Profile
« Reply #16 on: 10 February, 2012, 14:36:17 »
0

Great job hoffa I can't wait to see what comes of this. I'll also have to move my one simple SDL program over to the nspire. How much code change is needed to go from a program written in C++ for a computer to working with the calc?
Logged


Spoiler for "Projects":
My current games I am working on our:
  I might have an improved C version of this somewhere...
pSDL too lazy too make a userbar so I'll just link to the topic i update routinely http://www.omnimaga.org/index.php?board=146.0
Spoiler for "Misc images of test things":
NerdTests.com says I'm a Dorky Nerd God.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!My computer geek score is greater than 100% of all people in the world! How do you compare? Click here to find out!"<br />[url=http://www.nerdtests.com/ft_personality.php?ref=42769
[/url]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

------END GEEK CODE BLOCK------
"KnifeOn!  Apply directly to the forehead!  KnifeOn is available without a prescription at retailers nationwide."
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 19:21:20
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1736


Total Post Ratings: +180

View Profile WWW
« Reply #17 on: 10 February, 2012, 14:52:48 »
0

Well, Ndless is focusing on C, but you can get a C++ compiler to work: http://blog.tangrs.id.au/?p=712 .
If the program only uses SDL libraries and hoffa finished this one, it should compile fine without any changes. (I think)
Logged

ruler501
Crazy Freshman
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 07:29:20
Date Registered: 08 November, 2010, 02:32:33
Location: In a cave with two spots of light and lots of meat
Posts: 2391


Total Post Ratings: +49

View Profile
« Reply #18 on: 10 February, 2012, 15:16:12 »
0

thanks jimbauwens I forgot that ndless was mainly for C Tongue
And I actually will still need to know if this will work on a regular nspire. I dont have a CX Sad
Logged


Spoiler for "Projects":
My current games I am working on our:
  I might have an improved C version of this somewhere...
pSDL too lazy too make a userbar so I'll just link to the topic i update routinely http://www.omnimaga.org/index.php?board=146.0
Spoiler for "Misc images of test things":
NerdTests.com says I'm a Dorky Nerd God.  Click here to take the Nerd Test, get geeky images and jokes, and talk to others on the nerd forum!My computer geek score is greater than 100% of all people in the world! How do you compare? Click here to find out!"<br />[url=http://www.nerdtests.com/ft_personality.php?ref=42769
[/url]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

------END GEEK CODE BLOCK------
"KnifeOn!  Apply directly to the forehead!  KnifeOn is available without a prescription at retailers nationwide."
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 19:21:20
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1736


Total Post Ratings: +180

View Profile WWW
« Reply #19 on: 10 February, 2012, 16:10:51 »
0

It should work on any Nspire, if hoffa does it correctly (and I don't doubt that) Smiley
Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 15:14:09
Date Registered: 28 May, 2011, 20:26:32
Posts: 303


Topic starter
Total Post Ratings: +116

View Profile
« Reply #20 on: 11 February, 2012, 15:04:18 »
0

I think I've finally--after many smashed walls, headaches and a bucket of aspirin--narrowed down one major issue.

Have this piece of code for instance:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <os.h>

typedef struct type1_t {
    const char *s;
} type1_t;

typedef struct type2_t {
    const char *s1;
    const char *s2;
} type2_t;

int main(void) {
    type1_t test1 = {"foobar"};
    type2_t test2 = {"foo", "bar"};
    printf("test1.s: %s\n", test1.s); /* Prints "foobar" */
    printf("test2.s1: %s\n", test2.s1); /* Should print "foo"; doesn't */
    printf("test2.s2: %s\n", test2.s2); /* Should print "bar"; doesn't */
    return 0;
}

As you can read, the output is:
test1.s: foobar
test2.s1:
test2.s2:

Which is completely wrong. Here's what the output obviously should be: http://codepad.org/DQcGIFy3

I think this might be one of those ARM struct alignment issues, or possibly some other bug. Either way, it has kept me from advancing with the port.
Any input on this one, ExtendeD? (or others, if you know what might be causing the problem)
« Last Edit: 11 February, 2012, 15:14:14 by hoffa » Logged
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:59:35
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 773

Total Post Ratings: +152

View Profile
« Reply #21 on: 11 February, 2012, 16:47:03 »
0

Well on my side it outputs:


1
2
3
test1.s: foobar
test2.s1: foo
test2.s2: bar

Which version of GCC are you using? On which OS?
Can you also post the content of the .s file generated with nspire-gcc -S <your.c>?
« Last Edit: 11 February, 2012, 16:52:06 by ExtendeD » Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 15:14:09
Date Registered: 28 May, 2011, 20:26:32
Posts: 303


Topic starter
Total Post Ratings: +116

View Profile
« Reply #22 on: 11 February, 2012, 17:01:20 »
0

This is very weird, not the first time only I have the issues.

Here's the assembly code: http://pastebin.com/2Giv2ScW

I also attached a TNS that doesn't print the values.

EDIT:
Windows 7 x64 and Yagarto that uses the following versions:
binutils: 2.21
gcc:      4.6.2
newlib:   1.19.0
gdb:      7.3.1

* struct_test.tns (1.07 KB - downloaded 14 times.)
« Last Edit: 11 February, 2012, 17:03:52 by hoffa » Logged
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:59:35
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 773

Total Post Ratings: +152

View Profile
« Reply #23 on: 11 February, 2012, 17:38:07 »
0

My .s is identical. Strangely using nspire-as on the .s file reproduces the error on my side.
I see:
.LC2:
   .word   .LC0
   .word   .LC1
Which is not good, GCC doesn't make it relocatable by Ndless.

I'm afraid you will have to use something like this:


1
2
3
4
5
6
7
8
9
10
int main(void) {
    type1_t test1 = {"foobar"};
    type2_t test2 = {"foo", "bar"};
    nl_relocdata((unsigned*)&test2.s1, 1);
    nl_relocdata((unsigned*)&test2.s2, 1);
    printf("test1.s: %s\n", test1.s); /* Prints "foobar" */
    printf("test2.s1: %s\n", test2.s1); /* Should print "foo"; doesn't */
    printf("test2.s2: %s\n", test2.s2); /* Should print "bar"; doesn't */
    return 0;
}

See http://hackspire.unsads.com/wiki/index.php/Ndless_features_and_limitations#Global_variables_and_initialization .

How much is this a problem in your case?
If it is too annoying I will then  have to integrate tangrs's ELF loader with its drawbacks.
Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 15:14:09
Date Registered: 28 May, 2011, 20:26:32
Posts: 303


Topic starter
Total Post Ratings: +116

View Profile
« Reply #24 on: 11 February, 2012, 17:57:24 »
0

I see. But how come then that you were able to see the strings?

It does work now, but I'm afraid it will make the porting process a rather "hacky" and dirty one, with #if directives everywhere (breaking the clean code and flexibility) as SDL does rely quite a lot on structs. The code is not that simple in SDL as in the example, so the result might be spaghetti code. For now I'll try to see how it goes with nl_relocdata, if the code becomes an ugly mess I'll tell you. Thanks anyway for pointing out that fix, it'll be useful.

What are the drawbacks of using the ELF loader?
Logged
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Today at 07:59:35
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 773

Total Post Ratings: +152

View Profile
« Reply #25 on: 11 February, 2012, 18:01:18 »
0

According to tangrs the program size seems rather random, sometimes very big.
And this would require maintaining a much more complex program loader than the current one.
Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
alberthrocks
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Last Login: 11 June, 2013, 19:34:32
Date Registered: 01 May, 2010, 16:51:27
Posts: 743

Total Post Ratings: +88

View Profile
« Reply #26 on: 11 February, 2012, 18:03:58 »
0

BLFT is also another possible option, if that may help with making SDL port work.
Logged

Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! Sad Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. Smiley

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler for "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it Tongue)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it Tongue)
wxWabbitemu: 40% done (NEED MOAR FEATURES Tongue)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming Tongue)
Lionel Debroux
LV10 31337 u53r (Next: 2000)
**********
Online Online

Gender: Male
Last Login: Today at 19:56:02
Date Registered: 17 December, 2009, 09:37:25
Location: France
Posts: 1916

Total Post Ratings: +215

View Profile WWW
« Reply #27 on: 11 February, 2012, 18:04:07 »
0

ELF is a very complicated format, so an ELF loader is a complicated piece of software Sad

bFLT ( http://www.uclinux.org/bFLT/ , http://retired.beyondlogic.org/uClinux/bflt.htm ) is much simpler a format, which was suggested a number of times since the introduction of Ndless 1.0 nearly two years ago.
I once opened the source code of Linux kernel's bFLT loader ( https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=fs/binfmt_flat.c;hb=HEAD ). It needs some porting to work outside the Linux kernel environment Smiley

EDIT: heh, I see alberthro beat me by mere seconds to mentioning bFLT Cheesy
EDIT2: added a note.
EDIT3: added link to Linux's bFLT loader.
« Last Edit: 11 February, 2012, 18:17:19 by Lionel Debroux » Logged

Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 15:14:09
Date Registered: 28 May, 2011, 20:26:32
Posts: 303


Topic starter
Total Post Ratings: +116

View Profile
« Reply #28 on: 11 February, 2012, 18:08:35 »
0

I will rely on nl_relocdata as long as possible then; the advantages of keeping the ELF loader away outweigh the advantages of integrating it. But we'll see how it turns out after a few lines of code.
Logged
lkj
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 15:09:04
Date Registered: 07 September, 2011, 20:05:25
Posts: 362

Total Post Ratings: +40

View Profile
« Reply #29 on: 11 February, 2012, 18:26:31 »
0

EDIT:
Windows 7 x64 and Yagarto that uses the following versions:
binutils: 2.21
gcc:      4.6.2
newlib:   1.19.0
gdb:      7.3.1

For me the program works, also windows7 x64, but yagarto with gcc 4.6.0 and gdb 7.2.
Logged

My Nspire Ndless C projects:
Pages: 1 [2] 3 4 ... 23   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.343 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.