/* Requests the bootloader to erase the specified range of memory on the target. The bootloader aligns this range to hardware specified erase blocks.  */
static bool XcpLoaderClearMemory(uint32_t address, uint32_t len)
/* Requests the bootloader to erase the specified range of memory on the target. The bootloader aligns this range to hardware specified erase blocks.  */
static bool XcpLoaderClearMemory(uint32_t address, uint32_t len)
{
  bool result = false;
  assert(len > 0);
  assert(xcpSettings.transport != NULL);
  if ( (len > 0) && (xcpSettings.transport != NULL) && (xcpConnected) )
  {
    result = true;
    if (!XcpLoaderSendCmdSetMta(address))
    {
      result = false;
    }
    if (result)
    {
      if (!XcpLoaderSendCmdProgramClear(len))
      {
        result = false;
      }
    }
  }
  return result;
}