ARM Basics Series 7

Publisher:WhisperingSongLatest update time:2015-03-16 Source: laoguKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
*************************************************** ***********

Data types supported by the ARM compiler

************************************************************
Data type Length (bits) Alignment
Char 8 1 (byte alignment)
short 16 2 (hundred word alignment)
Int 32 4 (word alignment)
Long 32 4 (word alignment)
Longlong 64 4 (word alignment)
Float 32 4 (word alignment)
Double 64 4 (word alignment)
Long double 64 4 (word alignment)
All pointers 32 4 (word alignment)
Bool(C++ only) 32 4 (word alignment)

1. Integer type
In the ARM system, integer types are stored in 2's complement form. For long long type, in little endian memory mode, its lower 32 bits are stored in the word unit of the lower address, and the upper 32 bits are stored in the word unit of the higher address; in big endian mode, its lower 32 bits are stored in the word unit of the higher address, and the upper 32 bits are stored in the word unit of the lower address. The following rules are followed for integer data operations:
**All operations on signed integers are performed in binary complement.
**Operations on signed integers do not extend the sign.
**Right shift operations on signed integers are arithmetic shifts.
**The number of shift bits specified is an 8-bit unsigned number.
**The number to be shifted is treated as a 32-bit number.
**The result of a logical left shift of more than 31 bits is 0.
**For unsigned numbers and signed positive numbers, the result of a right shift of more than 32 bits is 0; for signed negative numbers, the result of a right shift of more than 32 bits is -1.
**The remainder and divisor of integer division have the same sign.
**When an integer is truncated to a shorter integer type, the correctness of the highest sign bit of the result cannot be guaranteed.
**Type conversion between integer data will not generate an exception interrupt.
**Overflow of integer data will not generate an exception interrupt.
**Integer data divided by 0 will generate an exception interrupt.
2. Floating point numbers
In the ARM system, floating point numbers are stored according to the IEEE standard.
**Numbers of float type are represented by IEEE single precision numbers.
**Double and long double are represented by IEEE double precision numbers.
The following rules are followed for floating point operations:
**Follow the normal IEEE754 rules.
**Floating point operation exception interrupts are prohibited by default.
**When wraparound occurs, the closest data is used to represent it.
3. Pointer type data
The following rules apply to pointers other than data member pointers:
**NULL is defined as 0.
**The address difference between two adjacent storage units is one.
**When data conversion is performed between a pointer to a function and a pointer to data, the compiler will generate a warning message.
**The type size_t is defined as unsigned int.
**The type ptrdiff_t is defined as signed int.
**When two pointer types are subtracted, the result can be obtained according to the following formula.
    ((int)a-(int)b)/(int)sizeof(type pointed to)
At this time, as long as the object pointed to by the pointer is not packed, its alignment characteristics can meet the requirements of integer divisibility.

Keywords:ARM Reference address:ARM Basics Series 7

Previous article:ARM Basics Series 8
Next article:ARM Basics Series 6

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号