OpenAMP / openamp-system-reference

End-to-end system reference material showcasing all the different aspects of OpenAMP, on multiple vendor platforms.
Other
16 stars 15 forks source link

fw_load example might be broken #62

Open GbGp opened 2 weeks ago

GbGp commented 2 weeks ago

The remoteproc_ops::mmap operation is supposed to work with either physical address or destination address input arguments, as documented in the docs.

On the other ways, any implementation of mmap in the the fw_load app will simply pass only the physical address to metal_io_init: https://github.com/OpenAMP/openamp-system-reference/blob/main/examples/legacy_apps/examples/load_fw/zynqmp_apu_lcm_rproc_example.c#L94

As I see, this will always results in a mapping failure since, in this app, remoteproc.c will call mmap passing RPROC_LOAD_ANYADDR (==METAL_BAD_PHYS) as physical address: https://github.com/OpenAMP/open-amp/blob/main/lib/remoteproc/remoteproc.c#L593

Since I am running the example in a baremetal system, I could get away with simply letting the mmap fail, and setting the the physical address to destination address (i.e. setting *pa = lda before returning).

I am not really familiar with this topics, so maybe I am misunderstanding everything, but something seems to be missing here.

GbGp commented 2 weeks ago

It looks like that replacing the mmap implementation in zynqmp_apu_lcm_rproc_example.c with the one found here works well:

https://github.com/OpenAMP/open-amp/blob/main/apps/machine/zynqmp_r5/zynqmp_r5_a53_rproc.c#L124