News:

Let's find out together what makes a PIC Tick!

Main Menu

Bootloader Issues with Tiny Multibootloader

Started by JohnB, May 15, 2026, 11:09 AM

Previous topic - Next topic

JohnB

I don't know if others have had similar problems but I have had a couple of bootloaders from Evan which only work once with my programs because my program is writing into the first 8 locations corrupting the vector to the bootloader.

This is the message (see attached) when I upload my program to my device.  The uploaded program runs fine but when I reboot it does not re-enter the bootloader.

I have bootloader = on in my declares, how many bytes does the compiler leave free when bootloader is enabled?

I dont want to waste any more money with Evan if the compiler is causing the problem.
JohnB

trastikata

#1
Quote from: JohnB on May 15, 2026, 11:09 AMI have bootloader = on in my declares, how many bytes does the compiler leave free when bootloader is enabled?
I dont want to waste any more money with Evan if the compiler is causing the problem.

John,

How many bytes the compiler will leave depends on your declare: "Declare Compiler_Start_Address"

The problem is in the Bootloader that probably accepts FLASH addresses effectively overtiring itself.

My bootloaders will always return a write error if FLASH address will cause it to overwrite itself.

JohnB

#2
I should have mentioned, I am using the 16F family of devices which it seems the compiler doesnt support the Declare Compiler_Start_Address,  Does this mean you cannot use TinyMultiBootloader with devices less than the 18F series?  Can any one recommend a bootloader which will work with 16F devices.

Further to this, discussions with Evan it appears that NOP's are inserted at the begining of the code rather than leaving erased as $3FFF
JohnB

top204

The bootloader is located at the top of flash memory, and it should be copying all of the code memory from address 0x00 to address 0x04, because that is the startup space on them.

The standard assembler start for the compiler with a 14-bit core device is:

_compiler__start_
    Org 0x00
    Nop
    Nop
    Movlp ((_compiler_main_start_) >> 8)
    GoTo _compiler_main_start_
    Org 0x04


But it seems that the bootloader has taken a step backwards with its later iteration and it must only be copying the first 2 words. So use the declare:

Declare Bootloader = On

And the assembler code will be:

_compiler__start_
    org 0x00
    movlp ((_compiler_main_start_) >> 8)
    goto _compiler_main_start_
    nop
    nop
    org 0x04


I originally had the formation change because of a querk in devices many years ago, so a jump to an address at the address 0x00 could cause problems, but that will not be the case now, so I will change it back to standard address 0x00 being the jump to the main program.

Regards
Les