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

Bootloader & flasher for QPI external flash #3

Open
2 of 5 tasks
willemml opened this issue Jun 26, 2021 · 13 comments
Open
2 of 5 tasks

Bootloader & flasher for QPI external flash #3

willemml opened this issue Jun 26, 2021 · 13 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@willemml
Copy link
Member

willemml commented Jun 26, 2021

Need to finish QSPI flash and then create a boot loader so RustWorks can be flashed to external flash.
Potentially useful links:

Todo:

  • Read external flash
  • Write external flash
  • Flash algorithm implementation so that cargo flash can access external flash (done in willemml/rsworks-flash-algo)
  • Make probe-rs and cargo-embed use flash algorithm
  • Enable writing external flash using dfu-util
@willemml willemml added enhancement New feature or request help wanted Extra attention is needed labels Jun 26, 2021
@willemml willemml changed the title BootLoader for external flash Boot loader for external flash Jun 26, 2021
@willemml willemml changed the title Boot loader for external flash External Flash support Jun 26, 2021
@willemml
Copy link
Member Author

willemml commented Jul 5, 2021

As of ab41166 reading external flash seems to work correctly, but writing to it and erasing it does not. Unsetting memory mapped mode no longer causes a crash.

@willemml
Copy link
Member Author

willemml commented Jul 5, 2021

Note that external flash is actually supposed to be read as 32 bit integers, not individual bytes. This is shown (working) in a3d80ab.

@rfuest
Copy link
Contributor

rfuest commented Jul 5, 2021

One issue I noticed in external_flash.rs is that you use self.qspi.cr.write instead of modify in send_command_full, which will some settings to their reset value.

@willemml
Copy link
Member Author

willemml commented Jul 5, 2021

Hmm, I tried using modify instead of write for cr but now attempts to write memory cause the calculator to either crash or freeze (without reseting, so I am going to assume it is waiting for the abort).

@willemml
Copy link
Member Author

willemml commented Jul 5, 2021

For reference, here are the changes I made:

self.qspi.cr.write(|w| w.abort().set_bit());

to

self.qspi.cr.modify(|_, w| w.abort().set_bit());

and then I also tried

self.qspi.cr.write(|r, w| unsafe { w.bits(r.bits()) }.abort().set_bit());

@willemml willemml pinned this issue Jul 5, 2021
@willemml
Copy link
Member Author

willemml commented Jul 7, 2021

Thanks to #8 all that is left is to create a bootloader that also allows flashing of the QPI external flash via tools such as probe-rs and dfu-util.

@willemml willemml changed the title External Flash support Bootloader & flasher for QPI external flash Jul 7, 2021
@willemml
Copy link
Member Author

willemml commented Jul 13, 2021

There is a boot loader project called loadstone that looks interesting and is probably worth exploring...

EDIT:
Might be worth waiting for loadstone to directly use embedded-hal to make porting it to stm32f730 easier if the loadstone route is taken.
Will continue to explore alternative methods of using external flash for main program storage.

@willemml
Copy link
Member Author

willemml commented Jul 15, 2021

Flash algo attempt (fixed by rfuest in nw-rs/flash-algo#1): https://github.com/willemml/rsworks-flash-algo

@naveenprasathc
Copy link

Do you still have the issue?
I have worked on QSPI flash drivers, I can help if needed.

@willemml
Copy link
Member Author

Currently the only things left to do are to allow probe-run to use the flash also (so add a command line argument to take custom chip definition yaml, which needs to be done in the probe-run repo), add dfu support and a boot loader.

@willemml
Copy link
Member Author

willemml commented Aug 5, 2021

@npc15 if you have any tips (or want to help with) creating a dfu bootloader (or even just a bootloader in general for the QSPI flash) it would be greatly appreciated, my current blocker is moving the code off of internal flash and onto QSPI (the end goal being to have the bare minimum on the internal flash).

@naveenprasathc
Copy link

@npc15 if you have any tips (or want to help with) creating a dfu bootloader (or even just a bootloader in general for the QSPI flash) it would be greatly appreciated, my current blocker is moving the code off of internal flash and onto QSPI (the end goal being to have the bare minimum on the internal flash).

Ok sure,
will give you an update soon

@willemml
Copy link
Member Author

As of 5a52fe6 DFU flashing of external flash works, booting not yet implemented.

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

No branches or pull requests

3 participants