Skip to content

Zephyr: generate flash.bin for native_sim with state information (storage partition) #153

@casaroli

Description

@casaroli

Narrative

As the Ocre developer with native_sim, I want the "preload images" feature to work just as with a real board, so that we can test demo in the CI

Description

When we build Zephyr firmware for supported boards, we generate the state information (storage_partition) with the preloaded images.

When native_sim is run, it will look for a flash.bin file in the current directory, which will be mapped as the flash controller image. If this is not found, it will create it automatically (however, it does not include the storage_partition.

TODO

  • Similar to how we generate merged.hex we should generate flash.bin with the storage partition in place.
  • Figure out the format and location of storage partition in flash.bin (hopefully it is at 0x0?)
    • TIP: run supervisor, then ocre pull some images, stop Zephyr, then inspect flash.bin in a hex editor, use python-littlefs to access the littlefs partition files in flash.bin
  • Add to CMakeLists.txt the commands to generate flash.bin if board name starts with native_sim
    • TIP: can we use dd?

Acceptance Criteria

  • Build Zephyr demo with native_sim
    • flash.bin created somewhere in the build directory
    • Zephyr demo runs properly
  • Build Zephyr supervisor with native_sim, pass some containers with OCRE_PRELOAD_IMAGES or OCRE_SDK_PRELOAD_IMAGES
    • flash.bin created somewhere in the build directory
    • Zephyr supervisor runs properly
    • ocre image ls will show the preloaded images

Bonus

  • Add native_sim and native_sim/native/64 to run demo sample on the CI for every PR

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions