6 Replies Latest reply on Jul 13, 2012 5:36 AM by allen.peng

    Data array limitation? My program crashed after I declared a data array.

    allen.peng

      Hi all,

         

      Is there any limitation of data array ? My program crashed after I declared a data array. And everything is ok when I comment (mask) this array. Anyone could help me ?

         

      Thank you.

         

      Array Format: uint8_t gDeviceSetting[] = {  0x00, 0x01, 0x02, .........};

         

      Array Size: 2226 bytes

         

      Compiler Messages:

         

      ........................skip........................

         

      C:\Cypress\FX3 SDK\\util\elf2img\elf2img.exe -i test.elf -o test.img -i2cconf 0x1E
      Warning: 256 bytes of interrupt vector code have been removed from the image.
               Use the "-vectorload yes" option to retain this code.  // What is this Warning mean? Should I follow this instruction?

         

      ........................skip........................

         

      Invoking: ARM Sourcery Windows GNU Print Size
      arm-none-eabi-size  --format=berkeley test.elf
         text           data     bss     dec            hex    filename   //is the code size or data size too big ?
       156936    5284    9248  171468   29dcc   test.elf
      Finished building: test.siz

        • 1. Re: Data array limitation? My program crashed after I declared a data array.
          allen.peng

          I tried to declare this array in "const" format, then my program works fine.

             

          Is this mean the data array too big ?

          • 2. Re: Data array limitation? My program crashed after I declared a data array.
            robert.kliemann

            Hi,

               

            in which scope you declare the array: global or local in a function?
            Depending on this the array is located in the DATA-area of RAM or in the STACK-area. The stack which is available for each thread you define during thread-creation. So I assume you got a stack-overflow with your large arrray because the thread-stack is too small.

               

            If you declare your array as "const" it is located in DATA-area of memory (this ensures the linker) which is usually much larger than the stack. The size of the DATA-area you can define in the linker-script.

               

             

               

            Regards!

            • 3. Re: Data array limitation? My program crashed after I declared a data array.
              joanne.dreitzler

              I get this too....  " Use the "-vectorload yes" option to retain this code."  I just ignore it.  Does not seem to bother anything.

              • 4. Re: Data array limitation? My program crashed after I declared a data array.
                allen.peng

                Hi RobK,

                   

                Thanks for your explanation. My stack is too small.

                   

                BTW, anyone knows this warning message's meaning ?

                   

                Warning: 256 bytes of interrupt vector code have been removed from the image.
                         Use the "-vectorload yes" option to retain this code.  // What is this Warning mean? Should I follow this instruction?

                   

                I don't follow this instruction now and everything seems like ok. But, I am afraid this will cause side effect.

                                                           
                 RobK
                • 5. Re: Data array limitation? My program crashed after I declared a data array.
                  robert.kliemann

                  Hi,

                     

                  you can ignore this message! It's a message from elf2img-tool and the explanation for that you can find in the readme.txt in the elf2img-folder ( <install_path>\EZ-USB FX3 SDK\1.1util\elf2img\ ):

                     

                       The ARM926EJ-S core on the FX3 device has its reset and interrupt vectors
                        stored in the first 256 bytes of memory (address range 0x00 - 0x100). It
                        is not advisable to load any code directly into this address range as it
                        may interfere with the boot loader or active firmware operation. The FX3
                        firmware library and default linker settings ensure that no valid code is
                        to be loaded directly into this address range. The interrupt vectors are
                        safely copied into this area once the firmware starts running.

                        The elf2img utility in default mode removes any data in the address range
                        0x00 - 0x100 while generating the boot image. This is safe because the
                        recommended linker settings ensure that no valid code/data is placed in
                        this address range.

                        This behavior can be over-ridden using the -vectorload command line option.
                        The <vecload> value is a yes/no string, which when set to "yes" causes
                        the tool to retain any data in this address range in the boot image. The
                        default value for this parameter is "no".

                     

                   

                     

                  Regards!

                  • 6. Re: Data array limitation? My program crashed after I declared a data array.
                    allen.peng

                    Hi RobK,

                       

                    Thanks for your detailed explanation.

                       

                    best regards,

                       

                    Allen