/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Memory problem

Username:     
Password:     
             

Forum

# 1   2009-03-28 16:35:53 Memory problem

Pierre
Member
Registered: 2007-10-02
Posts: 19

Memory problem

Hello,

First question on Ram allocation
-------------------------------------

I have a problem on memory allocation. I would like to create a "big" table in Ram but linker return a error, If I write:

--> unsigned char Stream[16900];

the linker return the error:

Region RAM overflowed by 13048 bytes.

On the STM32F103VET6 there are 64Kbytes available. how can I do to have a table with 16900 bytes ???


Second question on flash code size
----------------------------------------

I can not compile a application with a size up 12Kbyte.
The linker return the error:

undefined sympbol' !!!!!!!!! FLASH IS FULL !!!!!!!' refenrenced in expression.

I need a licence to compile this code ?


Please could you help me ?

Best regards,
Pierre

Offline

 

# 2   2009-03-28 17:38:35 Memory problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Memory problem

Just modify the RAM size in the ld file. The RAM size of the current ld file is specified for the Primer1, but you can extend it up to 48KB for the Primer2.

Offline

 

# 3   2009-03-28 21:11:38 Memory problem

kubsztal
Member
Registered: 2009-01-27
Posts: 15

Re: Memory problem

Hi Francis,
Is 48k some kind of restriction? I've extended RAM to 64k and I'm able to declare table with size ca. 60k - I didn't check if this works but at least it's compilable.

Offline

 

# 4   2009-03-29 05:17:37 Memory problem

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Memory problem

The RAM used by CircleOS is 8KB, but it will be 10KB with version 3.7 (that handles audio data in DMA in a 2KB buffer). The limitation should be 64-10 = 54KB, but you have also to take into account the stack (common for both CicleOS and the applications). Consider at least 1KB for the  stack...
Conclusion: 60KB is too much.

Offline

 

# 5   2009-03-29 09:15:31 Memory problem

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: Memory problem

Hello,

Thank very much for your answer.

I'm sorry but there are lot of ld file. which ld file I need to modify (and wihich field).
I checked in my project properties, in "Advanced ARM Options" Data size is well at 0x10000.

Best regards,
Pierre

Offline

 

# 6   2009-03-29 19:52:42 Memory problem

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: Memory problem

Hello,

I'm sorry for my previous message. About RAM memory allocation, I modified the .ld file of my project:

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K

Now I can compile the line "unsigned char Stream[16900];".

But about my second question on flash size (code memory). I tried to modify in the .ld file the line below:

- from
    FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 8K
- to
    FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 512K-0x6000

but without success.

How can I do to compile a code up 12Kbytes ?

Best regards,
Pierre

Offline

 

# 7   2009-03-29 21:01:52 Memory problem

kubsztal
Member
Registered: 2009-01-27
Posts: 15

Re: Memory problem

Hi Pierre,

Did you update also _eflash? These settings work OK for me:

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
FLASHB1 (r) : ORIGIN = 0x8000000, LENGTH = 0x0006000
FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 512K-0x6000

EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0

_eflash = 0x8006000 + 512K-0x6000-1;

My question is: how section FLASHB1 should be configured? If I set it to

FLASHB1 (r) : ORIGIN = 0x0000000, LENGTH = 0

there is an error that this region is overflowed by 4 bytes and LENGTH = 4 seems to work properly too.

Offline

 

# 8   2009-03-30 21:15:41 Memory problem

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: Memory problem

Hello kubsztal,

Thank very much, All is ok now.

Best regards,
Pierre

Offline

 

# 9   2009-08-25 23:11:03 Memory problem

hairykiwi
New member
From: Ledbury, UK
Registered: 2009-05-31
Posts: 9

Re: Memory problem

Hi guys,

As per this and other posts I modified the Circle_App.ld line:
"FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 8K"
REPLACED WITH
"FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 128K-0x6000"
That worked for a couple of small apps.

I've merged the two apps and the first error was:
"undefined symbol' !!!!!!!!! FLASH IS FULL !!!!!!!' referenced in expression."

After trying the suggestions from kubsztal, above, I still get the build errors:
"region FLASHB1 overflowed by 4 bytes".

Any more suggestions please?


Regards,
Hamish

Offline

 

# 10   2009-08-26 16:37:04 Memory problem

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: Memory problem

hello Hairykiwi,

The setting below work very well for me in Release mode (compiler) without error:

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
FLASHB1 (r) : ORIGIN = 0x8000000, LENGTH = 0x0006000
FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 512K-0x6000

_eflash = 0x8006000 + 512K-1;

Coud you try to compile in Release mode.

Best regards,
Pierre

Offline

 

# 11   2009-08-27 03:49:03 Memory problem

ShadowPhoenix
Member
Registered: 2009-02-11
Posts: 57

Re: Memory problem

One quick note is that just because it compiles it might not run correctly, due to stack overflow. Make sure to check out the memory map generated.

It would be quite helpful if someone wrote a simple python script to change the .ld properly...

Offline

 

# 12   2009-09-03 10:11:58 Memory problem

hairykiwi
New member
From: Ledbury, UK
Registered: 2009-05-31
Posts: 9

Re: Memory problem

Pierre,

Apologies for being slow in replying - I've been away.

I'm not sure what I did when I first wrote; I possibly corrupted the .ld file and/or IDE settings.

So I started a new project, cut and paste my old code, bit by bit until I got the FLASH IS FULL warning, then edited the .ld file with your suggestion and it worked fine. Many thanks! And to kubsztal too.

ShadowPhoenix, This wasn't my problem,  not yet anyway, (it wasn't even compiling). Personally, I like the idea of tinkering with the ld file manually. Especially as a novice programmer - I think I learn more that way. Though I do see the advantage to scripting, once the underlying concepts are understood.

Could you expand a bit on the idea of checking out the memory map please? I couldn't spot any significant difference between the memory maps of my old project (un-linkable) and the new one which builds fine with Pierre's suggested mod to the .ld file.

Thanks for your time guys. Much appreciated.

Hamish

Offline

 

Board footer