Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Data array limitation? My program crashed after I declared a data array.

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



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

Post Reply
Follow this topic



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

allenpeng posted on 12 Jul 2012 3:22 AM PST
Senior Member
12 Forum Posts

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




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

allenpeng posted on 12 Jul 2012 03:37 AM PST
Senior Member
12 Forum Posts

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

Is this mean the data array too big ?



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

RobK posted on 12 Jul 2012 06:31 AM PST
Top Contributor
56 Forum Posts

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!



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

dreitz posted on 12 Jul 2012 02:07 PM PST
Top Contributor
74 Forum Posts

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



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

allenpeng posted on 13 Jul 2012 10:30 PM PST
Senior Member
12 Forum Posts

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



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

RobK posted on 13 Jul 2012 11:36 PM PST
Top Contributor
56 Forum Posts

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!



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

allenpeng posted on 13 Jul 2012 03:36 AM PST
Senior Member
12 Forum Posts

Hi RobK,

Thanks for your detailed explanation.

best regards,

Allen






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.