cancel
Showing results for 
Search instead for 
Did you mean: 

Memory model

wileti
Associate II
Posted on September 25, 2007 at 11:14

Memory model

4 REPLIES 4
wileti
Associate II
Posted on September 11, 2007 at 19:56

Hi all,

I´m working with Cosmic CxST7 version 4.5.5 and I´ve got the message below:

Running ST7 linker

clnk -l''C:\Program Files\COSMIC\CXST7_16K\Lib'' -o Debug\sugar_project.st7 -mDebug\sugar_project.map Debug\sugar_project.lkf

#error clnk Debug\sugar_project.lkf:1 function _SetEP0TxStatus is reentrant

#error clnk Debug\sugar_project.lkf:1 function _SetEP0RxStatus is reentrant

After change the memory model to Long Stack this problem was fixed but a new one was prompted:

Running ST7 linker

clnk -l''C:\Program Files\COSMIC\CXST7_16K\Lib'' -o Debug\sugar_project.st7 -mDebug\sugar_project.map Debug\sugar_project.lkf

#error clnk Debug\sugar_project.lkf:1 segment .bss size overflow (41)

The command: ''clnk -l''C:\Program Files\COSMIC\CXST7_16K\Lib'' -o Debug\sugar_project.st7 -mDebug\sugar_project.map Debug\sugar_project.lkf '' has failed, the returned value is: 1

exit code=1.

It seems that RAM space from 0x180 to 0x23f (ST72F63BK4) is not enough for application.

My first question is: after modify memory model to Long Stack is it necessary to change functions to @stack rather than @nostack declaration?

In Cosmic manual it is recommended select the memory model based on some procedures. After compile in long memory model settings, it´s necessary to check map file to further clues. Actually, I stuck at the second step as the compiler didn´t generate the map file.

What is possible to do with the compiler settings in order to fix the problem? I´ve already attempted several ways but unfortunatelly with no sucess.

Thank you very much in advance,

Wilson

luca239955_st
Associate III
Posted on September 12, 2007 at 07:35

Hello,

reentrant functions cannot work with static (non-stack) memory models; either you use a stack memory model (as you tried, but this models generate big code on the st7) or you declare manually the reentrant functions with the @stack keyword.

For your second problem, one possible solution is to go in linker file (.lkf) and manually change the limits of the offending section (.bss in your case): you will then be able to produce a map file to look at, even of, of course, you can't run it on the target (cause you are using more memory than is actually on the device).

Regards,

Luca (Cosmic)

wileti
Associate II
Posted on September 12, 2007 at 12:50

Thanks Luca,

I´m working on this issue right now.

In addition, is there any documment declaring type objects size? Actually I´ve only found descriptions for short int and long int that are, respectivelly, two and four bytes long.

I wonder to see a documment depicting the rest of the types objects.

Any hint for this thread?

Regards,

Wilson

luca239955_st
Associate III
Posted on September 25, 2007 at 11:14

I forgot to answer this, so you've probably already found out, but here it goes:

- char: 1 byte

- int: 2 bytes

- long, float: 4 bytes

Avoid the last two as much as possible, especially under interrupt.

Regards,

Luca