cancel
Showing results for 
Search instead for 
Did you mean: 

zero page ram page memory mapping on STM8S003

johan2399
Associate
Posted on December 09, 2015 at 10:21

Hello,

on STM8S003F3U according to datasheet there is 1024(total ram) - 513(stack) = 510 bytes for user application: 256 byte in the zero page and (510-256)= 254 in Ram section.

If use the short stack compilation option all data are automaticaly maped in the zero page space and i have an error if i use more than 256 bytes.

if i use the long stack compilation data are mapped automaticaly in the upper page: the Ram page and i have an error if use more than 254 (normal because there is the end stack overlap)

I did'nt find any cosmic compiler user guide for stm8. If i try to use pragma to force linker to set data in different space the error is : pragma misplaced ...

How is it possible to use mixed data  mapping zero page and ram page ???

thank's a lot

regars

johan

1 REPLY 1
luca239955_stm1_st
Senior II
Posted on December 09, 2015 at 18:31

Hello,

the user manual is installed together with the compiler, in the /doc subdirectory.

In order to put your variables in the memory you want, first choose the memory model that will decide where all the variables go by default, and then override the standard choice for selected variables by using the @tiny and @near keywords:

char var1;         // will go in page zero or 16-bit addressing, depending on the memory model

@tiny char var2;   // will go in page zero regardless of the memory model

@near char var3;   // will go in 16 bit addressing regardless of the memory model

Regards,

Luca (Cosmic)