Best way to move RAM usage to external SRAM?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Best way to move RAM usage to external SRAM?

2,330 Views
admin
Specialist II

Hello,

 

I have an MQX system running on an MCF52259 with 1MB of SRAM on the FlexBus. I'm running RTCS, the HTTP server, the shell, Mocana's NanoSSH, and a handfull of my own tasks. My question is this: What's the best way for me to off-load some of the RAM usage from the internal RAM to my external SRAM on the FlexBus? I have the external SRAM working, and I know I can set up a LWmem pool and malloc from that (and I am doing so in my own tasks). However, my task's stacks, and all the native MQX stuff (like RTCS and TCP, and whatever else) is doing a very good job filling up the internal 64K.

 

Is there a good way to move MQX memory useage to the SRAM instead?

 

Thanks,

 

Brad

9 Replies

947 Views
drummer
Contributor IV

I noticed that you got your mocana SSH running. I haven't been able to get mine going yet.

I dont have any of the common header files. My licence seems to work because I am able to see the bean in PE.

How do you link in the library and where are the header files?

My compiler compains that it can't find moptions.h and a whole lot more files that should be on my computer but I can't find them.

Sorry to trouble you with this Brad but I am desperate!

 

0 Kudos

947 Views
admin
Specialist II

I had to set two compiler flags to make it like the Mocana code. "-gccincludes" to make the Freescale compiler accept the relative include paths used in the Mocana code, and "-relax_pointers" (I don't remember why).

 

Getting that Mocana stuff going was not fun. This was only part of the issues I ran into.

0 Kudos

947 Views
drummer
Contributor IV

I just want to run the demo.

There isn't any instructions on how build the encryption into your project that I can find.

Here is what I have done that doesn't work.

1) Created a stationery project.

2) delete the main.c and include the demo files.

3) add the cau_libv1.1.o

It compains that it cant find the common mocana header files.

I can't find them anywhere on my hard drive.

0 Kudos

947 Views
admin
Specialist II

I'm not sure exactly what you're doing. It doesn't sound like what I was doing. 

 

I'd reccomend contacting Mocana. They were good with providing support to me.

0 Kudos

947 Views
juanee
Contributor III

Hello,

 

Did you ever get an answer to your question Brad?  I also use an MCF52259 with external SRAM.

 

Replies are appreciated,

 

Juan

 

Codewarrior 10 Special Edition

Windows XP Pro

MQX 3.6.2

PEMicro USB ColdFire Multilink.

Custom Target based on Coldfire MCF52259.

0 Kudos

947 Views
madifazio
Contributor III
Hello, 
Im using the following method to put tasks in external RAM using flexbus (in my case MRAM).
Create a space of memory in a pool diferent to the default memory pool and use this space as task stack
Create the task using _task_create_at function from MQX.
#define SOCKET_TASK_STACKSIZE 3000void * SOCKET_TASK_STACK; void socket_task_create(){ _task_id task_id; SOCKET_TASK_STACK = mram_alloc(SOCKET_TASK_STACKSIZE); task_id = _task_create_at(0, SOCKET_TASK, 0, SOCKET_TASK_STACK, SOCKET_TASK_STACKSIZE); if (task_id  == MQX_NULL_TASK_ID)  {  _task_block(); }}_mem_pool_id    _MRAM_pool_id;void mram_create_pool(){    _MRAM_pool_id = _mem_create_pool(BSP_EXTERNAL_MRAM_RAM_BASE, BSP_EXTERNAL_MRAM_RAM_SIZE);    if(_MRAM_pool_id == NULL)    {     _task_block();    }}pointer mram_alloc(int mem_size){ return _mem_alloc_from(_MRAM_pool_id, mem_size); }

 

 

Hardware:
TWR-KIT-MCF5225X
TWR-MEM
TWR-LCD
Software
eGUI 2.07
MQX 3.7
CW10.1

 

0 Kudos

947 Views
Akshaya_Mukund
Contributor I

I tried the code snippet you mentioned above. I am however not using the allocated memory for a task but for general mallocs used by my application.

I notice a Hard_fault being triggered though by _lwmem_alloc_internal() when the memory Pool validity is checked. Any pointers on. I would appreciate it if you could help me out.

Thanks

0 Kudos

947 Views
Teckna
Contributor V

I use the following instruction in the very first line of the first task creted:

_mem_extend( BSP_EXTERNAL_MRAM_RAM_BASE, BSP_EXTERNAL_MRAM_RAM_SIZE );

Teckna

947 Views
madifazio
Contributor III

Other method I use to use external MRAM is declare the location of same variables using the linker command file.

 

 

MEMORY
{
......
  ram        (RW): ORIGIN = 0x20000000, LENGTH = 0x00010000  # SRAM - RW data
  ram2      (RW): ORIGIN = 0x10000000, LENGTH = 0x00010000  # MRAM - RW data
.......
}
SECTIONS
{
   ................
   ___EXTERNAL_MRAM_BASE  = 0x10000000;
   ___EXTERNAL_MRAM_SIZE  = 0x00080000;
   ___EXTERNAL_MRAM_ROM_BASE = 0x10010000;
   ___EXTERNAL_MRAM_ROM_SIZE = 0x00000000;
   ___EXTERNAL_MRAM_RAM_BASE = 0x10010000;
   ___EXTERNAL_MRAM_RAM_SIZE = 0x00070000;
   ..........
   .main_application_bss2 :
   {
      data_c.obj (.bss)
   } > ram2

 

   .main_application_bss :

   {

      __START_SBSS = .;

      *(.sbss)

      *(SCOMMON)

      __END_SBSS = .;

 

      __START_BSS = .;

      *(.bss)

      *(COMMON)

      __END_BSS = .;

   } >> ram

   ..........
}
in data.c file:
/* * data.c * *  Created on: 15-abr-2011 *      Author: Marcos Di Fazio *       *      Todas las variables globales definidas en este modulo de  *      compilación van a ir a parar al espacio de memoria de MRAM *      Esto se define desde el linker command file. */// Buffer para textos de registros.char scrRegistros_txtBxTextMRAM[1000];

 

 
Hardware:
TWR-KIT-MCF5225X
TWR-MEM
TWR-LCD
Software
eGUI 2.07
MQX 3.7
CW10.1

 

0 Kudos