DSPRelated.com
Forums

Re: Digest Number 2091

Started by Andrew Nesterov October 26, 2007
Hi Dorian,

Nay, I doubt that I deserve any kisses... More probably a shot or two
of Bowmore Darkest :)

The alloca() is not implemented in the RTS, you might want to use either
malloc() as in below

#define x264_alloca(x) (void*)(((intptr_t)malloc((x)+15)+15)&~15)

or memalign(). See spru187n.pdf on the p.241.

Both calls allocate a block on the heap, not on the local stack as the
alloca() does (http://www.mkssoftware.com/docs/man3/alloca.3.asp), which
implies that the allocated segment is not automatically released, it needs
to be explisitly deallocated with the free() call, and that might lead to
heap fragmentation problems.

If you are going to use BIOS, look at the page 180 of spru187n,
sect 8.5.6.3 for the comments.

Rgds,

Andrew

> Subject:Re: Link problems with Runtime Support Arithmetic Functions (RTS)
> Posted by: ".dorian" d...@redcodes.net dorian_schneider
> Date: Thu Oct 25, 2007 7:10 am ((PDT))
>
> Hey Andrew !
>
> you can't believe how much you helped me.. *big kiss* !
>
> I worked with CCS v.2.2 before and installed v3.1 because it supports the
> "long long" data type.
> I checked the readme file as you suggested and realized that it's still the
> CSS 2.2 readme.txt.
> It seems that the 3.1 installation didn't replace the lib files
> (rst6400.lib, sorry rts6000 was a typo if mine).
>
> Anyway, I tried to run the project on my notebook where only CSS 3.1 has
> been
> installed - and guess what ? The same project links completely - without any
> changes
> on the project configuration.
>
> Wow, I spent 3 days on these link errors....thanks a lot for your hints !
>
> There is one link error left:
> "undefined symbol _allocate", and I think its caused by that macro line:
>
> #define x264_alloca(x) (void*)(((intptr_t) alloca((x)+15)+15)&~15)
>
> What is the best way to rewrite alloca((x)+15)+15)&~15) for the CSS compiler?
>
> With regards !
> Dorian
>
> --- In c..., "Andrew Nesterov" wrote:
>>
>> Hi Dorian,
>>
>> These are int64 math and conversion functions and yes they are
>> in the RTS lib. Are you certain that you've specified an RTS
>> file in the executable project? There is no rts6000.lib library
>> in the lib folder! What is the version number of the code gen
>> tools you use, take a look at the
>> "CCSroot\C6000\cgtools\readme.1st or readme_cgt.txt" file.
>> It might be stored one level up, however, in the C6000 dir,
>> so do not be surprised :)
>>
>> You seem to use a C64 core in the little endian mode, so the
>> best match is "CCSroot\C6000\cgtools\lib\rts6400.lib"
>>
>> You may want to create a temp dir, copy there the rts.src archive,
>> unpack it by an "ar6x x rts.src" in the command line and look at
>> the extracted files
>>
>> imath64.c for _divlli(), _divull()
>> mpyll.c for _mpyll()
>> fltllif.c for _fltllif()
>> fltllid.c for _fltllid()
>>
>> There are more _???ll() functions defined elsewhere, but the whole
>> bunch is archived into all the rts libraries.
>>
>> Hope this helps,
>>
>> Andrew
>>
>> --- In c..., "dorian_schneider" wrote:
>>>
>>> hey guys,
>>>
>>> my h.264 encoder consists of a main library project and a executable
>>> project that uses the library. For the library I didn't include any
>>> further libraries. For the executable project I included the
>>> rts6000.lib file.
>>>
>>> I am working with CCS 3.1 and a DM642 board.
>>>
>>> When I build the executable project (library has already been build) I
>>> get the following link errors:
>>>
>>> ------------------
>>> undefined first referenced
>>> symbol in file
>>>
>>> __divlli ./libx264enc.lib
>>> __mpyll ./libx264enc.lib
>>> __fltllid ./libx264enc.lib
>>> __fltllif ./libx264enc.lib
>>> __divull ./libx264enc.lib
>>>
>>> ------------------
>>>
>>> I searched a little and found in the "TMS320C6000 Optimizing Compiler"
>>> manual (section 8.7) that these functions are supposed to be defined
>>> in the rts.src (../ti/6400/cgtools/lib) file - but most of them are
>>> not. They have similar, but different names in the file. In the manual
>>> they have the same names as indicated by the error message.
>>>
>>> Does somebody know what I am supposed to do in order to solve these
>>> linking errors ?
>>>
>>> thank you =)
>>>
>>> dorian
>>>
>