Hot!MCC V3.55.1 generated incorect END_FLASH value in memory.h for PIC18F24K22 & other MCC not

Author
m_alizd
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2016/02/28 02:21:37
  • Location: 0
  • Status: offline
2018/04/16 18:43:50 (permalink)
0

MCC V3.55.1 generated incorect END_FLASH value in memory.h for PIC18F24K22 & other MCC not

Hi All,
 
I'm using MCC V3.55in MPLABX IDE V4.05 XC8 V1.38 under Win 10 PRO to generate configuration code.
PIC18F24K22 has 16KB flash memory and 768 bytes SRAM and 256 bytes of EEPROM.
To much of my surprise I see incorrect END_FLASH defined constant value of 655356 (instead of 16384) in generated memory.h as below:
 
#define WRITE_FLASH_BLOCKSIZE    64
#define ERASE_FLASH_BLOCKSIZE    64
#define END_FLASH                65536


(Screen snapshot attached)
Any thoughts from anyone as why?
 
The code to read from Flash is not sensitive to this and I'm using it now.
But as far as I can see the code to write is relying on it, so I reckon I might face problems when I reach there. Also if I try to use it to put a data table of 2KB at (__at) end of Flash memory it will actually fall out of the available/physical Flash range.
 
void FLASH_WriteByte(uint32_t flashAddr, uint8_t *flashRdBufPtr, uint8_t byte)
{
    uint32_t blockStartAddr = (uint32_t)(flashAddr & ((END_FLASH-1) ^ (ERASE_FLASH_BLOCKSIZE-1)));
    uint8_t offset = (uint8_t)(flashAddr & (ERASE_FLASH_BLOCKSIZE-1));
    uint8_t i;

    // Entire row will be erased, read and save the existing data
    for (i=0; i<ERASE_FLASH_BLOCKSIZE; i++)
    {
        flashRdBufPtr = FLASH_ReadByte((blockStartAddr+i));
    }

    // Load byte at offset
    flashRdBufPtr[offset] = byte;

    // Writes buffer contents to current block
    FLASH_WriteBlock(blockStartAddr, flashRdBufPtr);
}
Any thoughts on 3 MCC notifications seen on attached screenshot?
 
I'd appreciate if anyone sheds a light on this and possibly an automatic fix through MCC.
Matt
P.S.    I couldn't attach .mc3 and IDE log files as I was getting error messages below when attaching which I couldn't figure out why!
post edited by m_alizd - 2018/04/16 19:05:21

Attached Image(s)

#1
Danno
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2005/09/07 10:12:10
  • Status: offline
Re: MCC V3.55.1 generated incorect END_FLASH value in memory.h for PIC18F24K22 & other MCC 2018/04/17 13:56:46 (permalink)
0

#define WRITE_FLASH_BLOCKSIZE 64
#define ERASE_FLASH_BLOCKSIZE 64
#define END_FLASH 0x4000

 
Looks like it's been fixed (MPLAB X v4.15, xc8 V1.45, MCC v3.55.1)
#2
PA91
Starting Member
  • Total Posts : 27
  • Reward points : 0
  • Joined: 2012/09/03 21:45:40
  • Location: 0
  • Status: offline
Re: MCC V3.55.1 generated incorect END_FLASH value in memory.h for PIC18F24K22 & other MCC 2018/04/18 08:46:44 (permalink)
0
This issue has been fixed in the latest MCU8 Library (1.65.2) which is available with MCC 3.55.1v plugin.
#3
Jump to:
© 2018 APG vNext Trial Version 4.5