Page 1 of 1

Flowcode application compiled into bootloader memory area – how to shift start address correctly?

Posted: Wed Feb 11, 2026 11:53 am
by Chip7882
Hello Ben,
I have created a bootloader for my dsPIC33EP128GM604 using the Microchip IDE. It works, and I can flash an application that was also created with MPLAB using the UBHA tool over UART.

My problem: How can I correctly compile a Flowcode application so that the addresses are shifted to the correct start address? I have already modified the linker script as follows:
reset : ORIGIN = 0x2000, LENGTH = 0x4
ivt : ORIGIN = 0x2004, LENGTH = 0x1FC
program (xr) : ORIGIN = 0x2200, LENGTH = 0x151EC

However, the resulting .hex file still contains data in the bootloader area when I compile with Flowcode. Unfortunately, I am getting a bit desperate. Do you have any tips on how to correctly set the address offset in Flowcode?

Many thanks in advance.
Daniel

Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?

Posted: Wed Feb 11, 2026 1:07 pm
by mnfisher
You can use the codeoffset directive...

I did a bootloader for a PIC18 and tried quite hard to get the harmony framework bootloader to work.

I didn't manage it - and in the end put the bootloader at the end of memory and loaded the FC program as is...

You'll hopefully have more success ..

Martin

Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?

Posted: Wed Feb 11, 2026 2:05 pm
by Chip7882
Hello Martin,

Thank you very much for your reply. That sounds interesting—I just played around with it a bit, but so far without success :-( I’ve dealt with bootloaders and Flowcode several times before and have always ended up giving up. I really want to get it working this time :-) I hope Ben can shed some light on this :-)

Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?

Posted: Wed Feb 11, 2026 7:06 pm
by mnfisher
I started with TinyBootloader as a base. I had to modify it quite a lot for a specific requirement (and PIC assembly language was new to me / isn't nice) - it might be worth having a look and seeing if it fits your needs (Evan will do a MCU specific version for a fee - but source not included - so might not be suitable?)

It 'should' be possible to use the harmony bootloader and move the base address FC is compiled to - Ben might have some suggestions on this?

Martin

Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?

Posted: Thu Feb 12, 2026 3:01 pm
by Chip7882
Good news :-) It is now working!
I can now successfully flash an application created with Flowcode using the bootloader that was created with MPLAB.

The key point was the changes in the linker script.
Only the application code must be relocated:

program (xr) : ORIGIN = 0x2000, LENGTH = 0x133EC


The IVT and the reset vector must remain at their original locations.

In addition, all configuration bits must be identical to those of the bootloader.

The interrupts in the application are also working correctly as expected.

Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?

Posted: Thu Feb 12, 2026 3:16 pm
by Steve-Matrix
Excellent - thanks for letting us know.