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

error C172: '?DT?main': segment too big

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!

Parents
  • 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!

Reply
  • 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!

Children