I thoughts that pointers are allowed in Composer studio v13.
BTW, are there any documents on a difference in programming in versions 12 and 13,
and on programming in xc for v13 ?
Anyway, I have a piece of code
Code: Select all
unsigned int size, i;
unsigned char *start_ptr, *end_ptr;
unsigned char const *dptr;
unsigned char rbuf[4]; // buffer to read data from flash, [3] for debug
1 Read_mem(0x10000, 2, rbuf); // read version to rbuf
2 Read_mem(0x10003, 1, &rbuf[2]); // read verification byte to rbuf
3 if ((rbuf[2] == 0x55) && (rbuf[0] == dprof.version_major)) // valid verification
4 {
5 Read_mem(0x10000, size, &rprof.version_major); // read flash profile to ram
6 rbuf[3] = 1;
7 }
8 else // invalid, load default to ram and store to flash
9 {
10 unsigned char *start_ptr = &rprof.version_major;
11 start_ptr = (unsigned char *)&rprof.version_major;
12 memcpy(start_ptr,dptr,size); // copy default profile to ram profile
13 /* erase sector 1 and write ram array to it (2 pages are written) */
14 Erase_mem_sector(1);
15 Write_mem(0x10000,256,&rprof.version_major);
16 Write_mem(0x10100,size-256,&rprof.version_major + 256);
17 rbuf[3] = 0;
18 }
It compiles fine, but on debugging I constantly get an exception
- Suspended: Signal 'ET_ECALL' received. Description: Application exception.
And seems like it's related to pointers use.
When I comment out some the functions, i get this exception in a different place.
So is this exception related to the pointers use ?
And if yes, what are the rules for pointers use in XC v13 ?
And how can I pass a structure to a function without using pointers ?
Thank you,
Gennady