3 Replies Latest reply on Apr 23, 2018 12:10 AM by serena.galimberti_2740911

    unexpected behavior when the flash used goes over 90 %

    serena.galimberti_2740911

      Hi everyone,

      I'm using the CY8C4245LQI microcontroller and I have an unexpected behavior when my code uses more than the 90% of the available flash: some features do not work. 

      Otherwise, when the output table shows:

      Flash used: 28672 of 32768 bytes (87,5%).

      SRAM used: 2828 of 4096 bytes (69,0%). Stack: 2048 bytes. Heap: 64 bytes.

      Everything goes well.

      I obtain this result by commenting a function that is not used for now. (But shall be used in the next future).

       

      So my question is: there are some restriction using the available flash at all?

       

      (Unfortunately i could not post my code because it is for a commercial use).

       

      Thanks for your help!

        • 1. Re: unexpected behavior when the flash used goes over 90 %
          bob.marlowe

          "some features do not work" They usually should. Can you explain a bit more what does work and what not?

          Ther might be a conflict with em_eeprom component or with the flash functions.

          Is there a chance that you post your complete project or a shortened version that shows the error so that we all can have a look at all of your settings. To do so, use

          Creator->File->Create Workspace Bundle (minimal)

          and attach the resulting file.

           

          Bob

          • 2. Re: unexpected behavior when the flash used goes over 90 %
            e.pratt_1639216

            The two most likely issues are the emulated EEPROM and writing to flash space as bob.marlowe mentioned.  (Both use flash space)

            Can you list which features/functions fail above 90% flash usage?

            It could always be an unrelated effect: Stack overflow, heap overflow, etc.

            • 3. Re: unexpected behavior when the flash used goes over 90 %
              serena.galimberti_2740911

              Hi everyone,

              i'm not using the emulated EEPROM but i'm writing some information to the flash space.

              The function that fails concerns to the I2C communication with an IMU component. No data are read from the slave.

              I solved my problem by decreasing the size of some buffer (not involved in the I2C communication) that are oversized. Now everything goes well. But I did not understand where my problem has origin!!

              Is it possible that my problems are related with RAM usage? stack undersized??

              Before buffer size decreasing, I tried to detect stack usage by compiling with -fstack_usage instruction and I obtained for the main.su:
              >>main.c:54:5:main 3120 static

              My stack is 2048 bytes. Does that mean stack overflow??

               

              Thank you for your precious help!