Program size problem

Nei
2005-01-26
2013-03-12
  • Nei

    Nei - 2005-01-26

    I'm using a kit at89s8252 with only 8K of FLASH memory, 2K of EEPROM and 256 bytes of RAM and my application needs to calculate cosine, arco tangent and square root. When I compile it the binary code keeps bigger then 8K. I'm not including math.h in my code. Instead, I'm coding the functions in the program itself as an attempt to decrease the size, but it doesn't work fine.
    When I compile the program with model-small the binary code seems to be smaller then when I compile with model-large. But when I insert all the functions and call them in the code, I can't use the model-small model anymore because it shows an error message.
    I'm begginer with this stuff and I don't understand quite well the difference betwen model-small and model-large.
    I'm quite worried because I'm running out of time and I can't find a solution.
    I appreciate any help.
    Thank you.

    Nei

     
    • Maarten Brock

      Maarten Brock - 2005-01-27

      Model-large is to be used if you need more memory than the 128 bytes of directly addressable data memory. It uses xdata instead, which can be much bigger, but is slower and needs larger code. This device however does not have any xdata, only 128 bytes data + 128 bytes idata. So you cannot use model-large.

       
    • Nei

      Nei - 2005-01-27

      Can I use idata to store my variables? ex: idata float x;

      Can't I use the EEPROM to store data?

      Thank you.

       
    • Maarten Brock

      Maarten Brock - 2005-01-27

      Yes, you can use idata float x to store in idata.

      And yes, you can use the EEPROM as well. A simple approach would be to enable the EEPROM in crtxinit.asm. Set EEMEN and EEMWE, write a byte, poll RDY/BSY, write next byte... and optionally disable EEMWE afterwards. See the datasheet for more information.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks