On Wed, 3 Apr 2024 at 23:40, Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> On 4/3/24 08:15, Gautam Bhat wrote:
> > Here simple_test.bin is the raw binary file converted using objcopy.
> > addr=0xFFFE is the vector location where the PC will load with the
> > starting address.
> >
> > Now how do I load the address in that reset vector location and set my
> > PC? Is there some example code that I can look at?
>
> Hmm.  I can't find an example.  I see a TODO for m68k which *should* be 
> loading the pc
> from the reset vector on reset.

Arm M profile does this.

> The loader device populates ram during the reset hold phase, so I believe you 
> need to wait
> until after that is complete to perform the load, thus the reset_exit hook.

This will not work (yet) -- CPUs do not get reset as part of the
whole-system three-phase-reset, so using the exit phase method
is not sufficient to avoid the reset ordering problem here.

You need to use rom_ptr_for_as() to see if there's a ROM blob
at the address you're trying to load the PC from, and if there
is you use ldl_p() to get the PC from the blob; otherwise you
use ldl_phys(). Searching for "initial_pc" in target/arm/cpu.c
will find you the code that does this for M-profile.

thanks
-- PMM

Reply via email to