$begingroup$
I have a bootloader to PIC18F4550 that was written using Mikro C for PIC and I have two firmware applications, one was written using Mikro C for PIC and the other using MPLAB X with XC8 compiler.
With the bootloader installed, I can upload the application written in Mikro C without problem, but, with the same bootloader installed, when I try to upload the application written in MPLABX I can't. I load untill 100% but in the end it crashes . I thought that upload the applicatoin in hex it would not be a problem and would be independant of the tool used.
Mar 15, 2018 I believe that my mistake may be related to the linker scripts, I have different linker scripts for the bootloader and the application, in the one for the application I have simply altered the rom ORIGIN. What is the correct way of doing this? Another possibility is that my vector table does not point to the right address on reset. Side note: If you ever wonder what makes the Atmel's USB DFU links to 0x80000000 instead of 0x80002000, follow these steps to take a look at the linker script of USB Bootloader example provided by AVR32 Studio. Make sure you have AVR32 Studio 2.1 or higher.
The version of the bootloader that I'm using is this that I found in this site:
Some one has any idea of why it is happening ?
EDITED:
I don't know if it is at the top or at the bottom of memory. Based on the following code, I guess it is on the bottom:
This says, basically, that the start of bootloader begins at memory region given by the flash memory size minus the bootloader size. So, I don't know why, it divided and multiplied by the size of flash erase block.The size of the bootloader is already given too.
I did nothing to the XC8 app to ensure it does not overlap, I just compiled it. How can I do ensure it does not overlap ?
Daniel
DanielDaniel
$endgroup$1 Answer
$begingroup$You're right — in principle, the bootloader shouldn't care what tools are used to create the application code. As far as it is concerned, the application is just 'a bag of bits'.
However, the presence of the bootloader puts constraints on the application:
- The application cannot clobber the part of the instruction space that the bootloader occupies.
- The application must be startable at an address known to the bootloader.
- If the application needs to be able to invoke the bootloader, then it needs to know how to do that.
- If the application needs to use any I/O resources that are also used by the bootloader, then any conflicts need to be resolved through 'rules of engagement'.
It's possible that not all application development environments are completely compatible with the specific requirements of your bootloader.
Dave Tweed♦Dave Tweed129k1010 gold badges162162 silver badges276276 bronze badges
$endgroup$