<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(".ram_code")));<br>
void ram1(void) __attribute__ ((section(".ram_code")));<br>void flash(void) __attribute__ ((section(".text")));<br>void flash1(unsigned int y) __attribute__ ((section(".text")));<br><br>void ram(unsigned int cat)<br>
{<br> unsigned int abc;<br><br> abc += 12;<br> abc += cat;<br>}<br><br>void ram1(void)<br>{<br> ram(123);<br>}<br><br><br>void flash1(unsigned int y)<br>{<br> unsigned int x;<br><br> x = x + y;<br><br>}<br>
<br>void flash(void)<br>{<br> unsigned int def;<br><br> def += 12;<br><br> asm (" bel ram1\n\t");<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's internal FLASH, starting at 0x00000000.<br>
<br>When I attempt to link the code together, I get the error <br><br>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<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>