Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI/flash access functions #45

Open
mchack-work opened this issue Apr 25, 2024 · 4 comments
Open

SPI/flash access functions #45

mchack-work opened this issue Apr 25, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@mchack-work
Copy link
Member

With an SPI master on some TKey versions (tillitis/tillitis-key1#213) we need some easy way of accessing SPI and the flash chip.

We will probably create a new library, something like libspi.a, and include it in tkey-libs.

@mchack-work mchack-work added the enhancement New feature or request label Apr 25, 2024
@dehanj
Copy link
Member

dehanj commented Apr 25, 2024

As you say we should have a lib for the SPI API.
How should we handle the API for the flash memory? Should it be part of tkey-libs? Live outside of tkey-libs?

@mchack-work
Copy link
Member Author

I think all the addresses needed to access the SPI should be included in tk1_mem.h, as per usual. I don't think they should be optionally compiled. Instead, I think we want some way to detect during runtime if the SPI master is enabled on the running hardware or not.

I propose low-level functions to use the actual SPI access addresses should be included in libspi.a, as well as higher level functions that are easily used by a developer to access the flash.

@dehanj
Copy link
Member

dehanj commented Apr 25, 2024

Agree, no optional building. It will be removed during linking if not used.

To summaries:
We want both the low-level functions such as
spi_read(..)
as well as the high level flash access functions, such as
flash_get_manufacturing_id(..)
in libspi.a
Do I interpret you right?

@mchack-work
Copy link
Member Author

You could, I guess, argue that flash_* should live in a separate libflash.a that depends on functions in a libspi.a. I don't have any strong opinion if this is good or bad right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants