[MCU] MSP430数据类型(data types)

[复制链接]
1045|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 | 显示全部楼层
数据类型查看此手册



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
wdliming 发表于 2019-5-16 11:43 | 显示全部楼层
谢谢分享~~~~
 楼主| zhangmangui 发表于 2019-5-27 21:50 | 显示全部楼层
看看这里吧    看看那个pdf
@wdliming

评论

看了  发表于 2019-7-18 19:42
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

935

主题

26375

帖子

590

粉丝
快速回复 在线客服 返回列表 返回顶部