cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor II

I can't figure out how to fix the following compiler warning:

assignment discards 'const' qualifier from pointer target type

I have set up an area in Flash to store firmware for another PSoC (I will be bootloading it):

const uint8 FW831[FW_SIZE] __ALIGNED(CY_FLASH_SIZEOF_ROW) = {0u};

My understanding is that I have to use "const" or the compiler won't put it into Flash.  I also understand that it has to be set to a value as well - which in my case makes for a very large hex or cyacd file since FW_SIZE is 56320.

Later, I define a pointer to the flash area (its type is to match the functions that it is passed to):
unsigned char *Firmware;
Then the following line generates the warning:
Firmware = &FW[0];
The Firmware pointer is then passed to CyBtldr_ParseHeader and  CyBtldr_ParseRowData

Ideas?

0 Likes
Reply
1 Solution
2 Replies
New Contributor II

The warning was in the OP:

assignment discards 'const' qualifier from pointer target type

Your link helped.  I had tried declaring as a pointer to constant data but then the two functions that use the pointer caused the same error.  I had to change them to being passed a pointer to constant data, then it worked.  Would have been a problem if I didn't have their source code!

Mike.

0 Likes
Reply