RISC OS Open
Safeguarding the past, present and future of RISC OS for everyone
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → Community Support →

*LOADing GCC binaries into BASIC

Subscribe to *LOADing GCC binaries into BASIC 44 posts, 10 voices

Posts per page:

Pages: 1 2

 
Sep 9, 2019 12:43pm
Avatar 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.

 
Sep 9, 2019 12:44pm
Avatar 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…

 
Sep 9, 2019 12:57pm
Avatar Rick Murray (539) 12210 posts

write your module with the routines as SWIs

Gee, more application code running as kernel level code… ;-)

 
Sep 9, 2019 12:59pm
Avatar Daryl Dudey (2012) 55 posts

Gee, more application code running as kernel level code… ;-)

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.

 
Sep 9, 2019 1:04pm
Avatar Jeffrey Lee (213) 6017 posts

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?

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.

 
Sep 9, 2019 1:30pm
Avatar 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.

 
Sep 9, 2019 2:03pm
Avatar 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.

 
Sep 9, 2019 2:09pm
Avatar nemo (145) 2201 posts

Yes, of course. Basalt does that for its link.

Exactly this approach? Resources:$.Veneers.<modulename>? Great minds and fools.

An alternative might be to count users and refuse to die

I hate that. As if I’m RMKilling on a whim. Do as you’re told, code. I’m in charge here.

 
Sep 9, 2019 4:18pm
Avatar Rick Murray (539) 12210 posts

I hate that. As if I’m RMKilling on a whim. Do as you’re told, code. I’m in charge here.

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…
…training wheels and nappies are sometimes useful.

 
Sep 9, 2019 4:20pm
Avatar Rick Murray (539) 12210 posts

When I call them from BASIC nothing happens, but it’s a start…

You should make the SWI handler routine at least printf() the SWI number that was called…

 
Sep 9, 2019 6:06pm
Avatar Steve Pampling (1551) 7334 posts

Yeah, but you’re basically God, aren’t you? :-)

Oh, Nemo’s well aware of that, but what does it have to do with this thread? :-)
BTW. I think the “basically” may be superfluous.

 
Sep 9, 2019 6:08pm
Avatar Steve Drain (222) 1620 posts

Exactly this approach? Resources:$.Veneers.?

No, I did not say that. I claim a block in RMA and keep the address in a system variable.

 
Sep 9, 2019 6:44pm
Avatar nemo (145) 2201 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.

keep the address in a system variable

I want to hate that but I can’t, and it is easier.

 
Sep 9, 2019 7:23pm
Avatar 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).

 
Sep 9, 2019 9:23pm
Avatar Dave Higton (1515) 3046 posts

Yeah, but you’re basically God, aren’t you? :-)

Are you confusing nemo with Boris?

 
Sep 9, 2019 9:56pm
Avatar Steve Pampling (1551) 7334 posts

Are you confusing nemo with Boris?

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.

 
Sep 10, 2019 8:23am
Avatar David Feugey (2125) 2626 posts

A gcc compiled module using VFP and callable from BASIC (or anything else).

Great. Will you find some time to package a short example with some explanations?

 
Sep 11, 2019 7:39am
Avatar Daryl Dudey (2012) 55 posts

Great. Will you find some time to package a short example with some explanations?

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.

 
Sep 11, 2019 11:11am
Avatar David Feugey (2125) 2626 posts

Thanks Daryl!

Pages: 1 2

Reply

To post replies, please first log in.

Forums → Community Support →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

Community-provided support for all users of RISC OS.

Voices

  • Daryl Dudey (2012)
  • Rick Murray (539)
  • Jeffrey Lee (213)
  • nemo (145)
  • Steve Pampling (1551)
  • Steve Drain (222)
  • Dave Higton (1515)
  • David Feugey (2125)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys