Skip to main content

<alp/storage.h> — Block Storage

Generic block storage over flash, eMMC, or SD. Optional inline AES encryption on AEN SecAES targets.

#include <alp/storage.h>

Read / write a block

alp_storage_t *st = alp_storage_open(&(alp_storage_config_t){
.device = ALP_STORAGE_DEVICE_OSPI_FLASH,
});

uint8_t block[256];
alp_storage_read(st, /* offset */ 0x1000, block, sizeof(block));
alp_storage_write(st, 0x1000, block, sizeof(block));

alp_storage_close(st);

Inline AES (AEN OSPI / HexSPI)

On AEN's OSPI / HexSPI controllers, inline AES decryption can be enabled at storage open time:

alp_storage_t *st = alp_storage_open(&(alp_storage_config_t){
.device = ALP_STORAGE_DEVICE_OSPI_FLASH,
});

alp_storage_inline_aes_t aes = {
.key_slot = 0,
.iv = { /* 16 bytes */ },
};
alp_storage_configure_inline_aes(st, &aes);

After this, reads return decrypted data transparently. Useful for protected firmware images and credential blobs.

File systems

For higher-level access, enable littlefs in board.yaml's libraries: array and mount via Zephyr's filesystem API or Yocto's standard mount.

See also

Questions about this page? Discuss in Community Forum