linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Tehn Yit Chin" <tehn.yit.chin@gmail.com>
To: linuxppc-embedded@ozlabs.org
Subject: jumping to code in RAM in a MPC55xx
Date: Fri, 18 Jul 2008 16:29:34 +1000	[thread overview]
Message-ID: <bf04f99c0807172329m7ec94580n194e02b708bf7597@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

Hi,

This question is not directly related to linux, but a question on how to
execute code from.

My test code is as follows..

void ram(unsigned int cat) __attribute__ ((section(".ram_code")));
void ram1(void) __attribute__ ((section(".ram_code")));
void flash(void) __attribute__ ((section(".text")));
void flash1(unsigned int y) __attribute__ ((section(".text")));

void ram(unsigned int cat)
{
    unsigned int abc;

    abc += 12;
    abc += cat;
}

void ram1(void)
{
    ram(123);
}


void flash1(unsigned int y)
{
    unsigned int x;

    x = x + y;

}

void flash(void)
{
    unsigned int def;

    def += 12;

    asm (" bel ram1\n\t");
}

I have the section .ram_code mapped into the internal SRAM of the MPC55xx,
which starts at 0x40000000. Code in .text are mapped into MPC55xx's internal
FLASH, starting at 0x00000000.

When I attempt to link the code together,  I get the error

U:\src\applications\comms/fatdog.c(35,1): relocation truncated to fit:
R_PPC_REL24 against symbol `ram1' defined in .ram_code section in
U:\src\applications\comms\fatdog.o

I googled the error and I think it means that the ram1() is too far away and
the branch address has been truncated to fit into the binary.

Other than assembler bel instruction, I have also tried bl, b and bea and
all of them gave the same link error.

I was wondering if anyone can give some insight on how I can get the MPC55xx
to branch between FLASH and SRAM?

Many thanks,
Tehn Yit Chin

[-- Attachment #2: Type: text/html, Size: 1857 bytes --]

             reply	other threads:[~2008-07-18  6:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  6:29 Tehn Yit Chin [this message]
2008-07-20 23:22 ` jumping to code in RAM in a MPC55xx Tehn Yit Chin

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=bf04f99c0807172329m7ec94580n194e02b708bf7597@mail.gmail.com \
    --to=tehn.yit.chin@gmail.com \
    --cc=linuxppc-embedded@ozlabs.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).