Hi DOLPHIN,
Forget what I said about a custom linker file ... you don't need it (it's been a while since I played
with the hal) ... the generated linker script conveniently provides the necessary symbols.
The script contains an output section for each memory "partition" you define, along with the symbols:
_alt_partition_xxx_start
_alt_partition_xxx_end
_alt_partition_xxx_load_addr
where xxx is the partition name. For example, with an on-chip memory named "ocm" you would have:
_alt_partition_ocm_start
_alt_partition_ocm_end
_alt_partition_ocm_load_addr
For details, you can look through your system_description/generated.x file.
Anyway, to move your code from its load address (LMA) to its virtual adderss (VMA), you can use
these symbols with something like:
extern unsigned _alt_partition_ocm_start;
extern unsigned _alt_partition_ocm_end;
extern unsigned _alt_partition_ocm_load_addr;
...
unsigned *dst = _alt_partition_ocm_start;
unsigned *end = _alt_partition_ocm_end;
unsigned *src = _alt_partition_ocm_load_addr;
while (dst < end) *dst++ = *src++;
Regards,
--Scott