Hi Folks,
Strange happenings with the C32 and XC32 compiler from Microchip, I can't see that anybody else has this issue, so am wondering what is going on.
The following code:
Code:
#define flash(name) __attribute__((section(name), space(prog)))
#define aligned __attribute__ ((aligned(1)))
flash(".test") aligned static char test[2048] = {0x00};
should create a section called
.test which is 2048 bytes in program memory, char is stated as 8 bits, I have also tried to use INT8.
Output of memory map states (Please ignore the formatting I can't get it to format correctly! 4096 is the dec of 0x1000 hex):
Code:
kseg0 Program-Memory Usage
section address length [bytes] (dec) Description
------- ---------- ------------------------- -----------
.test 0x9d00f798 0x1000 4096
So it has doubled to 4096 bytes, I have tried this will all data types and it seems to be doubling the number of bytes, which is why I have put the
aligned attribute in place.
Does anybody have any ideas what is going on? I have tried using the
packed attribute but it says the compiler will ignore it, I guess that is only used on structures etc.
Bit of a loss as to why it is doubling the data type size, this happens on C32 and XC32.
MPLABX, C32, XC32 downloaded as free / trial from MCHIP last month.
I have also tried changing the compiler / linker options to turn on 16 bit, remove unused code, put things into their own sections etc, all makes no difference.
Help...Please!
Kind Regards
Wilksey