Hi all.
Is there som clever way of adding an offset instruction for the compiler in FC 10? Or some other way?
The reason is that I wish to place a bootloader in the beggining of the primary flash memory area.
In eralier FC versions, the *.fcdx apparently could be altererd to make that happend, but since the CRC I cant really seem to use that as an option.
Has someoen got anny suggestions?
The target is dspic33ep familly.
Primary flash memory offset.
-
- Posts: 23
- http://meble-kuchenne.info.pl
- Joined: Tue Dec 08, 2020 3:10 pm
- Has thanked: 8 times
-
- Valued Contributor
- Posts: 1627
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 142 times
- Been thanked: 758 times
Re: Primary flash memory offset.
As an idea (assuming the bootloader is written in assembly or C)
At start - the MCU jumps to the program address in memory (start of the interrupt vector table at 0) - Would it be possible to put the bootloader elsewhere (end of memory?) and use the FC program as is?
I've not used the dsPIC but it may well be possible to write position independent code (using relative addressing)
Otherwise:
Most compilers actually generate relocatable code (and I'm guessing this is the case here) - then the linker stage allocates 'fixed' addresses - you would need to use the --codeoffset=address argument. Or change the 'ORIGIN' value.
Also see:
https://forum.microchip.com/s/topic/a5C ... A4/t342606 - which gives (scant) details of putting the bootloader in auxiliary memory.
Martin
At start - the MCU jumps to the program address in memory (start of the interrupt vector table at 0) - Would it be possible to put the bootloader elsewhere (end of memory?) and use the FC program as is?
I've not used the dsPIC but it may well be possible to write position independent code (using relative addressing)
Otherwise:
Most compilers actually generate relocatable code (and I'm guessing this is the case here) - then the linker stage allocates 'fixed' addresses - you would need to use the --codeoffset=address argument. Or change the 'ORIGIN' value.
Also see:
https://forum.microchip.com/s/topic/a5C ... A4/t342606 - which gives (scant) details of putting the bootloader in auxiliary memory.
Martin
-
- Posts: 23
- Joined: Tue Dec 08, 2020 3:10 pm
- Has thanked: 8 times
Re: Primary flash memory offset.
Hi Martin.
Thank you for answering
I found a post in the old forum, by Ben.
https://www.flowcode.co.uk/mmforums/vie ... ss#p103426
Perhaps this should work? Given the correct paths that is.
/Nick
Thank you for answering

I found a post in the old forum, by Ben.
https://www.flowcode.co.uk/mmforums/vie ... ss#p103426
Perhaps this should work? Given the correct paths that is.
/Nick
-
- Valued Contributor
- Posts: 1627
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 142 times
- Been thanked: 758 times
Re: Primary flash memory offset.
Good luck - the paths will have changed (for v10) - but otherwise hopefully much the same.
If you succeed - please let us know - and if possible give details of how-to!
Martin
If you succeed - please let us know - and if possible give details of how-to!
Martin
-
- Posts: 23
- Joined: Tue Dec 08, 2020 3:10 pm
- Has thanked: 8 times
Re: Primary flash memory offset.
Hi Martin.
Yes I figured as much just by looking into the directorys..
Hopefully some of the guys at Matrix has some idea on how to preoceed.
Yes I figured as much just by looking into the directorys..
Hopefully some of the guys at Matrix has some idea on how to preoceed.