Source File Limit?

2004-09-09
2013-03-12
  • Pedro Ignacio Martos

    Hi,

    Does the .C source files have a size limitation? I see that if the .C source file is greater than 16kb strange things happen.

    best regards,
    Pedro Ignacio Martos

     
    • James Davis

      James Davis - 2004-09-19

      check your code.  I have several files that are larger than 16k that work fine.  One thing to be careful of is that a lot of microprocessors, especially 8051 core, have very small amounts of internal memory for stack.  As a result, if you get too many nested if/else statements or other stack intensive data, you WILL likely have issues.  I may be wrong on this, but this is just my personal experience.  I also believe that my issues came from working with strings & pointers, and not the stack issues.  But I do know for sure that it will support at least 16K.  Also, you will want to check the size of the code memory (flash) on your chip.  If your code generates more data than can fit on your flash, you WILL get unexpected results.

       
    • Pedro Ignacio Martos

      Thanks for the answer James, about the flash size, I checked it and the code generated is less than 4KB. I solved the problem splitting my c source file in two, compile them separately (generating two .REL files) and linking both .REL files together;  and everything worked well, but If I merge the two files and compile the big one, I have strange behaviors, like functions that never get called and things like this.
      regards,
      Pedro Ignacio Martos

       
    • jlau00

      jlau00 - 2004-09-30

      Hi,

      I have similiar experience.   I generated a code with 3.3K size and it works fine.   When I add a simple for-loop to it and the size become 3.4K, it works strange and seems hang at the beginning of the for-loop.  I tested it in different way and looks like something wrong if I put a loop which cross between 3.4K size.

      Joe

       
    • Pedro Ignacio Martos

      Hi Joe,

      The 3.3K size is the C source file size or the memory image size? I experience problems when a C source file crosses the 16KB boundary, but the memory image is always less than 4KB. As I have said, I solved it splitting the file in two and merging them at the linker.

      regards,
      Pedro Ignacio Martos

       
    • jlau00

      jlau00 - 2004-10-01

      Hi Pedro,

      Yes.  the 3.3K size is the memory image size.   I have seperated three .rel files but the result still be same.   I put the same for-loop at the beginning part of the program and it works well.   However, if i put the same for-loop at the tail of the program.  It doesn't work.   The program ran to the for-loop and then hang up.

      Joe

       
    • Maarten Brock

      Maarten Brock - 2004-10-01

      Pedro, Joe,

      Would any of you be so kind as to post the sources? You could do that in the bug section or if you don't want to disclose to the whole world send to me directly.

      Maarten

       

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks