From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: v7-M: Fixing XIP when the kernel is in ROM
Date: Tue, 27 Oct 2015 22:40:19 +0000 [thread overview]
Message-ID: <20151027224019.GI8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20151027212020.GL4931@pengutronix.de>
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@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.
So, it's pointless proc-v7m.S saving and restoring the stack pointer
around this. It also means that there probably isn't a reliable
stack here.
--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2015-10-27 22:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-26 1:27 v7-M: Fixing XIP when the kernel is in ROM Ezequiel Garcia
2015-10-26 8:05 ` Uwe Kleine-König
2015-10-26 13:12 ` Ezequiel Garcia
2015-10-27 15:35 ` Ezequiel Garcia
2015-10-27 16:03 ` Maxime Coquelin
2015-10-27 20:25 ` Maxime Coquelin
2015-10-27 20:33 ` Stefan Agner
2015-10-27 21:33 ` Maxime Coquelin
2015-10-27 21:46 ` Ezequiel Garcia
2015-10-27 21:52 ` Maxime Coquelin
2015-10-27 22:08 ` Ezequiel Garcia
2015-10-28 7:43 ` Uwe Kleine-König
2015-11-03 17:52 ` Chris Brandt
2015-11-03 20:09 ` Uwe Kleine-König
2015-11-03 20:30 ` Russell King - ARM Linux
2015-10-27 20:21 ` Uwe Kleine-König
2015-10-27 20:57 ` Ezequiel Garcia
2015-10-27 21:20 ` Uwe Kleine-König
2015-10-27 22:40 ` Russell King - ARM Linux [this message]
2015-10-28 7:34 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151027224019.GI8644@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).