I happen to do most of my 8051 programming in assembly, so I've run across the 256 byte paged area limit many times with SDCC. In commercial compilers I've used, there is no limit to the sixe of a paged area. They only ensure that each relocatable paged segment does not cross a 0x00 boundary. During allocation, if a segment does cross a 0x00 boundary, then it merely pads the segment until it starts at the next 0x00 point. This ensures that you don't have to worry about DPH changing while you are accessing data in that particular segment.
I've attached a crude patch to as/mcs51/link/lkarea.c which allows for >256 byte paged area. I'm sure I'm missing tons of stuff in the patch, but it works with my projects so I thought I would pass it along. It simply checks if each paged segment crosses a 0x00 boundary, and moves it to the next 0x00 starting point if it does. Also, to make best use of the space, it checks to see if any following segments fit into any padding area it created. This causes some problems with the final size calculation for the segment, which I've fixed by changing the calculation at the end.
Log in to post a comment.