Some of this information can already be found, but I thought it would be helpful to include it all in one place.
XC8 likes to locate its code at the "end" of program address space. This also happens to be where TMB likes to sit. If you take default compiled XC8 hex, and try to load it using TMB, you will receive these messages:
Error: hex file too large, writing bootloader firmware!!!
ERROR: problem in writing flash memory!!!
They are moderately deceptive. The program is not too large, it just happens to overlap with the bootloader code. You need to make modifications to your XC8 linker settings to fix this.
First, you need to figure out the ROM address range that TMB uses. Unless modified, TMB sits at the bottom end of the program address space, using 200 words. Find what the your device's end ROM address is and subtract 0xC8. For example, I am using an 18F4620 that has 0xffff program words. Subtracting 0xc8 from 0xffff gives me 0xff37. This is our ROM exclusion range.
We will need to add --rom=default,-0xff37-0xffff to the linker options.
The "default" tells the linker to include all normal ROM address space. The "-0xff37-0xffff" tells it that the program space used by the bootloader os "off limits".
MPLAB
1) Open Project Properties
2) Select XC8 Linker
3) Under Option Categores (top middle of dialog), select Memory Model
4) Change the parameter for ROM ranges to: default,-0xff37-0xffff Be sure to use the address range that is appropriate for your device.
PROTEUS
1) In the Source Code window, right click on the project that contains the source code for your device.
2) Select Project Settings
3) Click the Options tab.
4) Select LD from the Tool drop down
5) Check Advanced (on the right side, just above Add and below the Option drop down.
6) In the Option drop down, select "--rom= Specify ROM ranges"
7) Change the parameter for rom= to: default,-0xff37-0xffff Be sure to use the address range that is appropriate for your device.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some of this information can already be found, but I thought it would be helpful to include it all in one place.
XC8 likes to locate its code at the "end" of program address space. This also happens to be where TMB likes to sit. If you take default compiled XC8 hex, and try to load it using TMB, you will receive these messages:
Error: hex file too large, writing bootloader firmware!!!
ERROR: problem in writing flash memory!!!
They are moderately deceptive. The program is not too large, it just happens to overlap with the bootloader code. You need to make modifications to your XC8 linker settings to fix this.
First, you need to figure out the ROM address range that TMB uses. Unless modified, TMB sits at the bottom end of the program address space, using 200 words. Find what the your device's end ROM address is and subtract 0xC8. For example, I am using an 18F4620 that has 0xffff program words. Subtracting 0xc8 from 0xffff gives me 0xff37. This is our ROM exclusion range.
We will need to add --rom=default,-0xff37-0xffff to the linker options.
The "default" tells the linker to include all normal ROM address space. The "-0xff37-0xffff" tells it that the program space used by the bootloader os "off limits".
MPLAB
1) Open Project Properties
2) Select XC8 Linker
3) Under Option Categores (top middle of dialog), select Memory Model
4) Change the parameter for ROM ranges to: default,-0xff37-0xffff
Be sure to use the address range that is appropriate for your device.
PROTEUS
1) In the Source Code window, right click on the project that contains the source code for your device.
2) Select Project Settings
3) Click the Options tab.
4) Select LD from the Tool drop down
5) Check Advanced (on the right side, just above Add and below the Option drop down.
6) In the Option drop down, select "--rom= Specify ROM ranges"
7) Change the parameter for rom= to: default,-0xff37-0xffff
Be sure to use the address range that is appropriate for your device.