Fix memory position for a function at compilation -
is possible set memory position function start from? want know if possible @ compilation, linking or in code.
also i'm working freertos, possible too?
what toolchain use? compilers have special syntax (e.g. word "absolute"), if using gcc should edit linker file (.ld). syntax rather cryptic @ first sight, have docs explained. in short, should mark function belongs section this:
__attribute__((section(".mysection"))) void reflashable_function(...
and add following text myproject.ld file after existing sections:
.mysection 0xs0meaddress: { *(.mysection) *(.mysection*) }
also, add key "-map=output.map" makefile generate mapfile , seek name of function in output.map check if has correct address. there may additional difficulties e.g. inlining function or inlining in it, suggest putting separate .c file. can addg reflashable memory memory section of .ld file, in case won't need add address, need add memory name this:
.mysection: { *(.mysection) *(.mysection*) ./sources/dir/reflashable_file.o(.text) /*this add full file, not 1 function */ ./sources/dir/reflashable_file.o(.rodata) } >bootflash
you can add exclude_file directive other sections won't included in other sections too. check .map file see results.
Comments
Post a Comment