Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
26 May, 2013, 11:01:12 *
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]   Go Down
  Print  
Author Topic: Ndless bFLT loader -  (Read 2244 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Lionel Debroux
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 08:27:24
Date Registered: 17 December, 2009, 09:37:25
Location: France
Posts: 1855

Total Post Ratings: +208

View Profile WWW
« Reply #15 on: 04 April, 2012, 10:14:55 »
0

Ah, OK, false alarm then Smiley
Logged

Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.
tangrs
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Today at 05:38:42
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 189

Topic starter
Total Post Ratings: +86

View Profile WWW
« Reply #16 on: 06 April, 2012, 04:08:47 »
0

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
« Last Edit: 06 April, 2012, 14:36:37 by tangrs » Logged
atiatinini
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 19 November, 2012, 01:04:19
Date Registered: 02 March, 2012, 20:49:13
Location: Portugal
Posts: 19

Total Post Ratings: 0

View Profile
« Reply #17 on: 06 May, 2012, 23:13:37 »
0

Any progress on this?  Smiley
Logged
tangrs
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Today at 05:38:42
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 189

Topic starter
Total Post Ratings: +86

View Profile WWW
« Reply #18 on: 07 May, 2012, 00:39:39 »
0

Any progress on this?  Smiley

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.
Logged
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: --)
*
Offline Offline

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


Total Post Ratings: +2615

View Profile WWW
« Reply #19 on: 07 May, 2012, 00:43:46 »
0

For a second I thought you were replying to your own post somewhere but then I realized you deleted your double post and the above was by someone else.

Hopefully this continues being developed 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
totorigolo
LV2 Member (Next: 40)
**
Offline Offline

Gender: Male
Last Login: 24 May, 2013, 22:23:46
Date Registered: 19 December, 2011, 00:19:11
Location: Bouches-du-Rhône
Posts: 24

Total Post Ratings: +9

View Profile
« Reply #20 on: 28 June, 2012, 22:36:19 »
0

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 Smiley

totorigolo
Sorry for my English, I'm French Smiley
« Last Edit: 28 June, 2012, 23:12:52 by totorigolo » Logged

nRGBlib - A portable graphic library for Nspire !
tangrs
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Today at 05:38:42
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 189

Topic starter
Total Post Ratings: +86

View Profile WWW
« Reply #21 on: 04 July, 2012, 02:28:16 »
0

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 Smiley

totorigolo
Sorry for my English, I'm French Smiley

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

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.
Logged
ajorians
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 24 May, 2013, 21:04:37
Date Registered: 26 February, 2013, 14:50:35
Posts: 31

Total Post Ratings: +15

View Profile
« Reply #22 on: 01 April, 2013, 16:26:47 »
0

Hi,

I am happy to say I got all of the example code working!

But I did run into an issue; and I'll see what I can find out but I figured I'd still post it in case others already seen the same thing.

So with the shared_library_test after I already got everything building and working with no problems I then tried to expand on it.

I wanted to make example_executable a nSDL executable.  So I added another include at the top of main.c:
#include <SDL/SDL.h>

Then somewhere in the main function I added some code to utilize something in nSDL; I added this line:
SDL_Init(SDL_INIT_VIDEO);

The nspire-bflt-ld command was adjusted to have -lSDL and the error I am getting is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ajorians@ajlaptop:~/Downloads/bflt/ndless-bflt-toolchain-master/shared_library_test/example_executable> makenspire-bflt-gcc -Wl,-R,../example_shared_lib/bin/lib3.so.tns.gdb -r -o test.bflt.tns.o
nspire-bflt-gcc -Wall -W -c main.c
main.c: In function ‘main’:
main.c:24:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
main.c:24:26: warning: unused parameter ‘argv’ [-Wunused-parameter]
nspire-bflt-ld test.bflt.tns.o main.o ../example_shared_lib/bin/lib3_wraps.o -o test.bflt.tns -Wl,--wrap,library_call 
/home/ajorians/bin/arm-none-eabi-gcc -Wl,-elf2flt -nostartfiles -T /home/ajorians/Downloads/ndless-v3.1-beta-r695-sdk/ndless/bin/../system/ldscript_bflt -L /home/ajorians/Downloads/ndless-v3.1-beta-r695-sdk/ndless/bin/../lib -static /home/ajorians/Downloads/ndless-v3.1-beta-r695-sdk/ndless/bin/../system/crt0_bflt.o /home/ajorians/Downloads/ndless-v3.1-beta-r695-sdk/ndless/bin/../system/osstub.o test.bflt.tns.o main.o ../example_shared_lib/bin/lib3_wraps.o -o test.bflt.tns -Wl,--wrap,library_call -lSDL -lnspireio -lndls
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
ERROR: reloc type R_ARM_PREL31 unsupported in this context
ERROR: reloc type R_ARM_NONE unsupported in this context
48 bad relocs
collect2: ld returned 1 exit status
make: *** [test.bflt.tns] Error 1

I can change example_executable to be a nRGBLib or nspireio executable but nSDL executable gave the above errors.

I'll keep looking for other ways to do things and I'll let you guys know what I find!  Let me know if you have any ideas or hints! Smiley

Thanks for your time!
Logged
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Online Online

Gender: Male
Last Login: Today at 10:57:43
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 766

Total Post Ratings: +151

View Profile
« Reply #23 on: 01 April, 2013, 22:29:49 »
0

The loader has actually been integrated to Ndless's trunk a while ago but I'm getting the same error when linking to nSDL. Without any solution I can't release the update.
Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
tangrs
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Today at 05:38:42
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 189

Topic starter
Total Post Ratings: +86

View Profile WWW
« Reply #24 on: 02 April, 2013, 00:22:47 »
0

Yes, during development I also got a lot of these errors. Unfortunately, I'm not exactly certain of why these errors occur. I suspect the elf2flt program is too old to handle the new kinds of relocations in gcc. I understand this is a bit of a pain for a lot of people so I'll probably end up either writing a custom program to do the conversions from ELF to bFLT when I have time.

Technically speaking, elf2flt is trying to handle most of the linking which is why it's giving all these errors. In reality, we can tell the linker to do it for us and add the --emit-relocs flag. This creates a section in the ELF file that has a list of relocations that the linker did. All we have to do is search for the R_ARM_ABS32 relocations and somehow add the base address to it at run time.

The program I am thinking of writing will call the linker to link it for us while adding the --emit-relocs flag. It will then dump the text and data section into a bFLT file and search through the list of relocs for R_ARM_ABS32 types and add them to the relocations list in the bFLT file.

Sorry for all this mess. The runtime linker might be working but the toolchain doesn't appear to Sad
« Last Edit: 02 April, 2013, 00:23:20 by tangrs » Logged
ajorians
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 24 May, 2013, 21:04:37
Date Registered: 26 February, 2013, 14:50:35
Posts: 31

Total Post Ratings: +15

View Profile
« Reply #25 on: 02 April, 2013, 02:20:47 »
0

Thank you so much for your replies!  Your answers were very helpful!

Have a great day!
Logged
Pages: 1 [2]   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.266 seconds with 32 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.