SPARC-RTEMS5-GCC ignores or don't find libraries

William Busacker wbusacker at
Wed Mar 27 03:29:00 UTC 2019

Good to know that the compiler itself knows a lot of stuff. I always ran into trouble whenever that bsp_specs directory was missing and the way the cross compiler was built made me think it was nothing more than the architecture compiler and all of the extra link stuff was buried inside that directory.

For ARM though, wouldn't there still need to be -mcpu flag because of how varied the architectures are? I could see that being needed for support of the newer ARMs on the RPis. I'd hate to see that be an entirely different BSP

On Mar 26, 2019 18:38, Joel Sherrill <joel at> wrote:

On Tue, Mar 26, 2019 at 7:13 PM William Busacker <wbusacker at<mailto:wbusacker at>> wrote:

Maybe I can help you out.

I personally find the default RTEMS makefile to be overly complicated for simple projects. I get why its made the way it is, but ¯\_(ツ)_/¯

So the xxx-rtems5-gcc compiler doesn't have any knowledge of the actual RTEMS install. As far as I can tell, its just a fancy renamed target compiler. If you're trying to build an RTEMS project on its own, you'll need to tell the compiler where all of the headers and linker objects are at.

It does know a fair number of specifics about building and linking RTEMS applications that you don't see at all. What you see is the arguments to tell the tools where your BSP is and enable it.

I repeat.. a lot is implied by just using an RTEMS GCC. But the BSP is not and that's "really RTEMS".

There is a post 5 clean up activity to eliminate the use of bsp_specs which will drop some of the options. But something has to point to the BSP install. Perhaps that can change to -rtems-bsp= or something. :)

There's also a couple other details you'll need to tell the compiler about. I typically run with Raspberry Pis so for me in my Makefile the compiler command looks like

arm-rtems5-gcc -B/$(RTEMS_INSTALL)/arm-rtems5/raspberrypi/lib -specs bsp_specs -qrtems -mcpu=arm1176jzf-s -o init.o init.c

where $(RTEMS_INSTALL) is a path to where you ran ../rtems-git/configure. My build tree is kinda messed up so I don't know exactly where to point you, but if you manage to find the file "bsp_specs" that will be in the directory you need to target. My guess is that it would look something like sparc-rtems5/erc32/lib

From there you just compile the project like you would a normal C program, just always substituting in sparc-rtems5-gcc for gcc and making sure that something like -B/$(RTEMS_INSTALL)/arm-rtems5/raspberrypi/lib -specs bsp_specs -qrtems -mcpu=arm1176jzf-s is in your compiler and linker flags. I think for you, you would need to change out the arm11.... for erc32, but I'm not sure. I think there's an RTEMS Source Builder program that can tell you what it needs to be. Joel or Chris would know.

My short cut is to look in rtems/bsps/CPU/BSP/config/BSP.cfg so rtems/bsps/sparc/erc32/config/erc32.cfg.

There is an experiment pkgconfig *BSP.pc" installed with the BSP.

But it should be something like:

$(TARGET)-gcc -B$(RTEMS_INSTALL)/$(TARGET)/$(BSP)/lib -specs bsp_specs -qrtems -mcpu=cypress

Where RTEMS_INSTALL is prefix, TARGET is sparc-rtems5 in this case, and BSP is your erc32

The nice thing is that it is orthogonal across architectures. Swap those out and change the BSP specific CPU CFLAGS. And boom... you're done.

And yes.. simplification of that line is a goal and challenge.


Happy RTEMSing!


users mailing list
users at<mailto:users at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list