1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<title>RSO Sample Demo - LinkMem2</title> 9</head> 10 11<body> 12 13<H1>RSO Sample Demo - LinkMem2</H1> 14 15<H2>Location</H2> 16<p><code>$REVOLUTION_SDK_ROOT/build/demos/rsodemo/LinkMem2</code></p> 17 18<H2>Overview</H2> 19<p> 20Demo program showing allocation of a relocatable module to the external main memory (MEM2 area).<br>Module E (<code>e.rso</code>) allocated to the external main memory and module F (<code>f.rso</code>) allocated to the internal main memory are set to call functions from each other. 21</p> 22 23<H2>Description</H2> 24<p> 25Typically, the branch instructions (bx) only hold the 28-bit additions (±32MB). Therefore, when a relocatable module is placed in external main memory (<CODE>MEM2</CODE>), functions in internal main memory (<CODE>MEM1</CODE>) cannot be accessed. To avoid this, instruct the compiler to use 32-bit absolute address branching, using pragma. 26</p> 27<p> 28When module E is placed in <CODE>MEM2</CODE>, the static module function (such as <code>OSReport</code>) and a function from module F in <CODE>MEM1</CODE> (<code>IsFThere</code>) must be set as a branch, using the 32-bit absolute address.<br>For this reason, the sample program will set those functions as 32-bit absolute address branches when called within module E, as follows: 29</p> 30<TABLE border="1" width="100%"> 31 <TBODY> 32 <TR> 33 <TD width="100%"> 34 <PRE><CODE> 35// from e.c source 36#pragma section code_type ".text" data_mode=far_abs code_mode=far_abs 37#pragma section RX ".init" ".init" data_mode=far_abs code_mode=far_abs 38 39#include <revolution.h> 40 41#include "f.h" 42 43#pragma section code_type ".text" data_mode=far_abs code_mode=pc_rel 44#pragma section RX ".init" ".init" data_mode=far_abs code_mode=pc_rel 45</CODE></PRE> 46 </TD> 47 </TR> 48 </TBODY> 49</TABLE> 50<p> 51Also, because module F calls a module E function (<code>IsEThere</code>), they are set as follows: 52</p> 53<TABLE border="1" width="100%"> 54 <TBODY> 55 <TR> 56 <TD width="100%"> 57 <PRE><CODE> 58// from f.c source 59#pragma section code_type ".text" data_mode=far_abs code_mode=far_abs 60#pragma section RX ".init" ".init" data_mode=far_abs code_mode=far_abs 61 62#include "e.h" 63 64#pragma section code_type ".text" data_mode=far_abs code_mode=pc_rel 65#pragma section RX ".init" ".init" data_mode=far_abs code_mode=pc_rel 66</CODE></PRE> 67 </TD> 68 </TR> 69 </TBODY> 70</TABLE> 71<p> 72Note as of 06/15/2006<br>Certain runtime codes may not be properly called in the 32-bit codes in the release version.<br>As a temporary remedy, use_lmw_stmw pragma is currently applied to avoid the use of those runtime codes.<br>This is applied to modules placed in the external main memory.<br> 73 74One example where this is used is <code>e.c</code>.<br>The same goes for the compile option <code>-use_lmw_stmw on</code>.<br> 75</p> 76<TABLE border="1" width="100%"> 77 <TBODY> 78 <TR> 79 <TD width="100%"> 80 <PRE><CODE> 81// from e.c source 82#pragma use_lmw_stmw on 83</CODE></PRE> 84 </TD> 85 </TR> 86 </TBODY> 87</TABLE> 88<H2>See Also</H2> 89<p> 90<a href="./demos.html">Demo Program List</a><br> <code><a href="../RSOListInit.html">RSOListInit</a></code>, <code><a href="../RSOLinkList.html">RSOLinkList</a></code>, <code><a href="../RSOUnLinkList.html">RSOUnLinkList</a></code>, <code><a href="../RSOFindExportSymbolAddr.html">RSOFindExportSymbolAddr</a></code>, <code><a href="../RSOIsImportSymbolResolvedAll.html">RSOIsImportSymbolResolvedAll</a></code>, 91</p> 92<H2>Revision History</H2> 93<p>06/14/2006 Initial version.</p> 94 95<hr> 96<p align="right"><strong>CONFIDENTIAL</strong></p> 97 98</BODY> 99</HTML> 100