Author Topic: nSDL 1.1.1 Anniversary Edition—The Ultimate TI-Nspire Graphics Library  (Read 140831 times)

0 Members and 1 Guest are viewing this topic.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: SDL for the TI-Nspire
« Reply #30 on: February 11, 2012, 11:34:21 am »
You should switch to GCC 4.6.2, lkj: all "x.y.0" releases of GCC contain quite a few significant bugs :)
(though the last major disaster "x.y.0" release was GCC 4.0.0, i.e. years ago)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline lkj

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +58/-1
    • View Profile
Re: SDL for the TI-Nspire
« Reply #31 on: February 11, 2012, 12:26:51 pm »
I never saw any bug, but I switched as you suggested.
I thought updating would be as complicated as setting up the ndless-SDK, but it was very easy :)

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #32 on: February 11, 2012, 01:20:19 pm »
Could somebody quickly check my code, it doesn't seem to print the value of f. Either I'm using nl_relocdata wrong, or then I'm too tired and am missing something silly.

http://pastebin.com/N2iiUhd1

That's more or less how SDL behaves at one point, and it's reallocating the function pointer that causes issues. The strings print out fine, calling the function doesn't work though.

EDIT: I've tried everything I can think of. Am I really missing something here or is there no way to use nl_relocdata on a pointer to a function? (I doubt it, even in the wiki it is mentioned)
« Last Edit: February 11, 2012, 05:37:37 pm by hoffa »

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: SDL for the TI-Nspire
« Reply #33 on: February 12, 2012, 06:25:10 am »
Things are getting complicated in your case, nl_relocdata was introduced to handle simpel cases, sorry about that.

I unfortunately cannot test them on this computer, but here are a few corrections:

- nl_relocdata((unsigned int *)bootstrap, sizeof(bootstrap) / sizeof(bootstrap[0]));: I'm not sure relocating NULL is a good idea. Use nl_relocdata((unsigned int *)bootstrap, 1); instead.
- nl_relocdata((unsigned int *)bootstrap[0]->fp, sizeof(void *));: Use nl_relocdata((unsigned int *)bootstrap[0]->fp, 1);

But anyway I'm not sure this will fix your error, I'll look further into this as soon as possible.
Ndless.me with the finest TI-Nspire programs

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #34 on: February 12, 2012, 06:56:42 am »
Thanks, but it unfortunately did not fix it. What exactly does size refer to--what size does it refer to (in bytes I presume)? I'll experiment around a bit, but if there is no solution yet I will kindly wait for any future developments.

EDIT:
What do you mean relocating NULL? bootstrap is not NULL, nor is the quotient equal to zero.
« Last Edit: February 12, 2012, 07:01:15 am by hoffa »

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: SDL for the TI-Nspire
« Reply #35 on: February 12, 2012, 07:17:16 am »
But bootstrap contains a NULL value, I'm not sure I'm skipping NULL values.

nl_relocdata relocates an array of pointers (it should work as well on entire structures containing only pointers). The second parameter corresponds to the number of pointers to relocate.
Ndless.me with the finest TI-Nspire programs

Offline alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: SDL for the TI-Nspire
« Reply #36 on: February 12, 2012, 12:02:17 pm »
Hmm... how hard will it be to write a BLFT loader? It seems that this project (and possibly many others) might need one.
It has code relocation and is much smaller than the ELF loader.

(If it isn't too hard, I might attempt to write one :P Seems that one would need to know ARM ASM to do it... which I don't know)
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/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
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! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

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 :P)
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 :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

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 :P)

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: SDL for the TI-Nspire
« Reply #37 on: February 12, 2012, 01:06:14 pm »
Lionel Debroux has just started a port of the Linux implementation, he will post more about it.
Ndless.me with the finest TI-Nspire programs

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: SDL for the TI-Nspire
« Reply #38 on: February 12, 2012, 01:38:30 pm »
I have indeed started looking at what pieces need to be changed for porting Linux's bFLT loader (fs/binfmt_flat.c + include/linux/flat.h + arch/arm/include/asm/flat.h) to non-Linux OS running on the Nspire. And a quick examination (<1h) shows dozens of places that need to be adjusted; it's not necessarily very hard to do so, for the most part, it's just that someone needs to spend time doing it, and I don't have time to undertake such a task alone - for a start, not this evening.

ExtendeD has suggested looking at QEMU's loader (linux-user/flatload.c), which looks slightly more portable than Linux's loader. It remains quite tied to Linux/QEMU internals, and may or may not be a better starting point than Linux's loader: unlike Linux's loader, QEMU's loader's support for compressed binaries and for libraries is explicitly disabled - and we clearly want both, probably with a higher priority on libraries. Support for compressed bFLT binaries wouldn't cost much space in the loader, since we can (well, "ought to be able to") rely on the zlib functions embedded in the OS.

Quote
Seems that one would need to know ARM ASM to do it
I doubt that it's necessary: AFAICT, the bFLT loaders in Linux and QEMU are plain C :)


EDIT: here's the current state of the stuff. As you can see, I haven't changed the code yet, and won't do tonight. The tarball is made of five files:
* binfmt_flat_mod.c is Linux's bFLT loader, annotated with a bunch of TODOs on parts that we need to remove or port;
* binflt_flat.diff is the diff against the pristine file;
* the two headers are include/linux/flat.h and arch/arm/include/asm/flat.h;
* flatload.c is QEMU's bFLT loader.
« Last Edit: February 12, 2012, 02:31:16 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: SDL for the TI-Nspire
« Reply #39 on: February 14, 2012, 03:40:59 pm »
Could somebody quickly check my code, it doesn't seem to print the value of f. Either I'm using nl_relocdata wrong, or then I'm too tired and am missing something silly.

http://pastebin.com/N2iiUhd1

That's more or less how SDL behaves at one point, and it's reallocating the function pointer that causes issues. The strings print out fine, calling the function doesn't work though.

EDIT: I've tried everything I can think of. Am I really missing something here or is there no way to use nl_relocdata on a pointer to a function? (I doubt it, even in the wiki it is mentioned)

Here it is fixed: http://pastebin.com/ELBkWJMt
Ndless.me with the finest TI-Nspire programs

Offline hoffa

  • Project Author
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 322
  • Rating: +131/-13
    • View Profile
Re: SDL for the TI-Nspire
« Reply #40 on: February 15, 2012, 10:50:55 am »
Oh wow, thanks. I'm quite surprised as I tried the same code as you except without the &-operator; I thought prefixing a function name with the ampersand was optional, both should return the address of the said function AFAIK.

EDIT:
This is great news as I'm now able to initialize the barebone video driver:

« Last Edit: February 15, 2012, 05:17:38 pm by hoffa »

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: SDL for the TI-Nspire
« Reply #41 on: February 15, 2012, 12:32:16 pm »
Good :)

Here the address of the field that contains the function pointer is expected, so the & is required.
Ndless.me with the finest TI-Nspire programs

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: SDL for the TI-Nspire
« Reply #42 on: February 15, 2012, 12:48:09 pm »
Good :)

Here the address of the field that contains the function pointer is expected, so the & is required.
Ndless.me with the finest TI-Nspire programs

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: SDL for the TI-Nspire
« Reply #43 on: February 15, 2012, 04:38:25 pm »
Nice to see the progress!

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: SDL for the TI-Nspire
« Reply #44 on: February 15, 2012, 11:48:27 pm »
Good to hear hoffa. Hopefully this gets finished eventually. :D