Page 1 of 1
Primary flash memory offset.
Posted: Sun Aug 03, 2025 11:08 am
by electronick
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.
Re: Primary flash memory offset.
Posted: Sun Aug 03, 2025 12:30 pm
by mnfisher
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
Re: Primary flash memory offset.
Posted: Sun Aug 03, 2025 3:14 pm
by electronick
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
Re: Primary flash memory offset.
Posted: Sun Aug 03, 2025 10:51 pm
by mnfisher
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
Re: Primary flash memory offset.
Posted: Mon Aug 04, 2025 9:14 am
by electronick
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.