title: Bootloader location in memory
body: <p>Is there a way to make the bootloader code occupy a specific section in program memory?</p>
  
  <p>I noticed that some of the code is written in the top section of memory but the other part is written starting at section $11000. In my case it conflicts with my application code. So how do I force the bootloader code to occupy program memory starting from $00000 to $10000? I am assuming it can be done by changing some settings under Mplab XC8 compiler. </p>
  
  <p>PIC: PIC18F87J11</p>
  
  <p>Compiler: MPLAB XC8 </p>
  
  <p><strong>Update:</strong> </p>
  
  <p>Found the fix </p>
  
  <p>Project properties > XC8 global options category > Memory Model > ROM ranges</p>
  
  <p>ROM RANGE: 0-10000</p>
  
  <p><strong>Update:</strong> </p>
  
  <p>I am seeing another issue though.</p>
  
  <p>So I set the ROM range from <strong>$00000-$10000</strong>, but that's not enough space for the bootloader code even though it should. However when I look at the program memory under MPLAB XC8 after building the project, I noticed that there are some addressees left empty.</p>
  
  <p>How do I force those addressees to be used? If those sections were used then the specified ROM size from 0-10000 should be enough for my bootloader code.</p>
  
  <p>For example those addresses are used (data written there)</p>
  
  <p><strong>00000-0925C</strong></p>
  
  <p>But then these address are not used, just left blank</p>
  
  <p><strong>0925E- 0F77A</strong> (huge section, what a waste)</p>
  
  <p>Then these addresses are used</p>
  
  <p><strong>0F77C-0FFFE</strong></p>
  
  <p>But then my program gets cut off at $10000 even though there seems to be more code to be written to memory.</p>
  
  <p>So</p>
  
  <p>How do I force those unused addressee to be used? Its just a huge waste of memory to skip them and I don't understand why they are empty. I can not give the Bootloader anymore ROM space, the rest must be given to the Application Code.</p>
  
  <p>I hope everything is clear, thanks! </p>