cancel
Showing results for 
Search instead for 
Did you mean: 

table in RAM

celine2
Associate II
Posted on February 22, 2006 at 14:22

table in RAM

7 REPLIES 7
celine2
Associate II
Posted on February 17, 2006 at 16:06

Hello every body,

I want to declare a big table in a RAM and there isn’t any space in zero page.

So, I have tested this code :

In main @data1 char tab[6][50];

And in .lkf +seg .data1 –b0x0100

The compiler said : unknown space: data1

After, I have tested :

In main char tab[6][50];

tab = 0x0100;

The compiler said : redeclared external tab

So, I don’t know what to do…

Thank

philippe

luca239955_st
Associate III
Posted on February 21, 2006 at 05:30

Philippe,

the correct syntax for what you are trying to do is explained

http://www.cosmicsoftware.com/faq/faq19.php

.

If all you want to do is make sure that your table is not in page zero, it is not necessary to specify an address for it, you just write

@near char tab[6][50];

no modification in the linker file is required in this case; the linker will decide by itself the address of your table in the 16 bit address space (that is, out of page zero).

Regards,

Luca (Cosmic)

celine2
Associate II
Posted on February 21, 2006 at 09:14

My problem is : when I read

Char tab[6][50]; in main

The compiler said :

#error clnk sample.lkf:1 bad address (0x1dc) for zero page symbol c_y

#error clnk sample.lkf:1 bad address (0x1e6) for zero page symbol _dec_byte_F$L

#error clnk sample.lkf:1 bad address (0x1d6) for zero page symbol c_lreg

#error clnk sample.lkf:1 bad address (0x1de) for zero page symbol _rempli$L

#error clnk sample.lkf:1 bad address (0x1da) for zero page symbol c_x

#error clnk sample.lkf:1 bad address (0x1ee) for zero page symbol _pwd$L

#error clnk sample.lkf:1 bad address (0x1d2) for zero page symbol c_lacc

What I don’t know.

If I just do that :

@near char tab[6][50];

The compiler said that

#error clnk sample.lkf:1 bad address (0x100) for zero page symbol _tab

So, I’m lost.

:-[

[ This message was edited by: Philippe13 on 21-02-2006 15:19 ]

celine2
Associate II
Posted on February 22, 2006 at 05:48

nobody have a good idea for me ?

luter
Associate II
Posted on February 22, 2006 at 06:17

How many 16bit addressable RAM do u have? Are u sure thart u have enough space to reside array there? Check linker memory settings.

luca239955_st
Associate III
Posted on February 22, 2006 at 08:06

Philippe,

my previous answer only addressed how to manage the address of the objet, but your current problem comes from the fact that the specific array you are using is bigger than 256 bytes.

Supposing that your ST7 derivative has enough memory to manage such a big object, you can't put it in page zero because it's not big enough (that would result in the errors you have seen or in other possible compiler or linker errors), so you have to put it in the ''long'' addressing range. Even here, you must be careful, because if you use page 1 the object will overlap with the stack.

Try the following (change the table name to make sure you are not using the same symbol twice):

Code:

@near char mytab[6][50];

and, in the linker file

Code:

+seg .data -b 0x200

that will make sure that mytab is allocated after the stack and should allow you to compile and link; as for execution, you have to use quite a big ST7 derivative for this to work.

Regards,

Luca (Cosmic)

celine2
Associate II
Posted on February 22, 2006 at 14:22

Hi Luca,

It run!!!! :D :D

Thank you very much :D :D :D

Philippe