*LOADing GCC binaries into BASIC
Pages: 1 2
Daryl Dudey (2012) 55 posts |
I spent a bit of my lunchtime working on getting my VFP/NEON code running as a module. I have the makefile updated and it does build, except for one thing. module.o uses FPA, whereas I do not and ld complains. So, how do I get cmunge to work for me? Can I convince ld somehow to ignore it? Edit: I’m going to see if I can bypass the compilation stuff and do that manually myself so I can specify the right flags. |
Daryl Dudey (2012) 55 posts |
Also, I really should get the DDE at some point, it’s not so much a cost thing, as how useful it all is for me… |
Rick Murray (539) 13840 posts |
Gee, more application code running as kernel level code… ;-) |
Daryl Dudey (2012) 55 posts |
In this case, it probably does make sense. I’m writing a library to be used from my own C projects and to be called from BASIC where I will write a wrapper for it. |
Jeffrey Lee (213) 6048 posts |
I think you’ll struggle with that bit. At the moment the only C library that works with module code is the SCL, and that uses FPA. One of the GCC examples is for a module which doesn’t use the SCL, but I don’t think there’s an option in cmunge for generating VFP/NEON stubs. |
Daryl Dudey (2012) 55 posts |
Hi Jeffrey, I have successfully compiled against the SCL with the -mfpu=neon flag. I create an intermediate .s file, before using gcc to convert this to a module.o file and then link against my code. It’s a bit early to say for sure it’s working until I get my module to actually do something. But at least it builds a working module which I can see with *modules. PS. I’ve had the SCL and VFP/NEON running already for a few weeks in a regular application. I know it’s true, because when I look at the intermediate .s files the references to SharedCLibrary are there. I don’t think this is anything that unexpected though as it’s documented… I’ll keep plodding on and see where I end up. |
Daryl Dudey (2012) 55 posts |
Well, I have a block of SWIs allocated, including names for my init and shutdown. When I call them from BASIC nothing happens, but it’s a start…at least they are recognised. |
nemo (145) 2546 posts |
Exactly this approach? Resources:$.Veneers.<modulename>? Great minds and fools.
I hate that. As if I’m RMKilling on a whim. Do as you’re told, code. I’m in charge here. |
Rick Murray (539) 13840 posts |
Yeah, but you’re basically God, aren’t you? :-) It’s dangerous to allow a module with active clients to be killed. We can point at any number of CLib softload mishaps as evidence. I have no problem with the module offering a *command to discard active clients (useful if something crashes and doesn’t unregister itself), which will then permit the module to die, however if the simple act of randomly killing it stands to cause something to crash… |
Rick Murray (539) 13840 posts |
You should make the SWI handler routine at least printf() the SWI number that was called… |
Steve Pampling (1551) 8170 posts |
Oh, Nemo’s well aware of that, but what does it have to do with this thread? :-) |
Steve Drain (222) 1620 posts |
No, I did not say that. I claim a block in RMA and keep the address in a system variable. |
nemo (145) 2546 posts |
If I could persuade the bits to believe I’m their maker I’ll be happy. The rest of you bugs can find your own debugger. Apropos of nothing, I’ve just discovered the hard way that of all the multifarious GBPB directory reads, ResourceFS doesn’t support #11. It does the others. Just not the one that would be most useful on ResourceFS of all FSes.
I want to hate that but I can’t, and it is easier. |
Daryl Dudey (2012) 55 posts |
Mission accomplished for me. I’ve got a module, with the first ~10 SWIs providing fast 2D primitives including rather nice gouraud triangles. All designed for 24bit colour and although not totally optimised yet, are much quicker than using OS_Plot. I also have a single *command which I haven’t finished yet which will give a demo. Thanks for all the help, I’m well on the way now. A gcc compiled module using VFP and callable from BASIC (or anything else). |
Dave Higton (1515) 3526 posts |
Are you confusing nemo with Boris? |
Steve Pampling (1551) 8170 posts |
Oh, now that’s uncalled for. Edit. Re-reading after a delay I can see I ought to have pointed out that anything involving Boris is really an insult so it ought to have a smiley, as should my response to indicate the light-hearted poke. |
David Feugey (2125) 2709 posts |
Great. Will you find some time to package a short example with some explanations? |
Daryl Dudey (2012) 55 posts |
I can do that, although for some reason my VFP stuff was causing me problems last night and I ended up pushing the VFP context stuff into BASIC (which worked). Once I get it working well, I’ll either release the source or do a tutorial. |
David Feugey (2125) 2709 posts |
Thanks Daryl! |
Pages: 1 2