cancel
Showing results for 
Search instead for 
Did you mean: 

Zero page - problem compile with Metrowerks

omatza
Associate II
Posted on November 02, 2005 at 06:22

Zero page - problem compile with Metrowerks

12 REPLIES 12
omatza
Associate II
Posted on October 20, 2005 at 17:09

Hello All

I use ST7FMC2N6B6, which is used only on eval boards (my case it is starter kit for ST7FMC2 BLDC motor)

It has 32KB of Flash and 1K of RAM (SDIP 56 pins).

I compile and get link error *ERROR L1102: Out of allocation space in segment MY_ZRAM at address 0xF9*

Can you tell me if MY_ZRAM is a term of ST, Softec or Metrowerks ?? (where do I read about it ??)

I use Softec environment, and I had ''local vars'' set from 0x80 to 0xFF

I change it to be from 0x80 to 0x17F, and now it linked OK.

The problem is that I don't know if it is allowed to change this parameter like this, cause the ZRAM, as I understand, is for ''near'' variables, with addresses up to 0xFF.

Any hint ?

Thanks

Oren

laurent239955_stm1
Associate II
Posted on October 24, 2005 at 07:19

Hi,

This message comes from the linker. If you use Metrowerks one, the MY_ZRAM parameter is defined in the PRM file.

Best regards

Laurent

omatza
Associate II
Posted on October 24, 2005 at 12:20

Thanks Laurent

I afraid I am still doesn't get it.

:-[

I know taht the message comes from the linker. I wrote it in my question (that I get link error)

When you work with Softec STVD, the prm file is automatically created, BUT (I think) that the linker is the linker you use, in the tool chain - in my case is Metrowerks.

So my question is still stend:

if MY_ZRAM is a term of ST, Softec or Metrowerks ?? (where do I read about it ??)

Also can somebody refer to the second problem I asked about:

I use Softec environment, and I had ''local vars'' set from 0x80 to 0xFF

I change it to be from 0x80 to 0x17F, and now it linked OK.

The problem is that I don't know if it is allowed to change this parameter like this, cause the ZRAM, as I understand, is for ''near'' variables, with addresses up to 0xFF.

Any hint ?

Thanks

Oren

Viktor POHORELY
ST Employee
Posted on October 26, 2005 at 11:36

MY_ZRAM is a default name for segment between 0x80 and 0xFF, generated by STVD7. Usually, it is used for local variables because of SHORT addressing mode, which could be used. In fact, it is faster to access this area and spend some bytes in code as well. If you will extend this space to 0x1XX, your code will be not so effective, as it could be (because FAR addressing will be used for some local variables).

maybe you can try to limit number of local variables?

do you have some local¤s defined as STATIC? those will be in RAM all the time, maybe you can force compiler to put them into MY_RAM, instead of MY_ZRAM...

omatza
Associate II
Posted on October 26, 2005 at 15:05

Hello

Thanks a lot.

Two final questions:

1. how do I force compiler to put them into MY_RAM, instead of MY_ZRAM ?

2. In the data sheet of the ST7 it says that the stack is from 0x100 to 0x1FF.

If I enlarge the MY_ZRAM up to 0x17F, then one ''problem'' is that for some of the variables (above 0xFF) the compiler will use long addresses. (you explained)

My question is: does the stack location can be determine also ?

I mean, I will force the stack to be from 0x180 up to 0x300 for example, and then use the rest of the RAM as usual, OR the stack is hard wire determine by the CPU, as in the data sheet ?

Thanks lot

Oren

wolfgang2399
Associate II
Posted on October 27, 2005 at 08:37

Hi Oren,

please have a look at your xxxxx.prm file.

There you can define different sections in the block titled SECTION, e.g.

ZRAM = READ_WRITE 0x0080 TO 0x00FF;

RAM_2 = READ_WRITE 0x0100 TO 0x017F;

MYSTACK = READ_WRITE 0x0180 TO 0x01FF;

In the block PLACEMENT you assign a segment to a section e.g.

BSCT INTO ZRAM;

RAM_SEG_2 INTO RAM_2;

Finally in your program you must assign your variables to the very segments with a #pragma directive e.g.

#pragma DATA_SEG SHORT BSCT

int rxNb = 0;

#pragma DATA_SEG NEAR RAM_SEG_2

short int Test;

unsigned short int ErrorNo;

#pragma DATA_SEG DEFAULT

See above for your 2nd question: You define the stack area in your .prm-file with MYSTACK = ...

Best regards

WoRo

omatza
Associate II
Posted on October 27, 2005 at 10:53

Hello WoRo

From your answer I anderstand I can put the stack in address where I want to.

Am I allowed also to make the stack go over 1FF ?

Am I allowed to define MYSTACK (as in your example), for example, from 0x180 too 0x400 ?

So why there is limitatin in the datasheet - i.e. chips with 1024 bytes of stack, chips with 768 bytes of stack, and so on ?

Thanks

Oren

wolfgang2399
Associate II
Posted on October 27, 2005 at 12:10

Hello Oren,

you can generate a new RAM segment from 0x0200 to 0x0400 with the .prm-file but I think you must give the stack an area from 0x01yy to 0x01FF.

Notice: the command RSP (Reset the Stack Pointer) will reset the pointer to the maximum value of 0x01FF - independent of the program.

Regards WoRo

omatza
Associate II
Posted on October 27, 2005 at 13:58

:D

Thanks a lot

That RSP command was a big tip.

I now looked also aanother document 4020.pdf (programming manual of assembler, and it help also)

I am very grateful to you.

Oren