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
Flowcode application compiled into bootloader memory area – how to shift start address correctly?
-
Chip7882
- Posts: 7
- http://meble-kuchenne.info.pl
- Joined: Wed Feb 17, 2021 8:59 am
- Has thanked: 1 time
- Been thanked: 3 times
-
mnfisher
- Valued Contributor
- Posts: 1855
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 874 times
Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?
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
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?
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 
Thank you very much for your reply. That sounds interesting—I just played around with it a bit, but so far without success
-
mnfisher
- Valued Contributor
- Posts: 1855
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 154 times
- Been thanked: 874 times
Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?
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
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?
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.
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.
-
Steve-Matrix
- Matrix Staff
- Posts: 1747
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 255 times
- Been thanked: 409 times
Re: Flowcode application compiled into bootloader memory area – how to shift start address correctly?
Excellent - thanks for letting us know.