Michael Shatz
2007-Jun-13 16:27 UTC
[Speex-dev] Blackfin inline assembler and VisualDSP++ toolchain
Hi Jean-Marc I'm trying to integrate your speex codec on our custom Blackfin board. The board is not uCLinux compatible and there is no chance that it will ever be. I am using ADI-supplied VisualDSP++ IDE and corresponding toolchain. As long as I am compiling "C"-only version of the library everything is fine. VisualDSP++ produces working library. There is only one not so minor problem - the library is slow. However when I'm trying to compiler with inline assembler the compilation fails. It looks like ADI Blackfin assembler is not compatible with gas. Supposedly you are aware of the problem since amongst Blackfin developers VisualDSP++ toolchain is the most popular by far. Actually I know noone who use gnu toolchain. Could you suggest a solution for my problem? Best Regards, Michael Shatz -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20070613/3a51f0ae/attachment.html
Jean-Marc Valin
2007-Jun-13 16:41 UTC
[Speex-dev] Blackfin inline assembler and VisualDSP++ toolchain
Michael Shatz a ?crit :> Hi Jean-Marc > > I'm trying to integrate your speex codec on our custom Blackfin > board. The board is not uCLinux compatible and there is no chance > that it will ever be. I am using ADI-supplied VisualDSP++ IDE and > corresponding toolchain. As long as I am compiling "C"-only version > of the library everything is fine. VisualDSP++ produces working > library. There is only one not so minor problem - the library is > slow. However when I'm trying to compiler with inline assembler the > compilation fails. It looks like ADI Blackfin assembler is not > compatible with gas. Supposedly you are aware of the problem since > amongst Blackfin developers VisualDSP++ toolchain is the most popular > by far. Actually I know noone who use gnu toolchain.Actually, you're the first I know using the VisualDSP++ toolchain :-) About the inline assembly, I was under the impression that the syntax was compatible. Could you tell me what's the problem? If it's just one bit, you can easily remove the function and things will work as before. Here's some more information about Speex on the Blackfin from David Rowe's blog: http://www.rowetel.com/blog/?p=5 http://www.rowetel.com/blog/?p=6 BTW, when you say it's slow, can you be more precise? What performance do you expect and what do you get? Using gcc, I think David got it down to ~20 MIPS at 15 kbps, so I assume VisualDSP++ should be able to do better than that. Cheers, Jean-Marc
Robin Getz
2007-Jun-15 15:08 UTC
[Speex-dev] Blackfin inline assembler and VisualDSP++ toolchain
On Wed 13 Jun 2007 12:37, Michael Shatz pondered:> > Hi Jean-Marc > > I'm trying to integrate your speex codec on our custom Blackfin board. The > board is not uCLinux compatible and there is no chance that it will ever be.I never met any hardware that gcc could not run code on. toolchains have nothing do with embedded OSes.> I am using ADI-supplied VisualDSP++ IDE and corresponding toolchain. As long > as I am compiling "C"-only version of the library everything is fine. > VisualDSP++ produces working library. There is only one not so minor > problem - the library is slow. However when I'm trying to compiler with > inline assembler the compilation fails. It looks like ADI Blackfin assembler > is not compatible with gas.There are a few things: - gcc/gas can do some things that VDSP is not capable of - the syntax is different for inline assembly (constraints are different). - assembler directives are different - compiler pragmas are different - gcc supports an additional ABI. There are more details at: http://docs.blackfin.uclinux.org/doku.php?id=port_assembly_source_code_from_vdsp_to_uclinux http://docs.blackfin.uclinux.org/doku.php?id=port_c_c_source_code_from_vdsp_to_uclinux (Those are bad page names - it should be _to_gcc). I will update them on the weekend.> Supposedly you are aware of the problem since amongst Blackfin developers > VisualDSP++ toolchain is the most popular by far.Actually - I don't think this is true at all. There have been more people who have downloaded the full blown, free version of gcc, than the crippled, time limited version of VDSP.> 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.Again - gross overstatements. I know people who are using speex without using any OS - using gcc. I don't know if they were using external ram or not...> On the other hand, developers that use Blackfin 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.Then you just have not used gcc with eclipse or insight, and an in circuit emulator. It provides an interface that is as good as the ADI toolchain (IMHO) - and I have used both. People use uCOS with gcc as well - gcc is not limited to Linux or other applications, people use it for everything.> Actually I know noone who use gnu toolchain.Then you just don't hang around with the right people. :) I will be the first to say that the GNU toolchain is not for everyone and there are still a few things that are easier to do with a vendor or commercially supplied toolchain - and for some specific algorithms - they may generates better code - but we have narrowed this down to fewer and fewer things by improving gcc - and we continue to do so. If you have tried it, and think it sucks - that is OK too - just tell us how to improve it. http://blackfin.uclinux.org/gf/project/toolchain/forum/?action=ForumBrowse&forum_id=44> Could you suggest a solution for my problem?Oh, yeah - I guess you actually had a problem - and were not just looking to debate compiler selection. ;)> : "=m" (res) > > It claims that m is not valid constraint Looking into the manual (including > gnu manual) I agree with compiler.Your looking in the wrong place. Have a look at: http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Machine-Constraints.html#Machine-Constraints scroll down to Blackfin. look for m - and it is not there (just like it should not be). Therefore it must be a constraint valid for any architecture, which are defined: http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Simple-Constraints.html#Simple-Constraints `m' A memory operand is allowed, with any kind of address that the machine supports in general.> "libspeex\fixed_bfin.h", line 48: cc1101: error: invalid constraint in asm > statement > > : "%d" (a), "d" (b) > > ^Have a look at: http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Modifiers.html#Modifiers `%' Declares the instruction to be commutative for this operand and the following operand. This means that the compiler may interchange the two operands if that is the cheapest way to make all operands fit the constraints. GCC can only handle one commutative pair in an asm; if you use more, the compiler may fail. Those links should get you started - if you have further issues - the best bet would be to ask on the Blackfin gcc forums - as this has little to do with speex. http://blackfin.uclinux.org/gf/project/toolchain/forum/?action=ForumBrowse&forum_id=44 -Robin