I got this message "error C172: '?DT?main': segment too big (act=137, max=128)" when I build my program. I dont know what's the problem can you give me a solution?
By the way how can I put code into the code segment or variables into RAM?
Thanks a million!
"I dont know what's the problem"
Which part of "too big" is unclear?
"can you give me a solution?"
Make it smaller!
or consider using some fancy compression technique. If you're a programmer of quality, you could quickly determine the suitability of:
gnuwin32.sourceforge.net/.../lha.htm
Are you sure that's the right message?
http://www.keil.com/support/man/docs/c51/c51_c172.htm
Segment naming convention:
http://www.keil.com/support/man/docs/c51/c51_ap_segname.htm
Thank you very much! I solved it by changing Memory Model from SMALL to LARGE.
So do you understand why that "solved" the problem?
And do you understand the implications on your system - particularly in terms of code size & execution speed?
Thank you very much for your quenstions! I don't know if my understanding is correct.
The chip just has 128 byte DATA, but my 'main' function needs to use more than 128 byte area which is allocated from DATA as the Memory Model was SMALL. After I changed it into LARGE, the variables in 'main' are allcoated from XDATA so that's enough and it won't cause any compling errors.
Of course, that will lead to a bigger code size and affect the speed.
If you don't mind, I'd like to ask you another question I am trying to solve now.
The 'main' which had an compiling error is from the demo os so I want to split it into some small funcions which can make the source code look clearer. However, when I debugged it I met another error '*** error 65: access violation at Y:0x5A0044 : no 'read' permission'. I am quite sure that the chip doesn't have any area addressed as Y:0x5A0044. I don't know why it accesses an illegal address.
Thank you very much!
But are you aware, that switching to the large memory model isn't the only solution to your problem. That it's possible to just move individual variables to XDATA instead of forcing the compiler to switch all defaults by changing the memory model.
You want large variables in XDATA. But you don't want small and often used variables to also be forced to XDATA.
Thanks for your suggestion! I'll try it later, and I bet that will work.
By the way, could you give me some advice about my second problem? Thanks!