<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1255">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Blackfin inline assembler and VisualDSP++ toolchain</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">></FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">>Actually, you're the first I know using the VisualDSP++ toolchain :-)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">></FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">I guess that's because speex has pretty big memory footprint. </FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">So developers that integrate speex tend to have plenty of RAM and once one has plenty of RAM he could install biggish OS. And between biggish OSes for Blackfin the most popular choice is uCLinux. And ucLinux works best with gnu tools. Something like that.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">On the other hand, developers that use Blakfin in a manner similar to traditional 16-bit DSP usage model, i.e. without external RAM or with relatively small internal SRAM normally use no OS at all (like me) or ADI's VDK. These people naturally prefer ADI toolchain because it gives you good visibility of what's going on within a small "bare metal" target. But such developers a less likely to integrate speex because it simply doesn't fit.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">I guess I am one of the few that try to run speex entirely from internal RAM and the fact already forced me to move from BF531 to BF533.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">BTW, the above exercise in deep philosophy at shallow shores shouldn't be taken too seriously ;)</FONT></P>
<BR>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">>About the inline assembly, I was under the impression that the syntax<BR>
>was compatible. Could you tell me what's the problem? If it's just one<BR>
>bit, you can easily remove the function and things will work as before.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">Just about everything fails. Some things fail during compilation, the rest during final assembling pass. </FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">Thinking about it, the problem is probably not in the asm syntax, but in a way by each the compiler treats the asm keyword.</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">For example, for the following function:</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">-----</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">static inline spx_word16_t MAX16(spx_word16_t a, spx_word16_t b)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">{</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> spx_word32_t res;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> __asm__ (</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> "%1 = %1.L (X);\n\t"</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> "%2 = %2.L (X);\n\t"</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> "%0 = MAX(%1,%2);"</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> : "=d" (res)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> : "%d" (a), "d" (b)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> );</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> return res;</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">}</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">---</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">Compiler says:</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">"libspeex\fixed_bfin.h", line 48: cc1101: error: invalid constraint in asm statement</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> : "%d" (a), "d" (b)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> ^</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">Following modification successfully passed:</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> : "d" (a), "d" (b)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">Similarly, compiler doesn't understand the following line:</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed"> : "=m" (res)</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">It claims that m is not valid constarin. Looking into the manual (including gnu manual) I agree with compiler.</FONT></P>
<BR>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">>Here's some more information about Speex on the Blackfin from David<BR>
>Rowe's blog:<BR>
><U></U></FONT><U><FONT COLOR="#0000FF" SIZE=2 FACE="Miriam Fixed"><<A HREF="http://www.rowetel.com/blog/?p=5">http://www.rowetel.com/blog/?p=5</A>></FONT></U><BR>
<FONT SIZE=2 FACE="Miriam Fixed">></FONT><U><FONT COLOR="#0000FF" SIZE=2 FACE="Miriam Fixed"><<A HREF="http://www.rowetel.com/blog/?p=6">http://www.rowetel.com/blog/?p=6</A>></FONT></U><BR>
<FONT SIZE=2 FACE="Miriam Fixed">><BR>
>BTW, when you say it's slow, can you be more precise? What performance<BR>
>do you expect and what do you get? Using gcc, I think David got it down<BR>
>to ~20 MIPS at 15 kbps, so I assume VisualDSP++ should be able to do<BR>
>better than that.<BR>
><BR>
>Cheers,<BR>
><BR>
> Jean-Marc</FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">></FONT></P>
<P DIR=LTR><FONT SIZE=2 FACE="Miriam Fixed">I talked to David. He got 22 MIPS _with_ inline asm. I am getting around 34 MIPS for exactly the same mode (15kbps, complexity=1, vbr=off) without inline asm. Don't know the scores for gcc, so can't tell whether ADI compiler is better. It's surely not better than your assembler.</FONT></P>
<BR>
<BR>
</BODY>
</HTML>