- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello i wrote:
//Write to flash
int var_2 = FLASH_getIndex();
////////////////////////////////////////////////////////////////////////////////////
LCD_clear();
fprintf(fp_LCD, "%d %d %d\r\n", regions.offset, regions.block_size, var_2);
ret_code = alt_write_flash_block(fd_FLASH, 0, regions.offset + (regions.block_size* var_2), FLASH_buffer, BUFF_SIZE);
fprintf(fp_LCD, "%d %d %d\r\n", regions.offset, regions.block_size, var_2);
while(1)
////////////////////////////////////////////////////////////////////////////////////
.
the output is: 65536 65536 0 <-- correct 65536 65536 100663112 <--wrong!!! why does the var_2 value changes after the alt_write_flash_block function call????
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could be a memory corruption problem or stack overrun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how can i know which one is which...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i tested without the function the value of var_2 does not change without the function....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
memory corruption and stack overflows are the most difficult bugs to track down... If you are using pointers in your code, doublecheck that they are always pointing to what they are supposed to point to.
Also check that you don't use big structures as local variables in your functions (such as big tables) as it can generate a stack overflow.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page