Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tangrs

Pages: 1 ... 11 12 [13] 14 15 16
181
TI-Nspire / Calling all Linux Kernel developers!
« on: October 02, 2012, 06:10:36 am »
Quick links

Most up to date information: About 95% of the things you need to know about Nspire Linux are available on the Linux page on Hackspire.
Downloads: Nightly builds of just about everything you need can be found on TI-Planet, courtesy of Lionel and Fabian (Vogtinator).
Bug reports: They are very welcome! Don't hesitate to contact myself, Lionel or Fabian or simply post in this thread if you're experiencing kernel panics or just general weirdness and it isn't already documented on Hackspire. We're relying on users to report bugs and strange behavior. However, if you just need general help on how to get things running, you're better off getting help at...
Getting help: If you need any help booting, getting a working rootfs, etc... there is a thread dedicated to this that you can post in. The kind members of the community can help you quickly and efficiently and leave the rest of us time for developing!
Feature requests: We're working as hard as we can making all the hardware available in Linux but if there's a feature or certain behavior that you think could improve Linux (e.g. a better function for an unused key), feel free to post in this thread for discussion.


Original post below:

Hiya!

After finally getting my head around the basics of Linux kernel developing, I've completed a basic, shaky port of Linux to the TI-Nspire CAS CX.

It boots to userland with minimal hardware support (just an interrupt controller, timer and an early boot console on the UART).



(The kernel panic is just Linux complaining about the lack of a root fs but it otherwise boots fine)

Unfortunately, as much as I'd like to work on this alone, I have exams soon so I'll need some helpers.

If anyone wants to help, give me a yell and I'll clean up the code a litte and upload it somewhere.

Blog post

Edit: Kernel and bootloader sources are up!

New bootloader source code (use this)
Old bootloader source code
Linux source code

182
TI-Nspire / Re: Early beta of nspire version string patcher
« on: August 08, 2012, 06:09:39 am »
I've got better and shorter :
Code: [Select]
#include <os.h>
#include "libndls.h"

static unsigned addr_addrs[] = {0x107C1DDC, 0x10801E3C, 0x107A2DC8, 0x107FF0D0};
#define addr ((unsigned *)nl_osvalue((unsigned*)addr_addrs, 4))

int main(int argc, char* argv[]) {
char * lol  = "Whatever you want";
char * lol2 = malloc(sizeof(lol));
strcpy(lol2, lol);
    *(addr) = lol2;
    return 0;
}




el problemo ?


Edit : oh, and by the way, show_msg_usr_input() does not work in the current revision of Ndless because my patch for it didn't yet get pushed to the Ndless svn by ExtendeD.

What pointer are you patching? (Oh and watch your malloc - it'll always allocate 4 bytes :))

Or is this the format string?

183
TI-Nspire / Re: Early beta of nspire version string patcher
« on: August 07, 2012, 08:27:36 am »
Lol, that is awesome XD
By the way, it has been a long time since the last time I saw you. Are you still working on nspiremovieplayer ? :)

Most of the development in nspiremovieplayer is finding a faster way to decode JPEGS. So there is research work going on behind the scenes XD

184
TI-Nspire / Early beta of nspire version string patcher
« on: August 07, 2012, 08:14:31 am »
For a bit of fun, I made a version string patcher for the Nspire.



It's still a WIP requiring polish but it works for now :)

I'll publish binaries soon but the impatient can see how it works by visiting the github repo https://github.com/tangrs/nspire-version-patcher

185
Ndless / Re: Ndless bFLT loader
« on: July 03, 2012, 08:28:16 pm »
I managed to build the toolchain on Windows with MSYS (after a lot of errors and hours). I've also patched Ndless (r632 instead of r573, because I have not found the r573 here) and I successfully make(d) it.

But when I tried to run the "test" (here), the nspire_emu console give me :
Quote from: nspire_emu
bFLT: Begin loading
bFLT: Version number does not match
bFLT: Bad header
bFLT: Caught error - exiting

<EDIT>: The true error message is :
Quote from: nspire_emu
bFLT: Begin loading
bFLT: Magic number does not match
bFLT: Bad header
bFLT: Caught error - exiting
But I tried to change the magic number ("ELF" to "bFLT") of the .tns and I obtained the error message above.
</EDIT>

I don't know what to do, because the test is supposed to work... So if you have an explanation :)

totorigolo
Sorry for my English, I'm French :)

It seems that you're just renaming the ELF file to bFLT format and changing the magic number. That won't work :)

You also need to download the elf2flt program and use that to convert your ELF to a bFLT file. Look in the Makefile of the test program to see an example.

Information on how to set up a proper bFLT toolchain can be found at https://github.com/tangrs/ndless-bflt-toolchain. The toolchain contains scripts that handles all the linking commands for you so you can use it to produce a bFLT straight away.

186
Ndless / Re: Ndless bFLT loader
« on: May 06, 2012, 06:39:39 pm »
Any progress on this?  :)

Been working on it on and off.

I'm trying to work out a efficient system for shared and dynamic libraries. Ater that, I'm also trying to get the C++ standard library and exceptions working.

187
Ndless / Re: General Ndless Questions and Support
« on: April 09, 2012, 04:11:02 am »
No, I was working on my multithreading POC and was wondering if I need to disable interrupts prior to syscalls

188
Ndless / Re: General Ndless Questions and Support
« on: April 09, 2012, 03:10:07 am »
Just a quick question, are Ndless syscalls reentrant?

189
Ndless / Re: Ndless bFLT loader
« on: April 05, 2012, 10:08:47 pm »
I'm hoping to get this bFLT loader integrated into Ndless. Is there anything else that needs to be done for this to happen?

Update:

C++ toolchain is on its way! Very basic support is already working (new and delete works, function overriding works).

Source code is in a different branch at the moment. https://github.com/tangrs/ndless-bflt-loader/tree/c++-support

190
Ndless / Re: Ndless bFLT loader
« on: April 04, 2012, 03:52:05 am »
I think I'm on latest revision (r573 was it?). I think there was a typo in the file name. Let me fix it.

191
Ndless / Re: Ndless bFLT loader
« on: April 04, 2012, 03:31:38 am »
Update: Committed some experimental Ndless patches for bFLT to the repo. The patches integrate bFLT loading directly into Ndless itself.

192
Ndless / Re: Ndless bFLT loader
« on: April 03, 2012, 09:19:37 am »
Update!

Surprise!

Shared library support is now stable!

Now, we need to work out a solution with the library ID problem. How do we allocate 254 IDs to the many people wishing to develop a library? Perhaps reserve IDs 3-10 for Ndless, IDs 10-250 for allocating to projects that are big enough and IDs 250-254 for private use? What do you guys think?

Apart from that, all that the bFLT loader needs now is a little polishing and integration into Ndless :)

(Don't you just love the look of all those "PASS"es? :P)


193
Ndless / Re: Ndless bFLT loader
« on: April 02, 2012, 10:53:58 pm »
Update:

Houston, we have a problem!

I've been working on getting shared libraries working and I've modified the toolchain slightly to produce shared libraries and have them link (almost!) correctly to binaries. I can also grab the address of the function of the shared library at runtime. Basically, the bFLT loader support for shared libraries is done.

But there's a problem. I noticed that the address the binary actually branches to doesn't match the address of the function. Whatever it's branching to, it's also crashing the calculator.

Turns out GCC inserts some code verneers (or bridge, if you like) that is supposed to "glue" the main binary to the shared library. This is bad for us because the address the code verneer directs us to is not relocated.

Here's a nice colorful diagram:



Basically, calling a shared library function looks like this right now:

Code: [Select]
library_call() -> gcc code verneer -> unrelocated address = crash

We want GCC to skip making a code verneer so it looks more like this:

Code: [Select]
library_call() -> library function = win

Theoretically, we could work around this by defining and using a macro like this:

Code: [Select]
#define DIRECT_LIB_CALL(x, args...) do { \
        typeof(x) * volatile tmp = x; \
        tmp(#args); \
    } while (0)

DIRECT_LIB_CALL(library_call);

That should bypass the code veneer but of course, this isn't very elegant nor portable.

All the code is in the shared-library-support branch of the main project.

If anyone can help me look for an option to disable the making of a code veneer (also known as code glue, code bridge etc...) when linking with shared libraries, that would be great.


Never mind, discovered a workaround (although quite annoying)

194
Ndless / Re: Ndless bFLT loader
« on: April 02, 2012, 09:17:05 am »
This is great! :D I was thinking about porting bFLT a while ago, but lacked skills and time to do it. This will definitely advance Nspire development quite a bit! :D

Also, do you think there's a way to change that limit?
Reading this, it says that the limit is "due to the way [he] encoded library addresses...can be changed but it requires quite a bit more effort".

I think the ID system should be changed if possible... it would be kinda weird to start assigning IDs, or having some kind of system manage IDs and such. I think having some kind of Java-style naming system, like "com.alberthrocks.myawesomelibrary", would be better. (And then call this bFLT2, Nspire edition :P) Just my 2 cents. ;)

Again, great work! :D This will open the platform to C++ code, and make porting ten-fold easier! :D

There may be a way to change the ID limit but it requires modifying the linking tools and potentially breaking application support with other bFLT loaders (is this really an issue though?).

Shared libraries are implemented by having the 'ID' of the library in the high byte of the offset record in the relocations.

For example, if a offset record read 0x030000b4, it means "look for and load a library with ID of 3 and replace this offset with (the absolute address of that library image + 0xb4). That means the maximum ID number is 255 and the lowest 0 - giving us a total ID space of 256. The first and last are reserved so that only gives us 254 to work with. When you look at it this way, it becomes difficult to modify it to have more IDs because it's more of a fundamental issue.

You're right, I like the reverse domain notation too but it seems unlikely. I'm sure we can work out something though XD.

@edit: Yep, referring to version 4 XD

195
Ndless / Ndless bFLT loader
« on: April 02, 2012, 01:33:00 am »
This topic will be for technical discussion for the bFLT loader.

Source code and API documentation

Let me start off this discussion.

I propose that, once bFLT becomes stable enough, it be integrated into the core Ndless code and have the SDK updated to only produce bFLT executables. However it seems that if bFLT were to be integrated into Ndless, we'll need to change some parts of the Ndless SDK itself to work in it's favor. I hope we can quickly deprecate the current way of loading binaries.

First, because bFLT stores sections in the order of .text, .data, .bss, we need to update the Ndless ldscript to reflect that. Otherwise, we run into overlapping problems. More information can be found at the bottom of the README. This is the first and easiest step.

Next: Because we do all the relocating, the startup files become redundant - even a hindrance when we deal with shared libraries. The only thing the startup files should do is branch to main since the bFLT loader will handle everything else.


Also, we need some sort of way to work out the assignment of library IDs. bFLT shared libraries work by IDs. Each library is given a unique ID and it is up to the user to ensure it is unique. Unfortunately, the number of IDs are limited and only 254 are actually available for use (255 and 0 are reserved).

I'll leave it at that for now.

@edit: is there a way of implementing _syscallvar_savedlr without relying on a linker script?
@edit2: I'm also having trouble producing a bFLT executable that doesn't rely on nspire-gcc or nspire-ld. Anyone have luck with this?
I'm having trouble writing a ldscript that will force the GOT to be at the beginning of the data section.
Got it.


Update:

The bFLT loader has a working SDK ready for developing and testing! You can now produce bFLT binaries without affecting your normal Ndless SDK!

Pages: 1 ... 11 12 [13] 14 15 16