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

EEPROM #100

Open
karniv00l opened this issue May 5, 2021 · 4 comments
Open

EEPROM #100

karniv00l opened this issue May 5, 2021 · 4 comments

Comments

@karniv00l
Copy link

Hi there, thanks for all the great work!

I can't seem to find any information about reading and writing from / to EEPROM. Is this something that is on the roadmap, or am I looking in the wrong place?

Thanks

@mciantyre
Copy link
Owner

Thanks for checking out the project. There's no EEPROM emulation in today's BSP. You're the first to ask about it, and there hasn't been a plan to add it until someone would use it.

I'm happy to mentor you or anyone in contributing a FlexSPI driver, and EEPROM emulation based on that driver.

@karniv00l
Copy link
Author

Unfortunately I have very little experience with embedded world and with Rust, although I am interested in how one would go about developing such a functionality.

I believe this is implemented here: https://github.com/PaulStoffregen/cores/blob/master/teensy4/eeprom.c and this should be used as a reference while porting?


I came across this library while researching components for a future hobby project that can be written in Rust. I think Teensy is a great platform and having good tooling and libraries is essential.

I hope I can help in some way.

@mciantyre
Copy link
Owner

Yup, the EEPROM module may be a good reference implementation. We'll notice that we're using the FlexSPI peripheral throughout that code to emulate EEPROM memory. The i.MX RT reference manual describes how the peripheral works. Rather than using macros for registers, we could use the imxrt-ral crate, which already exports the FlexSPI registers.

If you want something working quickly, it might be easier to integrate the EEPROM code directly into the BSP, then create a Rust wrapper around the C code. c0f1fcd shows what that might look like.

@dstric-aqueduct
Copy link

Hi all - I attempted to modify Ian's proto/eeprom branch to add support for the Teensy 4.1.

You can see my updates here: https://github.com/dstric-aqueduct/teensy4-rs/tree/proto/eeprom

The steps taken were:

  1. Modify the bin/eeprom.c file to include board specific memory offsets and sizes.
  2. Modify the Makefile bin/Makefile to include board specific CPPFLAG options for compiling. The resulting library .a files are located in bin/.
  3. Modify the /teensy4-fcb/src/lib.rs to change the flash_size (see bootdata.c).
  4. Add a feature flag (t41) for board specific building using two new linker files.

Building for both boards is successful, but data written to the Teensy 4.1 does not persist between power cycles. I'm wondering if anyone can spot my error?

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

No branches or pull requests

3 participants