2021-03-21 10:25 PM
I have to generate check sum for Hex file that is having size approximately up to 52 K,
I done the checksum generation settings in IAR EW STM8 as below:
Now below is the linker setting:
define region __checksum = [from 0x17FFE to 0x17FFF];
place at start of __checksum { ro section .checksum };
keep { section .checksum };
In main.c
sum = fast_crc16(sum,(unsigned char *)&__checksum_begin, (unsigned int)&__checksum_end -(unsigned int)&__checksum_begin +1);
With this configuration checksum is generating correctly but when I am accessing this from Application getting below error.
Error[Lp002]: relocation failed: value out of range or illegal: 0x17ffd
Kind : R_STM8_DIR16[0x3]
Location: 0x014302
"main" + 0xe
Module: Workspace\Release\Obj\main.o
Section: 8 (.huge_func.text)
Offset: 0xe
Target : 0x00017ffd
Absolute symbol __checksum_end
Error[Lp002]: relocation failed: value out of range or illegal: 0x17ffe
Kind : R_STM8_DIR16[0x3]
Location: 0x01431e
"main" + 0x2a
Module: \Workspace\Release\Obj\main.o
Section: 8 (.huge_func.text)
Offset: 0x2a
Target : 0x017ffe
"__checksum"
Module: Place holder __checksum
Section: 0 (.checksum)
Offset: 0x0
Error while running Linker
Let me how to resolve this issue, please find attached linker file.