TN240分享 文档 参考 学.pdfVIP

  • 5
  • 0
  • 约7千字
  • 约 4页
  • 2020-10-30 发布于广东
  • 举报
Technical Note TN 240 HCS12X – Accessing Data (advanced) The present document describes how programmer can help the HCS12X compiler to generate the more optimal code for data access. It will cover following topics: Converting addresses (from logical to global, …) Defining a variable with logical addresses and access global Mixed addressing mode access to global variables Note 1: Information described in this technical note apply to SMALL (-Ms) and BANKED (-Mb) Memory model. They do not apply to LARGE (-Ml) memory model. Note 2: We usually recommend using SMALL memory model for application with less than 32Kb code and BANKED memory model otherwise. We do not recommend using LARGE memory model. Note 3: Please refer to technical note TN238 for basic usage of data definition with various addressing modes with and without banked memory. Converting addresses (from Logical to Global, …) There are runtime functions available to convert perform address conversion. These functions are implemented in datapage.c and are used for instance when you are assigning a __rptr pointer to a __far pointer. 1. For instance following code snippet (variables defined in nond extended addressing area): char data; volatile char temp; void func1(void) { char *__far ptr; char *__rptr rptr; ptr = data; rptr = ptr; temp = *rptr; } 2. Generates following code: 20: ptr = data; 0000 ce0000 [2] LDX #GLOBAL (data) 0003 c600 [1] LDAB #GLOBAL_PAGE (data) 21: rptr = ptr; 0005 160000 [4] JSR _CONV_GLOBAL_TO_LOGICAL 22:

文档评论(0)

1亿VIP精品文档

相关文档