1, variables (such as defining a four-byte variable int var) in the memory of the format is big-endian or small-end?
For example, define a variable int var = 1; If the CPU is a 32-bit CPU, the compiler will assign a value of 4 bytes in memory to 0x01,0x00,0x00,0x00, then the CPU reads in memory according to the address of the variable. This successive 4 bytes into its own register, and then the adder of the CPU adds the 4 bytes of content (as a value of 1). In the case of a big-endian CPU, the compiler assigns a value of 0x00,0x00,0x00,0x01, and then the CPU reads it and uses its own adder (as a number 1) to operate.
Similarly, if the memory of a variable in the address 0~3 content is 0x01, 0x00,0x00, 0x00, if it is a small end of the CPU, then the memory of this 4-byte variable represents the value 1, because this value is the CPU adder as 1 ( Low byte at low address ), if it is a big-endian CPU, then this 4-byte variable in memory represents the value 0x1 00 00 00, because the CPU adder treats it as a value of 0x1 00 00 00 (High byte at low address) to operate.
2, is the stack of threads expanding to a low address or high address?
C language compiler will be the function of parameters, interrupts, task scheduling compiled into the corresponding stack operation push VAR,CPU execute the push var instruction, the contents of the Var to the SP register value refers to the address, while the value of the SP register automatically added 1 or minus 1 (by the CPU type), If the value of the SP register is self-increasing when the CPU executes the push command, then the thread's stack is expanded to a high address, and if it is self-reducing, the thread's stack is expanded to a low address.
Several features (concepts) determined by the CPU type