cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read and configure checksum generation for STM8AF6269

AGupt.7
Associate

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:

  • Fill pattern
  • 0xFF
  •  (can be any pattern)
  • Start address
  • 0x0 
  • (adjust to your application)
  • End address
  • 0xFFFB / 0x17FFB
  • (adjust to your application)
  • Generate checksum
  • Checksum size: 2 bytes
  • Algorithm: CRC16
  • Complement: as is
  • Bit order: MSB first
  • Initial value: 0

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.

0 REPLIES 0