|
|
tangrs
LV4 Regular (Next: 200)
  
Offline
Gender: 
Last Login: Today at 04:56:05
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 188
Topic starter
Total Post Ratings: +84
|
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
Gender: 
Last Login: 19 November, 2012, 01:04:19
Date Registered: 02 March, 2012, 20:49:13
Location: Portugal
Posts: 19
Total Post Ratings: 0
|
Any progress on this? 
|
|
|
|
|
Logged
|
|
|
|
tangrs
LV4 Regular (Next: 200)
  
Offline
Gender: 
Last Login: Today at 04:56:05
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 188
Topic starter
Total Post Ratings: +84
|
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.
|
|
|
|
|
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
Gender: 
Last Login: Today at 04:23:20
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50233
Total Post Ratings: +2615
|
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 
|
|
|
|
|
Logged
|
|
|
|
totorigolo
LV2 Member (Next: 40)

Offline
Gender: 
Last Login: Yesterday at 22:23:46
Date Registered: 19 December, 2011, 00:19:11
Location: Bouches-du-Rhône
Posts: 24
Total Post Ratings: +9
|
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 : bFLT: Begin loading bFLT: Version number does not match bFLT: Bad header bFLT: Caught error - exiting <EDIT>: The true error message is : 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 
|
|
|
|
« Last Edit: 28 June, 2012, 23:12:52 by totorigolo »
|
Logged
|
nRGBlib - A portable graphic library for Nspire !
|
|
|
tangrs
LV4 Regular (Next: 200)
  
Offline
Gender: 
Last Login: Today at 04:56:05
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 188
Topic starter
Total Post Ratings: +84
|
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 : bFLT: Begin loading bFLT: Version number does not match bFLT: Bad header bFLT: Caught error - exiting <EDIT>: The true error message is : 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.
|
|
|
|
|
Logged
|
|
|
|
ajorians
LV2 Member (Next: 40)

Offline
Last Login: Yesterday at 21:04:37
Date Registered: 26 February, 2013, 14:50:35
Posts: 31
Total Post Ratings: +15
|
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!  Thanks for your time!
|
|
|
|
|
Logged
|
|
|
|
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
Offline
Gender: 
Last Login: Yesterday at 10:41:30
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 766
Total Post Ratings: +151
|
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
|
|
|
|
tangrs
LV4 Regular (Next: 200)
  
Offline
Gender: 
Last Login: Today at 04:56:05
Date Registered: 13 July, 2011, 04:32:25
Location: Australia
Posts: 188
Topic starter
Total Post Ratings: +84
|
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 
|
|
|
|
« Last Edit: 02 April, 2013, 00:23:20 by tangrs »
|
Logged
|
|
|
|
ajorians
LV2 Member (Next: 40)

Offline
Last Login: Yesterday at 21:04:37
Date Registered: 26 February, 2013, 14:50:35
Posts: 31
Total Post Ratings: +15
|
Thank you so much for your replies! Your answers were very helpful!
Have a great day!
|
|
|
|
|
Logged
|
|
|
|
|