You are here

CY Boot Infinite Loop Problem | Cypress Semiconductor

CY Boot Infinite Loop Problem

Summary: 6 Replies, Latest post by rm3330_1699156 on 06 Oct 2016 12:49 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
rm3330_1699156's picture
User
14 posts

Hello I am trying to execute the following code: 

int main()
{

    /* Initialize ADC. Conversion is not enabled yet. */
    //void ADC_Start();
    CyGlobalIntEnable;
   ADC_Start();
   ADC_IRQ_Enable();
   ADC_StartConvert();

    /* Start ADC conversion. */
  for(;;)
{
while(row_count<2u)
{
       CySysFlashWriteRow(row_count,Buffer);
  
}      

        for(k=1u;k<2u;k++)
        {
        *readptr = CY_FLASH_BASE + (k*CY_FLASH_SIZEOF_ROW);
        for(byte_count=0u;byte_count< CY_FLASH_SIZEOF_ROW;byte_count++)
          {
          read_data[byte_count] = (*(uint8 *)(readptr + byte_count));
          //byte_count++;
          }
      //  k++;
        }

}
}  
          

However, after writing and entering the     for(k=1u;k<2u;k++) loop it enters into this while loop which I found from debugging: 

 #ifdef CY_BOOT_INT_DEFAULT_HANDLER_EXCEPTION_ENTRY_CALLBACK
        CyBoot_IntDefaultHandler_Exception_EntryCallback();
    #endif /* CY_BOOT_INT_DEFAULT_HANDLER_EXCEPTION_ENTRY_CALLBACK */

    while(1)
    {

    }

Any ideas as to what the problem might be?

user_1377889's picture
User
9625 posts

Yes, I have got some ideas. But your code snippet is incomplete, so can you please post your complete project, 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.

EDIT: I just see that you overwrite flash in row 1 and 2 where your program resides.

 

Bob

rm3330_1699156's picture
User
14 posts

Here you go!

 

Thanks!

user_1377889's picture
User
9625 posts

read_data[byte_count] = (readptr + byte_count);

This line is flagged with a warning, but I would consider clearing that.

As a result: Use the upper flash rows. When no bootloader is used and the program not too big they are free.

 

Bob

rm3330_1699156's picture
User
14 posts

Hi I am using the upper flash rows indeed. And I cleared the flag as following but am still experiencing this problem:

read_data[byte_count] = (*((uint8*)(readptr + byte_count)));

Thanks,

Rikin

user_1377889's picture
User
9625 posts

Use the debugger to see if the flash contains correct value. Check the return value of  CySysFlashWriteRow() for success (zero)

 

Bob

rm3330_1699156's picture
User
14 posts

Yes, it is writing correctly. However, I was able to fix the problem by making a new project and copying the code over. 

Thanks,

Rikin

Log in to post new comments.