mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox <barebox@lists.infradead.org>
Subject: barebox MIPS start code considerations
Date: Tue, 5 Jul 2011 13:47:10 +0400	[thread overview]
Message-ID: <CAA4bVAFm647J0G_gHR-MgmNbneBsLdFVvKYJt+1WgO2saqm_hg@mail.gmail.com> (raw)

Hi!

Here is my barebox MIPS start code considerations.
If you get the time would you please review this text.


Barebox normally must be linked to RAM region, cached region KSEG0 is preferred.
This make possible to run fast (because cache used) and skip MMU support.

After reset MIPS CPU starting to fetch instructions from 0xBFC00000.

This remark from ARM code can be used for MIPS start.S:
----
Code running immediately after reset runs at an address it is not linked
to: "runtime address != link address". You should only use branches and
do not refer to fixed data. This implies the use of assembler code only.
After MIPS CPU reset cache and MMU are in random state. They are unusable.
----

barebox MIPS initialisation sequence:

 * set the CP0 STATUS register to some known and sensible state.
Now you can load and store reliably in uncached space.

 * call a function \<mach_init_lowlevel\> (if not disabled).
do some special things required only on specific CPU
 (e. g. init RAM controller, disable watchdog)

 * call a function \<board_init_lowlevel\> (if not disable).
do some special things required only on specific board
 (e. g. setup GPIO to required state).

   ** It is desirable to have some debug code to make some contact
 with the outside world from assembler code
(e.g. debug_ll-like functions to write to rs232 console).

 * check integity of barebox RAM execute location;
 * copy barebox to RAM execute location;

 * configure cache;

 * setup stack;

   ** after ths point you can call a standard C routine.

 * setup exception vectors in RAM;
 * setup CP0 STATUS to switch exception vector address to RAM;

 * call start_barebox()

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2011-07-05  9:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAA4bVAFm647J0G_gHR-MgmNbneBsLdFVvKYJt+1WgO2saqm_hg@mail.gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@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