Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Real-Time Software Components (RTSC) » How to add user library (Linux)
How to add user library (Linux) [message #781057] Fri, 20 January 2012 04:20 Go to next message
Naoki Kawada is currently offline Naoki Kawada
Messages: 10
Registered: January 2012
Location: Tokyo
Junior Member
Hello,

I'm now creating quite brief Linux app (hello world on A8) by using RTSC configuration.

config.bld
var GCArmv7A = xdc.useModule ("gnu.targets.arm.GCArmv7A");

GCArmv7A.rootDir = "/usr/local/CodeSourcery/Sourcery_G++_Lite";
GCArmv7A.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";

GCArmv7A.platforms = [
                    "host.platforms.arm",
                ];
/* Setup default platform */
GCArmv7A.platform = GCArmv7A.platforms[0];
Build.targets = [GCArmv7A];


app.cfg
var System = xdc.useModule ("xdc.runtime.System");


main.c
#include <xdc/std.h>
#include <xdc/runtime/System.h>

Int
main (Int argc, Char ** argv)
{
	System_printf("Hello my linux world\n");
	return 0;
}


var Build = xdc.useModule('xdc.bld.BuildEnvironment');
var Pkg = xdc.useModule('xdc.bld.PackageContents');

var APP_SRCS = ["main.c"];
for each (var targ in Build.targets) {
    Pkg.addExecutable("app", targ, targ.platform).addObjects(APP_SRCS);
}



I have succeeded to create the executable and it works fine with my linux environment on A8.

Now I want to add user space library (like syslink, and some generic ones), but I don know how to add the lib in the above scripts...
Could you please suggest me how to use user space libs with RTSC configuration scripts ?

Best Regards,
Kawada
Re: How to add user library (Linux) [message #781278 is a reply to message #781057] Fri, 20 January 2012 17:18 Go to previous messageGo to next message
Sasha Slijepcevic is currently offline Sasha Slijepcevic
Messages: 86
Registered: July 2009
Member
Kawada,
you can do something similar to what we talked about in an earlier thread. You need a new wrapper package, let's call it wrapPkg, whose only purpose would be to deliver an already built library when needed, just like here.

In package.xs in the wrapper package, you would implement getLibs() that returns some user space library.
Then, your cfg script would load the wrapper package, which would then caused the user space library to be added to the generated linker command file:
var System = xdc.useModule ("xdc.runtime.System");
xdc.loadPackage("wrapPkg");


Now, depending on where and how you want to use the wrapper package, you may need to do some more work. For example, if you don't know the absolute path to the user space library at the time the wrapper package is build, or you want to use it on different systems which do not have the library located in the same place, your wrapper package may need to be more configurable.
You may need to add a module, let's call it Settings, with a parameter 'path', which is then used by the configuration script to specify the library's location. So, on one system, the config script would be:
var System = xdc.useModule ("xdc.runtime.System");
var Settings = xdc.useModule("wrapPkg.Settings");
Settings.path = "/usr/lib";


Your getLibs() function now has to use Settings.path to return the right library:
function getLibs() {
    return (this.Settings.path + "someuser.lib";
}


Notice that you did not have to call xdc.loadPackage() in the second version of the config script. By calling xdc.useModule() you automatically call xdc.loadPackage() on the module's package. Also, 'this' in getLibs refers to the package because getLibs() is a package level function.
Re: How to add user library (Linux) [message #782083 is a reply to message #781278] Mon, 23 January 2012 00:25 Go to previous message
Naoki Kawada is currently offline Naoki Kawada
Messages: 10
Registered: January 2012
Location: Tokyo
Junior Member
Hello Sasha,

It was good to know that. Now I have built my app using pthread and syslink successfully.

Thank you for all your help !

Best Regards,
Kawada
Previous Topic:xdc -j4
Next Topic:Can I try factory on 3.20.xx ?
Goto Forum:
  


Current Time: Sat Jul 26 01:27:24 EDT 2014

Powered by FUDForum. Page generated in 0.03497 seconds