Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Real-Time Software Components (RTSC) » Referencing libs generated by the closure tool from a non-RTSC CCSv4 project
Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #510289] Wed, 27 January 2010 01:22 Go to next message
Brian Cruickshank is currently offline Brian Cruickshank
Messages: 19
Registered: September 2009
Junior Member
http://rtsc.eclipse.org/docs-tip/Command_-_xdc.tools.closure describes how to use the "closure" tool to generate the files necessary for a non-RTSC application to use RTSC-generated target content without the need to use the XDC tools to build the project.

I've found that this works very well with CCSv4.2 projects, except for a couple of minor problems.

Here are the steps I took:
1. create the closure bundle in folder "c:/bundle":
open a command window in the root directory of the CCSv4 RTSC configuration project
cd C:\MyProjects\MyDemo_configuration

xs xdc.tools.closure -d c:/bundle C:/MyProjects/MyDemo_configuration/whole_program/configPkg

2. create a new CCS project that DOES NOT have any dependencies on RTSC or BIOS, named MyClosureDemo

3. added some source code to MyClosureDemo, using the same #include <company/packagename/ModuleName.h> references as you would from a RTSC project

4. set the project's build settings as follows:

Compile settings:
- Add c:\bundle\compiler.opt in the Command Files: (Read options from specified file)
- Add the c:/bundle folder name to the Include file search path

Linker settings
Add the following to the "Include library file or command file as input" section:
c:\bundle\linker.cmd

The problem is with this linker.cmd file.
The generated linker.cmd file contains the following 2 lines:
"configPkg/package/cfg/log.p64P.obj"
"configPkg/package/cfg/log_p64P_x.xdl"

The linker reports the following errors when building the demo project:
<Linking>
"c:\\bundle\\linker.cmd", line 2: error: cannot find file
"configPkg/package/cfg/log.p64P.obj"
"c:\\bundle\\linker.cmd", line 3: error: cannot find file
"configPkg/package/cfg/log_p64P_x.xdl"

If you edit the linker.cmd file and specify the full path names to the .obj and .xdl files, the linker errors change to the following:
<Linking>
error: cannot find file "ti\targets\rts6000\lib\ti.targets.rts6000.a64P"
error: cannot find file "ti\targets\rts6000\lib\boot.a64P"
... and a bunch of libraries associated with the packages I've created.

If you remove the second line of the linker.cmd file and specify the missing libraries directly in the build settings for the project, everything builds cleanly.

Is there a compile option / flag that I need to configure in the CCSv4.2 build settings to resolve the relative paths used in the linker.cmd file and the .xdl file?

Regards,
Brian
Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #510508 is a reply to message #510289] Wed, 27 January 2010 11:46 Go to previous messageGo to next message
Dave Russo is currently offline Dave Russo
Messages: 172
Registered: July 2009
Senior Member
Did you add the -L option as shown in the makefile in the example
( http://rtsc.eclipse.org/docs-tip/Command_-_xdc.tools.closure #Examples)?

On 1/26/2010 10:22 PM, Brian Cruickshank wrote:
> http://rtsc.eclipse.org/docs-tip/Command_-_xdc.tools.closure describes
> how to use the "closure" tool to generate the files necessary for a
> non-RTSC application to use RTSC-generated target content without the
> need to use the XDC tools to build the project.
> I've found that this works very well with CCSv4.2 projects, except for a
> couple of minor problems.
>
> Here are the steps I took:
> 1. create the closure bundle in folder "c:/bundle":
> open a command window in the root directory of the CCSv4 RTSC
> configuration project
> cd C:\MyProjects\MyDemo_configuration
>
> xs xdc.tools.closure -d c:/bundle
> C:/MyProjects/MyDemo_configuration/whole_program/configPkg
>
> 2. create a new CCS project that DOES NOT have any dependencies on RTSC
> or BIOS, named MyClosureDemo
>
> 3. added some source code to MyClosureDemo, using the same #include
> <company/packagename/ModuleName.h> references as you would from a RTSC
> project
>
> 4. set the project's build settings as follows:
> Compile settings:
> - Add c:\bundle\compiler.opt in the Command Files: (Read options from
> specified file)
> - Add the c:/bundle folder name to the Include file search path
>
> Linker settings
> Add the following to the "Include library file or command file as input"
> section:
> c:\bundle\linker.cmd
>
> The problem is with this linker.cmd file.
> The generated linker.cmd file contains the following 2 lines:
> "configPkg/package/cfg/log.p64P.obj"
> "configPkg/package/cfg/log_p64P_x.xdl"
>
> The linker reports the following errors when building the demo project:
> <Linking>
> "c:\\bundle\\linker.cmd", line 2: error: cannot find file
> "configPkg/package/cfg/log.p64P.obj"
> "c:\\bundle\\linker.cmd", line 3: error: cannot find file
> "configPkg/package/cfg/log_p64P_x.xdl"
>
> If you edit the linker.cmd file and specify the full path names to the
> .obj and .xdl files, the linker errors change to the following:
> <Linking>
> error: cannot find file "ti\targets\rts6000\lib\ti.targets.rts6000.a64P"
> error: cannot find file "ti\targets\rts6000\lib\boot.a64P"
> ... and a bunch of libraries associated with the packages I've created.
> If you remove the second line of the linker.cmd file and specify the
> missing libraries directly in the build settings for the project,
> everything builds cleanly.
>
> Is there a compile option / flag that I need to configure in the CCSv4.2
> build settings to resolve the relative paths used in the linker.cmd file
> and the .xdl file?
>
> Regards,
> Brian
Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #510629 is a reply to message #510289] Thu, 28 January 2010 01:05 Go to previous messageGo to next message
Brian Cruickshank is currently offline Brian Cruickshank
Messages: 19
Registered: September 2009
Junior Member
I get the following error when I add the -L option:
>> WARNING: invalid compiler option --LC:/bundle (ignored)

Here's the linker command line:
"cl6x" -L"C:/bundle" --cmd_file="C:\bundle\compiler.opt" -mv64+ -g -O2 --diag_warning=225 -z --warn_sections -i"ccsv4/tools/compiler/c6000/lib" -i"ccsv4/tools/compiler/c6000/include" --reread_libs -o "MyClosureDemo.out" "./main.obj" "./demoStartup.obj" -l"libc.a" C:/bundle/linker.cmd

Changing the -L to -l doesn't help.
Adding c:/bundle to the library search path doesn't help.

I've tried setting the project-level path to include c:\bundle; as well as setting the Windows path environment variable to include c:\bundle; but this didn't have any effect.

Does the fact that CCSv4 uses "gmake" instead of "make" cause any problems?
Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #510770 is a reply to message #510629] Thu, 28 January 2010 10:20 Go to previous messageGo to next message
Mark Grosen is currently offline Mark Grosen
Messages: 4
Registered: January 2010
Junior Member
Brian,

Dave meant to add the generated closure directory to the library search path, so it should be a -i/path/to/closure after the -z option to cl6x.

That said, it appears there is still a problem. I am not sure if the linker changed or if the closure tool has a bug, but the files specified in linker.cmd are not searched for using the library search path. However, by prefixing those names with a "-l", then it does work. An example cmd line that worked for me (using msp430 compiler, but same should hold for cl6x):

cl430 -q -Ic:/tmp/closure -Ic:/ccs41/ccsv4/tools/compiler/msp430/include -@=c:/tmp/closure/compiler.opt task.c -z -ic:/tmp/closure -ic:/ccs41/ccsv4/tools/compiler/msp430/lib -lc:/tmp/closure/linker.cmd -llibc.a

NOTE: I hand-added the "-l" to the files in linker.cmd to get this to work.

Mark
Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #510900 is a reply to message #510770] Thu, 28 January 2010 23:26 Go to previous messageGo to next message
Brian Cruickshank is currently offline Brian Cruickshank
Messages: 19
Registered: September 2009
Junior Member
Mark,
Adding -l in front of the entries in the linker.cmd file as you advised allows the project to build without errors. Should I file a bug report to track this?

There was one warning generated:
<Linking>
warning: no suitable entry-point found; setting to 0'
Finished building target: MyClosureDemo.out'
' '
Build complete for project MyClosureDemo


Is there anything that I should do to address this?

Thanks again for all of your help!

Regards,
Brian

[Updated on: Thu, 28 January 2010 23:35]

Report message to a moderator

Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #511051 is a reply to message #510900] Fri, 29 January 2010 11:15 Go to previous messageGo to next message
Dave Russo is currently offline Dave Russo
Messages: 172
Registered: July 2009
Senior Member
On 1/28/2010 8:26 PM, Brian Cruickshank wrote:
> Mark,
> I added -l in front of the entries in the linker.cmd file and added the
> bundle directory to the linker's library search path, as you advised,
> and it builds now. Should I file a bug report to track this?
Yes please.

>
> There was one warning generated:
> <Linking>
> warning: no suitable entry-point found; setting to 0'
> Finished building target: UIA_ClosureDemo_M6.out'
> ' '
> Build complete for project MyClosureDemo
>
> Is there anything that I should do to address this?

Did you link in a file defining main()?

Try telling the linker to generate a map file (-m test.map). This file
contains a gold mine of information that usually enables one to identify
the root causes of linker errors/warnings.

>
> Thanks again for all of your help!
>
> Regards,
> Brian
>
>
Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #511123 is a reply to message #510289] Fri, 29 January 2010 21:02 Go to previous messageGo to next message
Sasha Slijepcevic is currently offline Sasha Slijepcevic
Messages: 86
Registered: July 2009
Member
I updated http://rtsc.eclipse.org/docs-tip/Command_-_xdc.tools.closure to account for differences between the library path option for gcc and for TI compilers.
I also fixed the bug in the closure tool, so now all files referenced from within linker command files are preceeded with "-l".

Brian, I am still testing it, but if you want the new version of the xdc.tools.closure before 3.20 is out, please let me know and I'll send it to you.
Re: Referencing libs generated by the closure tool from a non-RTSC CCSv4 project [message #512640 is a reply to message #511123] Fri, 05 February 2010 12:58 Go to previous message
Brian Cruickshank is currently offline Brian Cruickshank
Messages: 19
Registered: September 2009
Junior Member
Thanks Sasha

Dave,
I've filed bugzilla bug 301988 to track this.

I found that the "no suitable entry-point" warning was resolved by configuring the C6000 Linker's Runtime Environment "Initialization model" setting to "Link using ROM autoinitialization model (--rom_model, c)

Thanks for everyone's help on this!

Regards,
Brian

Previous Topic:Steps required for definition of non-cacheable section
Next Topic:Code placement using RTSC
Goto Forum:
  


Current Time: Mon Jul 28 02:31:41 EDT 2014

Powered by FUDForum. Page generated in 0.02072 seconds