cancel
Showing results for 
Search instead for 
Did you mean: 

stm8S003 constants at a fixed memory address

janusz2
Associate
Posted on July 27, 2012 at 14:00

Hello

I'm trying place constants at fixed memory address according to this link 

http://www.cosmic-software.com/faq/faq3.php

My code is:

#pragma section const {sver}

const uint8_t SV_HIGH=1;

const uint8_t SV_MID=2;

const uint8_t SV_LOW=3;

#pragma section const{}

I added new segment into linker file:

+seg .sver -b 0x9f10

And linker returns:

#error clnk oprawa_v1.lkf:1 bad address (0x9f11) for zero page symbol _SV_MID

#error clnk oprawa_v1.lkf:1 bad address (0x9f12) for zero page symbol _SV_LOW

#error clnk oprawa_v1.lkf:1 bad address (0x9f10) for zero page symbol _SV_HIGH

Can Any One help?

4 REPLIES 4
janusz2
Associate
Posted on July 27, 2012 at 15:45

problem was in other file

I by mistake badly externed const variable

was:

extern uint8_t SV_HIGH;

should be:

extern const uint8_t SV_HIGH;

but whilst declaring segment you should use -k option becouse compiler optimizes your variable. for example:

+seg .sver -b 0x9f10 -k

carnett1
Associate II
Posted on August 01, 2012 at 16:54

You havew to go into stm8s.config and uncomment out define flash 1 and then use the routines in stm8s.flash I think that is the esame  in cosmic as in raisonance

charles

carnett1
Associate II
Posted on August 01, 2012 at 16:58

sorry it is stm8s_config.h

charles

carnett1
Associate II
Posted on August 01, 2012 at 17:06

again my ingers got ahead of my head stm8s.flash is really stm8s_flash.c

charles