1457 views|0 replies

1140

Posts

0

Resources
The OP
 

Things to note when writing programs based on TMS320 series DSP using C/C++ [Copy link]

1. Without affecting the execution speed, you can use the function library provided by C or C/C++ language, or you can design your own function, which is easier to use the "tailor" optimization process. For example, to perform absolute value calculations, you can call fabs() or abs() functions, or use if...else... judgment statements instead. 2. Be very cautious when using local variables. According to the needs of your own project development, you should use global variables and static variables as much as possible. 3. You must pay great attention to the interrupt vector table. Many friends are not clear about the calling method of the interrupt vector table. In fact, the interrupt name in the interrupt vector table is arbitrarily determined. DSP does not recognize the name, it only recognizes the address! ! The interrupt vector table needs to be relocated. This is very important. 4. To be clear, the first step in DSP software development is to analyze the available storage space. The quality of storage space allocation is related to the level of a DSP programmer. For DSP, we have two types of storage space, one is physical space and the other is mapped space. Physical space is the actual space on DSP that can store data and programs (including external memory). Our data and programs are finally placed in the physical space, but we cannot directly access them. If we want to access the physical space, we must use the mapped space! ! But the mapped space itself is a "virtual" space, a non-existent space. Therefore, the mapped space is often much larger than the actual physical space. Some mapped spaces, such as IO mapped space, also represent an interface. Only those mapped spaces mapped to the physical space are the storage spaces that we can actually access (read or write). 5. Reduce division operations as much as possible, and use multiplication and addition operations as much as possible instead. 6. If TI or third-party software partners provide DSPLIB or other legal subroutine libraries for calling, they should be called as much as possible. These subroutines are all written in assembly, and more importantly, they have passed the TMS320 algorithm standard test. Moreover, commonly used digital signal processing algorithms are included! ! 7. Use inline functions as much as possible! ! Instead of general functions! ! It can improve the integration of code. 8. The programming style is concise! ! Use C language instead of C++ language as much as possible. I personally feel that although the C++ final code is a little longer, it seems to have no effect on the execution speed. 9. Because both double and float types occupy 2 words in C5000, they can be used. Moreover, int type can be directly assigned to float or double type. However, int data type should be used as much as possible! This needs attention! ! 10. At least one blank line should be added to the end of the program. The compiler will treat this blank line as the end prompt. 11. Use bitwise operators boldly, they are very useful! ! 12. In June 2003, I downloaded the fast algorithm library of TMS320C67x series DSP from TI's website. Then, the fast algorithm library of TMS320C5000 and C6000 series came out. These algorithm libraries can be directly called by C/C++ language, with 100% optimization degree. You can use them as much as possible in actual programming (you can download the description document and ASCII source program at the same time, and you can modify it according to your needs. It is best to make a backup before modifying it)

This post is from DSP and ARM Processors
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list