打印
[MCU]

MSP430数据类型(data types)

[复制链接]
865|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
zhangmangui|  楼主 | 2019-5-15 23:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Data types and memory handlingMSP430 architecture processors use a single address space to map data and code. The registers and memory are 16 bits wide, and the CPU can only read and write 16 bit data at even addresses. If you attempt to read or write a 16 bit value at an odd address, the CPU behaves as if the LSB is not set. The processor has no exception handling. The MSP430 can read and write 8 bit data at any address.
The C compiler supports the following basic data types
  • char - 1 byte (8 bits)
  • int - 2 bytes (16 bits)
  • long - 4 bytes (32 bits)
  • long long - 8 bytes (64 bits)
  • float - 4 bytes

All the integer types are supported in signed and unsigned forms. Pointers are always 2 bytes wide.

All global variables with the "const" attribute are allocated in the main ROM space. They are normally placed in the .text section. Accessing "const" variable is no different than accessing to any other type of variable. If the device uses flash memory and the flash memory is enabled for writing, you can write to the flash. You can place "const" variables to RAM, using the attribute "section(".data"))" as follows:
const char __attribute__ ((section(".data"))) foo = 1;
Please note that if you declare variables r0 - r15, the assembler will prepend '_' in order to allow the assembler to distinguish them from the registers names.

Variables larger than one byte are always located at an even address. Single byte variables can be located at any address.

使用特权

评论回复

相关帖子

沙发
zhangmangui|  楼主 | 2019-5-15 23:10 | 只看该作者
mspgccA port of the GNU tools to the Texas Instruments MSP430 microcontrollers

使用特权

评论回复
板凳
zhangmangui|  楼主 | 2019-5-15 23:16 | 只看该作者

使用特权

评论回复
地板
zhangmangui|  楼主 | 2019-5-15 23:18 | 只看该作者
数据类型查看此手册

TI_CompilerReference.pdf (864.36 KB)

使用特权

评论回复
5
wdliming| | 2019-5-16 11:43 | 只看该作者
谢谢分享~~~~

使用特权

评论回复
6
zhangmangui|  楼主 | 2019-5-27 21:50 | 只看该作者
看看这里吧    看看那个pdf
@wdliming

使用特权

评论回复
评论
wdliming 2019-7-18 19:42 回复TA
看了 
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:欢迎进入【TI DSP 论坛】 & 【DSP 技术】           TI忠诚粉丝!

935

主题

26376

帖子

589

粉丝