<div dir="ltr">Hi,<br><br>This question is not directly related to linux, but a question on how to execute code from.<br><br>My test code is as follows..<br><br>void ram(unsigned int cat) __attribute__ ((section(&quot;.ram_code&quot;)));<br>
void ram1(void) __attribute__ ((section(&quot;.ram_code&quot;)));<br>void flash(void) __attribute__ ((section(&quot;.text&quot;)));<br>void flash1(unsigned int y) __attribute__ ((section(&quot;.text&quot;)));<br><br>void ram(unsigned int cat)<br>
{<br>&nbsp;&nbsp;&nbsp; unsigned int abc;<br><br>&nbsp;&nbsp;&nbsp; abc += 12;<br>&nbsp;&nbsp;&nbsp; abc += cat;<br>}<br><br>void ram1(void)<br>{<br>&nbsp;&nbsp;&nbsp; ram(123);<br>}<br><br><br>void flash1(unsigned int y)<br>{<br>&nbsp;&nbsp;&nbsp; unsigned int x;<br><br>&nbsp;&nbsp;&nbsp; x = x + y;<br><br>}<br>
<br>void flash(void)<br>{<br>&nbsp;&nbsp;&nbsp; unsigned int def;<br><br>&nbsp;&nbsp;&nbsp; def += 12;<br><br>&nbsp;&nbsp;&nbsp; asm (&quot; bel ram1\n\t&quot;);<br>}<br><br>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&#39;s internal FLASH, starting at 0x00000000.<br>
<br>When I attempt to link the code together,&nbsp; I get the error <br><br>U:\src\applications\comms/fatdog.c(35,1): relocation truncated to fit: R_PPC_REL24 against symbol `ram1&#39; defined in .ram_code section in U:\src\applications\comms\fatdog.o<br>
<br>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.<br><br>Other than assembler bel instruction, I have also tried bl, b and bea and all of them gave the same link error.<br>
<br>I was wondering if anyone can give some insight on how I can get the MPC55xx to branch between FLASH and SRAM?<br><br>Many thanks,<br>Tehn Yit Chin<br><br></div>