This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi, M16C has 20 bit physical address bus, but the address registers are only 16-bit. It has a 16-bit data pointer. ROM memory region starts at memory location "0x000A0000" (i.e. 20 bit address). As the pointer size for GCC M16C is two bytes; it fails to access the memory region that is greater than 16 bits. The problem with having a 20-bit pointer is that these targets do 32 bit operations and truncate the result to 20-bit. Thus "large pointer" makes the code VERY slow, especially as the m16c has a very limited set of opcodes that can use large pointers. We had devised a feasible solution to access data in the 20-bit memory for M16C target after discussions with the mailing list. The following link briefly describes the possible solution. http://gcc.gnu.org/ml/gcc/2007-06/msg00807.html 1. Some of the important features of the patch are:- a. LDE and STE instructions are implemented for M16C and R8C targets, to access the data in 20-bit addressable memory area. b. New attribute 'far' (to use external memory for non-constant data storage) is added. This attribute is supported for R8C and M16C targets. c. New attribute 'near' is added. This attribute will be used only for the latest M16C targets that have 4K/8K flash in near Memory. d. Default linker script is modified for placing the default section '.nbss', '.ndata' and '.nrodata' in near memory and '.fbss', '.fdata' and '.frodata' in far memory. 2. Placement of the variables in various sections: a. By default, constant variables specified with the attribute 'far' will be placed in a section '.frodata' (far memory). b. Non-constant non-initialized variables specified with the attribute 'far' will be placed in a section '.fbss' (far memory). c. Non-constant initialized variables specified with the attribute 'far' will be placed in a section '.fdata' (far memory). d. LDE instructions will be used to access the constant variables specified with the attribute 'far'. e. Constant variables specified with the attribute 'near' will be placed in a section '.nrodata' (near memory). f. Non-constant non-initialized variables specified with the attribute 'near' will be placed in a section '.nbss' (near memory). g. Non-constant initialized variables specified with the attribute 'near' will be placed in a section '.ndata' (near memory). h. MOV instructions will be used to access the constant variables specified with the attribute 'near'. 3. Limitations: a. By default, all the constant string data will be placed in '.data' section in near memory instead of the '.rodata' section in far memory. It's due to the fact that 16-bit pointer will not be able to access the string variables at 20-bit far memory. b. For M16C and R8C targets, the pointers to data in the far memory (20-bit addressable) is not supported as the pointer size cannot be increased to more then 16 bits. A patch was posted at the following link to GCC-PATCHES mailing list after some basic implementations for review. http://gcc.gnu.org/ml/gcc-patches/2007-10/msg00167.html D.J.Delorie had reviewed the patch and suggested some modifications. Those suggestions have been incorporated in the present patch. Please find attached the 20-bit memory access patch "20bit.patch" for M16C target. The patch adds support to access the data from and to store the values in 20 bit memory. Please review the patch and suggest if there should be any modifications to it, so that it can be posted when the GCC trunk returns to stage-1. Please comment on whether this patch can be accepted for GCC-4.2? Note: This patch is for review. The patch will be modified based on the review comments and will be posted during the stage-1 for acceptance. Regards, Naveen.H.S. KPIT Cummins Infosystems Ltd, Pune (INDIA) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C and M32C Series. The following site also offers free technical support to its users. Visit http://www.kpitgnutools.com for details. Latest versions of KPIT GNU tools were released on October 1, 2007. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Attachment:
20bit.patch
Description: 20bit.patch
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |