Hello FC,
It is unclear what you are trying to achieve with the use of the SGF flash driver routines. I initially suspected you required to store data in flash during normal operation of your firmware program - is this the situation?
On this assumption, your program would need to store the high voltage routine in flash, and then provide a simple routine to copy this code to RAM just prior to any data flash programming. So the S19 file should not use address location 0x0100 (start of RAM1 segment) for the placement of any code, because it is not a flash block, and is volatile. ORG $100 would only define the start address when the high voltage routine commences execution.
XDEF HighVoltage ; Provide label visibility outside current file
ORG $100
HighVoltage: ; Define label
or alternatively,
HighVoltage equ $100
Here is a snippet of code for the copy process, where flash location HVcode contains the code to be executed from RAM -
HVcode:
dc.b ; Sequence of bytes for HighVoltage routine
; etc.
Copy_code:
ldhx #25 ; Number of bytes to copy
loop1: lda HVcode-1,x
sta HighVoltage-1,x
dbnzx loop1
rts
Regards,
Mac