Personal tools
You are here: Home Forums M32C Memory Problem

Memory Problem

Up to M32C

Memory Problem

Posted by Dennis at April 25. 2008

Can anyone show me how to read and write base on a structer to memory I have 4 mb of extern ram

on my project. I using MC3287


Thanks

Dennis


Re: Memory Problem

Posted by DJ Delorie at April 25. 2008

Using what development tools?

With gcc, you just edit the linker script to point to the external ram instead of the internal ram.


Re: Memory Problem

Posted by Dennis at April 27. 2008

I'm Using HEW with reneesas c complier,


example code

typedef struct                    /* command message header structure */
  {

     long start_address; ( some address like 0xC00000 )
   
  }MEM_MAP;


typedef struct                    /* command message header structure */
  {

    char name[80];

   int a;

   
  }_m0601rs;


#define MP_DB(a) (*(volatile _m0601rs*)((sizeof(map)+MEM_MAP.monitor_point.start_address)+(sizeof(m0601rs)*a)))



now using code example:

_m0601rs m0601rs;

MEM_MAP map;


sprintf(MP_DB(1).name,"hello world");



Thanks Dennis


Re: Memory Problem

Posted by Calvin Grier at June 09. 2008

Dennis,

You referenced example _m0601rs...

Can you include a link to this? Or explain where it came from?

Re: Memory Problem

Posted by FrankL at June 10. 2008

What is MEM_MAP.monitor_point.start_address? MEM_MAP is a variable type, start_address is a member of MEM_MAP, and there is no variable monitor_point.

This example should fill 2MB starting at address 0xC00000 with "hello world".

unsigned char far * p_mem;
void dummyfunc(void);

void dummyfunc()
{
  p_mem = (unsigned char far *)0xC00000;
  while (p_mem < (unsigned char far *)0xE00000)
  {
    sprintf(p_mem,"hello world");
    p_mem = p_mem+sizeof("hello world");
  }
}

Powered by Ploneboard