M52259demomcu.  Program hangs when define 64k RAM.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

M52259demomcu.  Program hangs when define 64k RAM.

跳至解决方案
1,795 次查看
Zaas
Contributor I

Dear all,

 

I'm working with 52259demomcu and I'm using codewarrior v7.1 SE. When I create the lcf file with the whole 64k RAM area the program doesn't work fine. I think my lcf is according with the address space for this micro, could anyone verify it. The most relevant part of lcf is here:

# Memory ranges

MEMORY {
   vectorsrom  (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
   cfmprotrom  (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000020  
   bootcode    (RX)  : ORIGIN = 0x00000420, LENGTH = 0x00003BE0
#End reserved 16Kb boot area code.
   flashcode   (RX)  : ORIGIN = 0x00004010, LENGTH = 0x0007BFF0
   vectorram   (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00000400
#   userram     (RWX) : ORIGIN = 0x20000400, LENGTH = 0x00005A00
   userram     (RWX) : ORIGIN = 0x20000400, LENGTH = 0x0000FC00
   ipsbar    (RWX) : ORIGIN = 0x40000000, LENGTH = 0x0
} 

....(here sections are defined).....

 ___VECTOR_RAM = 0x20000000;

 ___FLASH  = ADDR(.vectorsrom);
 ___FLASH_SIZE = 0x00080000;
 ___SRAM   = 0x20000400;
# ___SRAM_SIZE = 0x00005A00;
 ___SRAM_SIZE = 0x0000FC00;

 ___IPSBAR  = ADDR(.ipsbar);

    ___SP_SIZE      = 0x0800;
 ___HEAP_START = .;
 ___HEAP_END  = ___SRAM + ___SRAM_SIZE - ___SP_SIZE;
 ___SP_END  = ___HEAP_END;
 ___SP_INIT  = ___SP_END + ___SP_SIZE;

   ___heap_addr  = ___HEAP_START;
 ___heap_size  = ___HEAP_END - ___HEAP_START ;


    ___SP_AFTER_RESET = ___SRAM + ___SRAM_SIZE - 4;
 __SP_INIT   = ___SP_INIT;

 _romp_at = ___ROM_AT + SIZEOF(.data);
 .romp : AT(_romp_at)
 {
  __S_romp = _romp_at;
  WRITEW(___ROM_AT);
  WRITEW(ADDR(.data));
  WRITEW(SIZEOF(.data));
  WRITEW(0);
  WRITEW(0);
  WRITEW(0);
 }

 

The debugger shows  variables getting a different value than  I set it for them...
When I define a little RAM space the code work fine.
I don't know what is going on, any idea would be grateful.

Thanks in advance.
标签 (1)
0 项奖励
回复
1 解答
575 次查看
PaoloRenzo
Contributor V

Hi

 

Heap and stack space seems like out of memory space when you increase the RAM space. Try this:

 

 

    ___SP_END           = .;
    ___SP_INIT          = ___SP_END + ___stack_size;

    ___HEAP_START       = ___SP_INIT;
    ___heap_addr        = ___HEAP_START;
    #FSL: rest of RAM used for HEAP
    ___HEAP_END         = ___SRAM_ADD + ___SRAM_SIZE - 4;
    ___HEAP_SIZE        = ___HEAP_END - ___HEAP_START;
    . = ALIGN (0x4);

 

 

Hope this helps

Message Edited by Paolo Renzo on 2009-09-24 09:10 PM

在原帖中查看解决方案

0 项奖励
回复
3 回复数
576 次查看
PaoloRenzo
Contributor V

Hi

 

Heap and stack space seems like out of memory space when you increase the RAM space. Try this:

 

 

    ___SP_END           = .;
    ___SP_INIT          = ___SP_END + ___stack_size;

    ___HEAP_START       = ___SP_INIT;
    ___heap_addr        = ___HEAP_START;
    #FSL: rest of RAM used for HEAP
    ___HEAP_END         = ___SRAM_ADD + ___SRAM_SIZE - 4;
    ___HEAP_SIZE        = ___HEAP_END - ___HEAP_START;
    . = ALIGN (0x4);

 

 

Hope this helps

Message Edited by Paolo Renzo on 2009-09-24 09:10 PM
0 项奖励
回复
575 次查看
Zaas
Contributor I

Hi Paolo,

 

      Your are right I did the modifications and It works.

 

Anyway could you say me where I can find more information about how manage this stuff (stack, heap ....) inside the lcf file.

 

Thank you.

0 项奖励
回复
575 次查看
PaoloRenzo
Contributor V

Try this:

 

C:\Program Files\Freescale\CodeWarrior for ColdFire V7.1\Help\PDF\Targeting_ColdFire.pdf

 

Heap and stack spaces will vary depending the number of available memories: SDRAM, SRAM, internal SRAM, etc, so your imaginations on how to use it is the limit :-D

 

This doc will show the basic commands, but as many LCFs you can see, the more you can learn

 

Good luck

0 项奖励
回复