[SOLVED] Stack Underflow When the Number of an Array is Increased

Status
Not open for further replies.
Perhaps a turn around for that issue could be adding pre processors directive that instructs compiler to allocate that big variable within a contiguous region. Taking a look on CCS user's guide it is possible to identify a directive that is likely to do that, as follows:


Code C - [expand]
1
int8 array[<size_of_array>] __attribute__((aligned(<address_of_array>)));

 

Allocating memory objects is easy in CCS C with #locate directive. Presume that Apsua already did it during test.
 

I may have been overlooked something, but isn't #locate directive used just with program memory ?
 

No. I used the below code the reproduce the discussed compiler bug
Code:
#include <18f46k80.h>

int8 *ptr;
int8 dat[3] = {1,2,4};
int8 dat2[3] = {1,2,4};
#locate dat2=0x0fe

void main(void)
{
   ptr = dat;
   shift_right(ptr, 3, 0);
   ptr = dat2;
   shift_right(ptr, 3, 0);
}
 
Thanks for help.
If the bug still exists, I think I should report the bug.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…