Hi
We are using Pic18f6722 Controller as a TFT LCD Driver. All these days code size was less than 64K bytes and whatever coding we had done was working properly.
Now the code size is increased beyond 64K bytes. Now we are encountering following problems,
- The lookup tables in program memory is not accessing properly.
- the pointers used to point to const string literals are not working properly.
for the second problem above we found out that Pointer used for program memory needs to be changed to 24bit from 16bit. Is there any option to treat all pointers to program memory as 24bit ?
Also the code model has to be changed to Large code model from defult(small code model). But once we change to large code model the linker is giving following error for the same program which was compiled successfully in small code model.
MPLINK 4.15, Linker
Copyright © 2007 Microchip Technology Inc.
Error - section ‘.idata_font_old.o’ can not fit the section. Section ‘.idata_font_old.o’ length=0x00000180
Errors : 1
And i’ve made one more observation,
In my linker file i changed ending address of code page from 0x1ffff to 0xfff,
which is shown in map file also as 0x0fff.
But once i changed the end address in linker file to 0x1ffff or 0x10fff,
the corresponding change is not taking place in map file.
For any address greater than 0xffff(64K) the map file shows only 0xffff
as ending address. The map file file is generated by linker. I feel the
linker is not working for code sizes greater than 64K bytes.
I have checked all the toolsuite paths and found them to be correct. Also i am using latest MPLAB IDE V8.00 and MPLAB C18 V3.15 Compiler.
I have not declared any ram variables in font_old.c file, this rules out
error with data memory. Moreover the same project is compiling successfully in small code model with same linker script file. I am encountering the above mentioned error if change the code model to large code model and compile the same project as earlier.
Actually the font_old.c file is consisting of lookup tables values of arrays a to z of asccitable. i. e
static rom unsigned char a] = {…},
static rom unsigned char b] = {…},
.
.
.
.
.
.
.
static rom unsigned char z] = {…},
and one more array which is ascii_table array
rom unsigned char *ascii_old] = { . . . . .};
This is my linker script file
// $Id: 18f6722.lkr,v 1.2 2004/09/13 22:07:05 curtiss Exp $
// File: 18f6722.lkr
// Sample linker script for the PIC18F6722 processor
LIBPATH .
FILES c018i.o
FILES clib.lib
FILES p18f6722.lib
CODEPAGE NAME=vectors START=0x0 END=0x29 PROTECTED
CODEPAGE NAME=page START=0x2A END=0x1FFFF
CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED
CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED
CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED
CODEPAGE NAME=eedata START=0xF00000 END=0xF003FF PROTECTED
ACCESSBANK NAME=accessram START=0x0 END=0x5F
DATABANK NAME=gpr0 START=0x60 END=0xFF
DATABANK NAME=gpr1 START=0x100 END=0x1FF
DATABANK NAME=gpr2 START=0x200 END=0x2FF
DATABANK NAME=gpr3 START=0x300 END=0x4FF PROTECTED // buf, BUFFER HIGHLIGHT
//DATABANK NAME=gpr4 START=0x400 END=0x4FF
DATABANK NAME=gpr5 START=0x500 END=0x5FF
DATABANK NAME=gpr6 START=0x600 END=0x6FF
DATABANK NAME=gpr7 START=0x700 END=0x7FF
DATABANK NAME=gpr8 START=0x800 END=0x8FF PROTECTED
DATABANK NAME=gpr9 START=0x900 END=0xAFF PROTECTED // ERROR MSG BUFFER
//DATABANK NAME=gpr10 START=0xA00 END=0xDFF
DATABANK NAME=gpr11 START=0xB00 END=0xBFF
DATABANK NAME=gpr12 START=0xC00 END=0xCFF
DATABANK NAME=gpr13 START=0xD00 END=0xEFF //STACK
//DATABANK NAME=gpr14 START=0xE00 END=0xEFF
DATABANK NAME=gpr15 START=0xF00 END=0xF5F
ACCESSBANK NAME=accesssfr START=0xF60 END=0xFFF PROTECTED
SECTION NAME=CONFIG ROM=config
STACK SIZE=0x200 RAM=gpr13