cancel
Showing results for 
Search instead for 
Did you mean: 

Data/SRAM Segment problem help~~

suyongyao
Associate II
Posted on September 15, 2008 at 06:15

Data/SRAM Segment problem help~~

13 REPLIES 13
suyongyao
Associate II
Posted on May 17, 2011 at 12:44

Hi All,

I'm using STM32F103RBT6 mcu, which is 128kbytes of flash memory and 20kbytes of RAM. I do not know how to resolve this error when I compile my program by IAR. It says:

Error[e16]: Segment DATA_Z (size: 0x69dd align: 0x2) is too long for segment definition. At

least 0x19dd more bytes needed. The problem occurred while processing the segment

placement command ''-Z(DATA)DATA_I,DATA_Z,DATA_N=RAMSTART-RAMEND'',

where at the moment of placement the available memory ranges were

''CODE:20000000-20004fff''

Reserved ranges relevant to this placement:

20000000-20004fff DATA_I

Below is part of my program, please help me.

float Q[3][3];

float c[3];

float J[72][3];

float g[72];

float z[3];

float lambda[72];

float Cstrain[72];

float Mmat[3][3], dmat[3];

float dz[3], dlam[72], c2[3], bfs[72];

float QO[75][75], PO[75];

main()

{

...

...

}

There are 27828bytes of the variable, which is still less than 128kbytes. What is the problem? Can anyone help me? Thank you.

jj
Associate II
Posted on May 17, 2011 at 12:44

Analysis:

1) Have you a free (KS) or paid version of IAR? If you have any code you will surely overflow the 32KB ''free'' limit. Of course float ''eats'' memory.

2) Have you updated to IAR Ver 5.2?

3) Is your STM32 micro version ''Y?''

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:44

Check the size of BSS section. This size should be bigger than size of your variables.

[ This message was edited by: jaroslaw.oska on 10-09-2008 14:27 ]

suyongyao
Associate II
Posted on May 17, 2011 at 12:44

Quote:

On 10-09-2008 at 14:27, Anonymous wrote:

Check the size of BSS section. This size should be bigger than size of your variables.

[ This message was edited by: jaroslaw.oska on 10-09-2008 14:27 ]

Hi jaroslaw.oska,

Thank you for quick reply. May I know what is BSS?

Yong Yao

suyongyao
Associate II
Posted on May 17, 2011 at 12:44

Quote:

On 10-09-2008 at 13:52, Anonymous wrote:

Analysis:

1) Have you a free (KS) or paid version of IAR? If you have any code you will surely overflow the 32KB ''free'' limit. Of course float ''eats'' memory.

2) Have you updated to IAR Ver 5.2?

3) Is your STM32 micro version ''Y?''

hi,

1. I have both eval n kickstart version installed in my computer. Not sure if the KS version has overwrite and limited to 32k code size. I will investigate on this.

2. I'm still using version 4.42a because my KickStart board is a older version (i do not have the box that label the version of the board now), and i believe the firmware library is specially written for the board version. That's y i remain using tat.

3. May I know how to check the STM32 micro version?

[ This message was edited by: suyongyao on 10-09-2008 16:46 ]

ivanov-i
Associate II
Posted on May 17, 2011 at 12:44

The message simply means that you can not fit 27828 bytes into 20K 🙂 . All variables are located in RAM.

You should either use a chip with bigger RAM (C, D, E), or allocate less variables in your program.

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:44

Quote:

Hi jaroslaw.oska,

Thank you for quick reply. May I know what is BSS?

Yong Yao

Firstly, global variables stays in RAM and ivanov-i is right should check if your variables have smaller size than RAM size.

Second, BSS section holds all uninicjalized global variables.

lanchon
Associate II
Posted on May 17, 2011 at 12:44

> You should either use a chip with bigger RAM (C, D, E), or allocate less variables in your program.

if you are using enough constants (like look-up tables) you could move them to flash. note that you need to reserve stack space and maybe also heap space.

suyongyao
Associate II
Posted on May 17, 2011 at 12:44

Quote:

On 10-09-2008 at 17:47, Anonymous wrote:

Quote:

Hi jaroslaw.oska,

Thank you for quick reply. May I know what is BSS?

Yong Yao

Firstly, global variables stays in RAM and ivanov-i is right should check if your variables have smaller size than RAM size.

Second, BSS section holds all uninicjalized global variables.

Hi Jaroslaw.oska,

Sorry but I still dont understand what is BSS?

[ This message was edited by: suyongyao on 11-09-2008 06:32 ]