开发者

Xilinx Microblaze C and assembly

开发者 https://www.devze.com 2022-12-16 06:11 出处:网络
I have an application written in C for a Xilinx Microblaze core. However, the performance isn\'t quite what I want so I was considering rewriting some of the core functions in assembly. I\'m having tr

I have an application written in C for a Xilinx Microblaze core. However, the performance isn't quite what I want so I was considering rewriting some of the core functions in assembly. I'm having trouble figuring out how to get Xilinx Platform Studio to compile both into a single ELF 开发者_运维百科file though.

How can I do it?


As suggested by Yann, you can use inline assembly. Here is how:

AR# 18561. 11.1 EDK - How do I include inline assembly within my C source files?

Though, try to profile your code to determine where your performance bottleneck is. Xilinx's SDK allows for intrusive profiling. You could also use GPIOs and an oscilloscope (or logic analyser with a fast triggering clock) to profile your functions/code sections yourself.


  1. Check if the compiler implements inline assembly. Try the asm() "function". Check that it supports variable referencing. If your compiler is GCC based, this is easy.
  2. You can always write raw assembler, assemble it, and link it into your application. You need to understand the ABI of your compiler to make compatible functions.


Did you profile where exactly the poor performance comes from? From my experience, core functions are quite fast, so your code is probably the source of the problem. Try compiling with optimization (-O3) or changing the cache size (if you use a cache).


I don't know which Microblaze function you want to rewrite, but you can always go to Xilinx install directory (for example, C:\Xilinx\13.4\ISE_DS\EDK\sw\lib\bsp\standalone_v3_00_a\src\microblaze) to modify functions or even include your own assembly language file in the specific software library.

0

精彩评论

暂无评论...
验证码 换一张
取 消