2 Replies Latest reply on Dec 29, 2017 8:46 AM by user_339172641

    Assignment discards 'const' qualifier from pointer target type compiler warning

    user_339172641

      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?