v7-M: Fixing XIP when the kernel is in ROM
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Wed Oct 28 00:34:58 PDT 2015
Hello Russell,
On Tue, Oct 27, 2015 at 10:40:19PM +0000, Russell King - ARM Linux wrote:
> On Tue, Oct 27, 2015 at 10:20:20PM +0100, Uwe Kleine-König wrote:
> > Hello Ezequiel,
> >
> > On Tue, Oct 27, 2015 at 05:57:46PM -0300, Ezequiel Garcia wrote:
> > > On 27 October 2015 at 17:21, Uwe Kleine-König
> > > <u.kleine-koenig at pengutronix.de> wrote:
> > > > Hello Ezequiel,
> > > >
> > > > On Sun, Oct 25, 2015 at 10:27:10PM -0300, Ezequiel Garcia wrote:
> > > >> I've been trying to make my ARM v7-M LPC43xx board
> > > >> boot a XIP kernel from flash. Currently, this seems
> > > >> to be broken in mainline due to this:
> > > >>
> > > >> arch/arm/mm/proc-v7m.S
> > > >> [..]
> > > >> @ SVC to run the kernel in this mode
> > > >> badr r1, 1f
> > > >> ldr r5, [r12, #11 * 4] @ read the SVC vector entry
> > > >> str r1, [r12, #11 * 4] @ write the temporary SVC vector entry
> > > >> mov r6, lr @ save LR
> > > >> mov r7, sp @ save SP
> > > >> ldr sp, =__v7m_setup_stack_top @ <<< Breaks XIP!
> > > >
> > > > How does this fail for you?
> > > >
> > >
> > > My CPU just seems to stall.
> > > I've added calls to the printch in arch/arm/kernel/debug.S
> > > and can't get past the SVC call.
> > Can you try to add something like:
> >
> > stmdb sp!, {r0-r4}
>
> Wait one moment, and try reading the code.
>
> The call path to this point is: entry text at stext in head-nommu.S
> which goes on to call __v7m_setup.
>
> Nothing in that path sets up a stack, so the value of 'sp' is
> undefined - it's entirely whatever's left in the register after the
> boot loader has passed control to the kernel.
Yeah, that's what I found, too. With this test I want to find out if
it's really the write to ROM memory that makes the machine hang.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the linux-arm-kernel
mailing list