cancel
Showing results for 
Search instead for 
Did you mean: 

ST9 MEMORY MODEL HELP !!!!

bkbkbk
Associate II
Posted on February 25, 2003 at 16:34

ST9 MEMORY MODEL HELP !!!!

6 REPLIES 6
bkbkbk
Associate II
Posted on May 17, 2011 at 11:33

Hi all,

for the ST9 , How can i setup in a C program with Toolchain, a LARGE DATA model (not code) ?? This to have, for example 256k of data....

i only see in manual that different mem models influences only the CODE not the DATA, and i need to have MORE space for data!!!!

PLEASE HELP ME!!!!!

thanks!!!

Andrea
romain2399
Associate II
Posted on May 17, 2011 at 11:33

Hi Andrea,

3 memory models are available:

COMPACT model: 64K of code and only DPR-mapped data objects (64K maximum).

SPECMED model: code up to 4M and only DPR-mapped data objects.

MEDIUM model: code up to 4M and in addition to DPR-mapped, un-mapped data objects can be allocated anywhere within the 4M address space.

Please, refer to the folowing documents:

1/ Download -> ST9 -> Training -> ST9 Software Toolchain V6

2/ ''Toolchain Fundamentals'' and ''C compiler'' chapters of the STVD9 User Manual (installed in the toolchain directory),

I attach a project example using far function, far function pointer, far data, far data pointer.

Romain

[ This message was edited by: Romain on 24-02-2003 15:50 ]
romain2399
Associate II
Posted on May 17, 2011 at 11:33

You should divide the variable in several 16Kbyte blocks.

To make it easier you can create a read and a write functions to access the variable. If it is an array, depending on the function parameter (index) the good far variable/block will be accessed by changing the far pointer (the compiler changes the DPR0 value).

There are other possibilities by managing manually the DPR0 value but it is safer to let the compiler manage it.

[ This message was edited by: Romain on 25-02-2003 14:18 ]
bkbkbk
Associate II
Posted on May 17, 2011 at 11:33

Hi, thanks 4 answering me.

Sorry but where did you ''..... attach a project example using far function, far function pointer, far data, far data pointer.'' ???

Thanks.

Andrea

-> attached, Romain

[ This message was edited by: Romain on 24-02-2003 15:51 ]
bkbkbk
Associate II
Posted on May 17, 2011 at 11:33

Hia Romain, and thanks again.

I tried to understand the example you attached and the Manual pages you told but, for example, in the user manual, when it talks about MEDIUM memory model it says:

''.......The size of un-mapped data objects is limited to 16 Kb, i.e., one page. Such data objects should fit in a physical page (16 Kb) and cannot spread over multiple pages.''

So how can i create for example a data object such as an array of 150k of bytes (that is the thing i need!) ??? (infact when i compile the error says that the variable is passing the limit of the page)

Thanks!
johanpauvert2
Associate II
Posted on May 17, 2011 at 11:33

I have recently written some code to transfer 50000 bytes from 1 memory location to another. Medium model and pointers were used.

Find my code attached.

Skywalker