Hi,

we’re using Onomondo and they currently offer softsim support for the nrf9160 (https://github.com/onomondo/nrf-softsim/).

We’re struggling to get it working on the feather. Is there any reason as to why this shouldn’t work on the feather?

/Kristian

jaredwolff changed the title to Feather and softsim .

@kgrimsby i have not played with the soft SIM. I know the nRF9161 has some more specifics around that but I also seem to recall it can be done on the latest modem firmware.

If you purchased a nRF9160 Feather recently then you have v1.3.5. If not you may need to upgrade it either using a Tag Connect or these instructions.

Without understanding why, it failes at the assert here:

int init_fs() {
  if (fs_is_initialized) return 0;  // already initialized

  ss_list_init(&fs_cache);
  uint8_t *data = NULL;
  size_t len = 0;

  fs.flash_device = NVS_PARTITION_DEVICE;
  fs.sector_size = 0x1000;  // where to read this? :DT_PROP(NVS_PARTITION,  erase_block_size);  //<0x1000>
  fs.sector_count = FLASH_AREA_SIZE(nvs_storage) / fs.sector_size;
  fs.offset = NVS_PARTITION_OFFSET;

  int rc = nvs_mount(&fs);
  if (rc) {
    LOG_ERR("failed to mount nvs\n");
    return -1;
  }

  rc = nvs_read(&fs, DIR_ID, NULL, 0);

  len = rc;

  /*************************
   * Read DIR_ENTRY from NVS
   * This is used to construct a linked list that
   * serves as a cache and lookup table for the filesystem
   */
  if (!data && rc) {
    data = SS_ALLOC_N(len * sizeof(uint8_t));
    rc = nvs_read(&fs, DIR_ID, data, len);
    __ASSERT_NO_MSG(rc == len);
  }

  ss_list_init(&fs_cache);
  generate_dir_table_from_blob(&fs_cache, data, len);

  if (ss_list_empty(&fs_cache)) goto out;

  fs_is_initialized++;

out:
  free(data);
  return ss_list_empty(&fs_cache);
}

So something “wrong” with the NVS storage?

It’s terminated on the line __ASSERT_NO_MSG(rc == len);. So basically because rc ≠ len.

I’ve inspected the returns from rc = nvs_read(&fs, DIR_ID, NULL, 0); (returns -2) and rc = nvs_read(&fs, DIR_ID, data, len) (returns -22). The last error 22 makes sense since it’s trying to read -2 length.

ASSERTION FAIL [rc == len] @ WEST_TOPDIR/modules/lib/onomondo-softsim/lib/fs_port.c:80

Not exactly sure here. NVM, by default, uses a partition in flash. You should make sure that flash write is enabled. The config variable begins with CONFIG_FLASH.

Otherwise you may have to reach out to the SIM provider or Nordic Semiconductor for more information on how their code works.

From my understanding it is supposed to be something located there from when i flash the image, but it doesn’t seem to be stored during flash. But this is way out of my depth and understanding.

add_subdirectory_ifdef(CONFIG_SOFTSIM lib)

set(ONOMONDO_SOFTSIM_BASE_ADDRESS $<TARGET_PROPERTY:partition_manager,PM_NVS_STORAGE_ADDRESS>)
set(ONOMONDO_SOFTSIM_TEMPLATE_OUTPUT ${CMAKE_BINARY_DIR}/onomondo-softsim/template.hex)

if(CONFIG_SOFTSIM)

add_custom_command(
  OUTPUT template.hex
  COMMAND ${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/bin/arm-zephyr-eabi-objcopy
  --input-target=binary
  --output-target=ihex
  --change-address ${ONOMONDO_SOFTSIM_BASE_ADDRESS}
  ${CMAKE_CURRENT_LIST_DIR}/lib/profile/template.bin
  ${ONOMONDO_SOFTSIM_TEMPLATE_OUTPUT}
  BYPRODUCTS ${ONOMONDO_SOFTSIM_TEMPLATE_OUTPUT} # This is needed for Ninja
)
add_custom_target(onomondo_softsim_template DEPENDS template.hex)

if(CONFIG_SOFTSIM_BUNDLE_TEMPLATE_HEX)
  set_property(
    GLOBAL PROPERTY
    nvs_storage_PM_HEX_FILE
    ${ONOMONDO_SOFTSIM_TEMPLATE_OUTPUT}
  )

  set_property(
    GLOBAL PROPERTY
    nvs_storage_PM_TARGET
    onomondo_softsim_template
  )
endif()
endif()

Refers to template and that is supposed to be located in NVS at “first” boot?

Anyway, thanks for the help - it was worth a shot at least 🙂

Terms and Conditions | Privacy Policy