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

Booting from RAM #25

Closed
mateusz-holenko opened this issue Oct 2, 2019 · 2 comments
Closed

Booting from RAM #25

mateusz-holenko opened this issue Oct 2, 2019 · 2 comments

Comments

@mateusz-holenko
Copy link

@xobs I was recently working on a support for foboot in Renode. The current master, available on github supports Fomu platform capable of running foboot and booting software uploaded from host using dfu-util. The setup requires exporting virtual fomu device from Renode to the host system using USB/IP and from that moment on you interact with it the same way as with the real board.

During my adventure I tested two scenarios:

  • downloading software to the flash (works fine),
  • downloading it directly to RAM (had some problems).

As I understood from the sources, in order to direct the image to the RAM memory it must begin with a magic sequence followed by the address where this image should be stored.
What makes me wonder is that the whole image, inluding the magic sequence and the address, is written to RAM and then on reboot the CPU starts from it.

It seems to me that the first instruction CPU executes after reboot is the magic sequence. Shouldn't the start address be shifted by 8 to skip the metadata?

@xobs
Copy link
Member

xobs commented Oct 2, 2019

@mateusz-holenko The magic sequence must exist within the first 64 bytes. You don't want to place it at the start, since you're right that would cause it to execute the magic sequence as an opcode. It's documented somewhat in https://github.com/im-tomu/foboot/blob/master/doc/BOOT-SEQUENCE.md#ram-boot

Instead, you should place it a few words after the start, similar to how flags are implemented at

@mateusz-holenko
Copy link
Author

I see. I wasn't precise enough - it's clear from the source code that the magic does not have to be exactly at the beginning of the image.
I simply didn't recognize the implications of this fact and the possibility to add a jump instruction before the magic - my bad.

Thanks for the clarification!

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

2 participants