title: define two execution regions on arm9
body: <p>I am using ARM 9, all code stored on flash.
  Flash contains booter (boot loader) and two load regions.</p>
  
  <p>How can I build my binary so I can use <strong>same</strong> binary and be able to store it in load region 1 or load region 2?</p>
  
  <p>Using the scatter file I configured load regions and execution regions.
  The output binary works ok if I load the binary to from load region 1.</p>
  
  <p>However if binary is placed in flash to into load region 2, I face a problem.
  This is because the binary contains the outcome of the scatter file, with absolute address matching the load region 1. So when scatter loading begins, arm will access address from region 1 instead of loading from region 2.</p>
  
  <p>I read about PI (position independence) option but don't know how it helps.</p>
  
  <p>PS. My application support sw upgrade, i can load from region 1, 
  but if i need to upgrade, then i download new binary to load region 2 and load from image 2. next upgrade i will download the new image into region 1, and load from image 1, etc..</p>
  
  <p>flash has next load regions:
  LR0: not important.<br>
  LR1: 0x8100000, size: yyy (this is load region 1).<br>
  LR2: 0x8200000, size: yyy (this is load region 2).</p>
  
  <p>By default i load from LR1 (this is the application).<br>
  For SW upgrade i download the image to LR2.<br>
  Now i want this image to load from LR2.<br>
  I image is linked to load from LR2 - then no problem (since addressed match this region).<br>
  However i dont know ahead if image will be stored in LR1 or LR2, and hence the problem.<br></p>
  
  <p>Thanks in advance.</p>