Synopsis
int libmem_rpc_loader_start_ex(void *comm_buffer_start,
                               void *comm_buffer_end,
                               uint32_t options);
Description

comm_buffer_start — A pointer to the start of an area of RAM that can be used by the host to store data passed to the remotely called libmem functions.

comm_buffer_end — A pointer to the last byte of the of an area of RAM that can be used by the host to store data passed to the remotely called libmem functions.

options — This parameter is usually 0, but can be used to enable different loader behaviour by specifying a combination of the following loader options:

libmem_rpc_loader_start_ex returns — The last error result returned from a LIBMEM function or LIBMEM_STATUS_SUCCESS if there has been no error.

This function is the same as libmem_rpc_loader_start except that it allows a loader option parameter to be specified.

Example:

static unsigned char buffer[256];

int main(void)
{
  uint8_t *flash1_start = (uint8_t *)0x10000000;
  const int flash1_max_geometry_regions = 4;
  libmem_driver_handle_t flash1_handle;
  libmem_geometry_t flash1_geometry[flash1_max_geometry_regions];
  libmem_flash_info_t flash1_info;
  int res;

  // Register FLASH driver.
  res = libmem_register_cfi_driver(&flash1_handle, 
                                   flash1_start,
                                   flash1_geometry,
                                   flash1_max_geometry_regions, 
                                   &flash1_info);

  if (res == LIBMEM_STATUS_SUCCESS)
    {
      // Run the loader 
      libmem_rpc_loader_start_ex(buffer,
                                 buffer + sizeof(buffer) - 1,
                                 LIBMEM_LOADER_OPTION_HOST_WRITE | 
                                 LIBMEM_LOADER_OPTION_HOST_ERASE);
    }

  libmem_rpc_loader_exit(res, NULL);

  return 0;
}