This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PDATA segment too big when commenting code

I have a project that compiles to about 30KB, so it takes a while to load to my 8051. I'm trying to fix a small part, so I commented-out most of my main() routine. The linker now warns me and says it won't include the uncalled segments, (good,) but then it says I've run out of PDATA space for many of the functions that remain, (bad.) I'm using the Compact memory model. When I don't comment-out these function calls, the whole project links correctly. Is this strange behavior, or am I missing something obvious? Thanks.

Parents
  • Not enought info to provide much help except DON'T USE COMPACT MODEL. Always start with small memory model and explictly assign structs, arrays and seldom used globals to XDATA. DON'T USE COMPACT MODEL.
    You can still place variables in PDATA but I suggest not. Where possible, place any const data such as title blocks, large prinf strings that will not change into CODE space.
    In Startup.a51 you assign the location of pdata. The default is address 0x00 for P2. Startup will then initialize P2 at reset but if you later nickle with P2 the system DOES NOT return P2 to the original address. It's up to the user to monitor P2. It's not worth the effort.
    Just use the small memory model and move the large data structers into XDATA and let the system use the DATA area for locals, etc. Works much better.
    As to the error message, it sounds as if there are errors that mask the pdata overrun. When you comment out sections of code the later errors are identified. That's just pure guessing on my part.

Reply
  • Not enought info to provide much help except DON'T USE COMPACT MODEL. Always start with small memory model and explictly assign structs, arrays and seldom used globals to XDATA. DON'T USE COMPACT MODEL.
    You can still place variables in PDATA but I suggest not. Where possible, place any const data such as title blocks, large prinf strings that will not change into CODE space.
    In Startup.a51 you assign the location of pdata. The default is address 0x00 for P2. Startup will then initialize P2 at reset but if you later nickle with P2 the system DOES NOT return P2 to the original address. It's up to the user to monitor P2. It's not worth the effort.
    Just use the small memory model and move the large data structers into XDATA and let the system use the DATA area for locals, etc. Works much better.
    As to the error message, it sounds as if there are errors that mask the pdata overrun. When you comment out sections of code the later errors are identified. That's just pure guessing on my part.

Children
No data