View Single Post
  #5   Spotlight this post!  
Unread 19-03-2008, 10:56
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: HELP - Link Error "Will Not Fit Section" 8520PIC

It sounds like the linker cannot find a contiguous chunk of RAM to place this fairly large section of ram (132 bytes).

For example, lets say you have 2k of ram available in 8 banks and create 9 129 byte arrays for a total of 1161 bytes. The linker won't be able to find any place large enough for the 9th 129 byte array to fit into because each bank only has 127 bytes of room left -- lots of space but too fragmented to use.

If you'd like a hand, zip up the project and private message me and I'll take a look. I'll bet it can be tweaked to do what you want, it might just need some more linker persuasion via pragmas.

There isn't a full 16k available for the user on the 8720, the first 2k of program space is reserved for the protected boot loader code (0-0x800).

Merging ram blocks in the linker file elminates the default maximum of 256 bytes per module -- its just not recommended because then the bank register is then not guarenteed to be the same for all variables in a module which has compiled code size implications.

One thing that odd, but noteworthy. If I create lots of udata variables, the linker will automatically place it in the large ram segment without prompting. But if I create lots of idata variables, it doesn't. In this case I needed to add the specific pragma line

Code:
#pragma idata bigidata=0x600

int vars1[11][5]={0};   // 110 bytes (idata)
int vars2[11][5]={0};   // 110 bytes (idata)
unsigned char pad;  //   1 byte (udata)
int vars3[11][5]={0};   // 110 bytes (idata)
The linker map merged 0x600-0x7FF into one ram segment.

Last edited by dcbrown : 19-03-2008 at 11:39.