TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320C28x数据类型

新手学习C28系列DSP,对数据类型有些疑问,因为头文件的定义的数据类型和C语言不一致,比如int在C中是4 bytes=32 bits。 

头文件:

typedef int int16;
typedef long int32;
typedef long long int64;
typedef unsigned int Uint16;
typedef unsigned long Uint32;
typedef unsigned long long Uint64;
typedef float float32;
typedef long double float64;

查了一TMS320C28x的编译器后发现数据类型和C有很大的不同。不知道大家移植C程序时有什么诀窍没有?

以下是TMS320C28x的编译器的资料。大意就是C28x一个byte的定义是16位不是8位。Int的定义是16位不是32位,具体见表。

By ANSI/ISO C definition, the sizeof operator yields the number of bytes required to store an object. ANSI/ISO further stipulates that when sizeof is applied to char, the result is 1. Since

the TMS320C28x char is 16 bits (to make it separately addressable), a byte is also 16 bits. This yields results you may not expect; for example, size of (int) = = 1 (not 2).


mangui zhang:数据类型是有些区别的编程时按照C2000数据类型进行设计
本人很少在其他平台上完成后再移植过来

新手学习C28系列DSP,对数据类型有些疑问,因为头文件的定义的数据类型和C语言不一致,比如int在C中是4 bytes=32 bits。 

头文件:

typedef int int16;
typedef long int32;
typedef long long int64;
typedef unsigned int Uint16;
typedef unsigned long Uint32;
typedef unsigned long long Uint64;
typedef float float32;
typedef long double float64;

查了一TMS320C28x的编译器后发现数据类型和C有很大的不同。不知道大家移植C程序时有什么诀窍没有?

以下是TMS320C28x的编译器的资料。大意就是C28x一个byte的定义是16位不是8位。Int的定义是16位不是32位,具体见表。

By ANSI/ISO C definition, the sizeof operator yields the number of bytes required to store an object. ANSI/ISO further stipulates that when sizeof is applied to char, the result is 1. Since

the TMS320C28x char is 16 bits (to make it separately addressable), a byte is also 16 bits. This yields results you may not expect; for example, size of (int) = = 1 (not 2).


Susan Yang:参考 www.ti.com/…/spru514p.pdf的6.13.1 C99 Support (–c99)

我觉得可以使能 C99 Support

The compiler supports the 1999 standard of C as standardized by the ISO.

赞(0)
未经允许不得转载:TI中文支持网 » TMS320C28x数据类型
分享到: 更多 (0)