cancel
Showing results for 
Search instead for 
Did you mean: 

Help for traslation SW in ST7Lite

marcosarti29
Associate II
Posted on September 08, 2006 at 07:15

Help for traslation SW in ST7Lite

11 REPLIES 11
marcosarti29
Associate II
Posted on September 06, 2006 at 05:50

I use ST7Lite19F. The flash is end. I traslate my sw on ST7Lite29F:it has 8K flash memory.

In ST7Lite19 my .prn file is:

MY_ZRAM = NO_INIT 0x0080 TO 0x00FE;

In ST7Lite29...what's is it? I have write:

MY_ZRAM = NO_INIT 0x0080 TO 0x01F7;

but when I use my first variable ''volatile unsigned int'' the software freeze and it's locked! :o

What's new RAM size? What's the problem?Thanks

laurent239955_stm1
Associate II
Posted on September 06, 2006 at 06:37

Hi,

MY_ZRAM refers to the zero page variables (below 0xFF). This variables are accessed one one byte, generating quick and small size code.

You have to create another segment in your prn file like MY_RAM from 0x100 to 0x17F.

For more information, please refer to the Metrowerks linker documentation.

Best regards

Laurent

marcosarti29
Associate II
Posted on September 06, 2006 at 09:27

Thanks a lot!!

I have insert:

MY_ZRAM = NO_INIT 0x0080 TO 0x00FE;

this->MY_RAM from 0x100 to 0x17F.

and correct:

DEFAULT_RAM, _ZEROPAGE, _OVERLAP INTO MY_ZRAM,MY_RAM;

but it's same error: the sw is locked!

:-[

laurent239955_stm1
Associate II
Posted on September 06, 2006 at 09:38

Hi,

This line is wrong :

DEFAULT_RAM, _ZEROPAGE, _OVERLAP INTO MY_ZRAM,MY_RAM;

you have to split it.

For example :

_ZEROPAGE, _OVERLAP INTO MY_ZRAM;

DEFAULT_RAM INTO MY_RAM;

You will have to manage the variable to put in zero page :

#pragma DATA_SEG SHORT _ZEROPAGE

char NumberOfAccess; //data_often_accessed

#pragma DATA_SEG DEFAULT_RAM

char StateOfHandler; //data accessed few times

Hope this will help you.

Don't hesitate to open the Metrowerks documentation !

Best regards

Laurent

;)

marcosarti29
Associate II
Posted on September 06, 2006 at 12:35

Again thanks a lot! ;)

I have change my sw with your advice code. Now compile but...the sw is locked! :-[

The gap:

MY_RAM from 0x100 to 0x17F

are at 16-bit adressing: I must ALIGN?

I dont undestand why it dont run!!! :(

laurent239955_stm1
Associate II
Posted on September 06, 2006 at 13:48

Hi,

You don't need to align, you can access even and odd address. The CPU

handles 8-bit data even if the address is 16-bit long.

What do you mean by the software is locked ?

What kind of tools do you use to debug ?

Best regards

Laurent

marcosarti29
Associate II
Posted on September 07, 2006 at 06:05

Laurent fans club! ;)

I have change prn file with:

MY_ZRAM = NO_INIT 0x0080 TO 0x01FE;

MY_RAM = NO_INIT 0x0100 TO 0x017F;

and

PLACEMENT

_ZEROPAGE,_OVERLAP INTO MY_ZRAM;

DEFAULT_RAM INTO MY_RAM;

....

In my define.h I have defined:

#pragma DATA_SEG _ZEROPAGE

some var....and

#pragma DATA_SEG DEFAULT_RAM

volatile unsigned int CntPositionMotor[2];

In my application I run 2 motor, after 3 second I memorize my default of motor with:

CntPositionMotor[MOTOR_1] = 0xFF00;

After memorization I run the 2 motor in reverse direction.

I have programmed my demo-board, the SW run, the 2 motor run for 3 second, but when there is the istruction:

CntPositionMotor[MOTOR_1] = 0xFF00;

It's lock!

:o

Thanks again for my insistence :-[

laurent239955_stm1
Associate II
Posted on September 07, 2006 at 06:28

Thanks,

What do you suspect ?

Is it the first time this line is executed ? (put a breakpoint on it to check)

If yes, you can verify the assembly code generated either with the debugger or in the listing file (.lst)

Best regards

Laurent

marcosarti29
Associate II
Posted on September 07, 2006 at 13:38

OK, I have understand: I have end ZERO_PAGE. The link alert me:''ERROR L2009:Out of allocation DEFAULT_RAM...FF'' beacause:

MY_ZRAM = NO_INIT 0x0080 TO 0x00FE;

and

DEFAULT_RAM, _ZEROPAGE, _OVERLAP INTO MY_ZRAM;

Now if I use the new space:

MY_RAM = NO_INIT 0x0100 TO 0x01FE;

and

NEW_RAM INTO MY_RAM

this is adressable with 16 bit.

I must defined ''far'' my new variable insert in NEW_RAM?

I have define:

#pragma DATA_SEG NEW_RAM;

volatile unsigned int far NewVar1;

volatile unsigned int far NewVar2;

volatile unsigned int far NewVar3;

but...It dont run :-[

Thanks again