Motorola LD-W-1 User's Guide Page 16

  • Download
  • Add to my manuals
  • Print
  • Page
    / 23
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 15
System LSI Division, Semiconductor Business
Fixed: The addition of pointer is calculated as signed integer even if the type is
unsigned. So when adding pointer with a value that exceeds the range of signed
integer, its result is different from the expected value because of the 16-signed
addition.
Ex>
#include <stdio.h>
void main(void) {
unsigned char* p = (unsigned char*)0x80000;
unsigned char a = 0x80;
unsigned char b = 0x00;
unsigned int i = 0x00ff;
unsigned long l = 0x10000;
// 0x80000 + ~0x00ff = 0x8ff00
if ((p + ~i) != (unsigned char*)0x8ff00)
printf("fail\n");
// 0x80000 + (unsigned int)(0x10000>>1) = 0x88000
if ((p + (unsigned int)(l>>1)) != (unsigned char*)0x88000)
printf("fail\n");
// 0x80000 + (0x00ff|0xff00) = 0x8ffff
if ((p + (i|0xff00)) != (unsigned char*)0x8ffff)
printf("fail\n");
// 0x80000 + (0x00ff^0xff00) = 0x8ffff
if ((p + (i^0xff00)) != (unsigned char*)0x8ffff)
printf("fail\n");
i = 0xff00;
// 0x80000 + (0xff00&0xf000) = 0x8f000
if ((p + (i&0xf000)) != (unsigned char*)0x8f000)
printf("fail\n");
}
EXT: Inside function’s body the definition of variable with the keyword ‘code’ should be
not permitted.
Ex>
void foo(void) {
code int i = 0x23; // not permitted, the error should be generated.
}
Fixed: In release mode when using inline assembly function ‘__asm’ the following error is
generated.
Error message : error: syntax error; invalid inline assembly
Ex>
void foo(void) {
int i;
i = 1;
__asm(“nop”);
}
EXT: Support the function placed the variable with the keyword ‘code’ at the absolute
address of ROM using the keyword ‘_at”
Ex>
code int arr[10] = {2,} _at_ 0x10000; // 0x10000 is the address of ROM
12 Property of Samsung Electronics Co., Ltd.
Page view 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 22 23

Comments to this Manuals

No comments