AnsweredAssumed Answered

What is the best way to import data from a .dat file?

Question asked by davage on Mar 10, 2010
Latest reply on Mar 11, 2010 by davage

Hello,

 

It's me again.  Now that you guy have helped me with my one problem, I have another.  In a .asm file I am trying to load my SDRAM memory with data from a .dat file.  I have had some success with the following code.

 

Load_SDRAM:

 

     .section sdram_mem;

 

     .BYTE2 DataArray[1024] = "C:\........\MyData.dat";

 

Load_SDRAM.end

 

I know that the file is being opened and the elements in the file are being counted, because during the build the compiler told me that I had 1023 elements in the file and I declared 1024 for my array.  But what I don't know is where is the data going, because the values in SDRAM don't match my .dat data.  So, what is the best way to import data from a .dat file?

 

Also, in my .ldf file I have declared the following for my SDRAM memory.

 

MEMORY

{

MEM_SDRAM { TYPE(RAM) START(0x00000004) END(0x04000000) WIDTH(8) }

}

 

PROCESSOR p0

{

     OUTPUT( $COMMAND_LINE_OUTPUT_FILE )

 

     SECTIONS

     {

          sdram_mem

          {

          INPUT_SECTION_ALIGN(4)

          INPUT_SECTIONS($OBJECTS(DataArray))

          } >MEM_SDRAM

     }

}

 

Now I just noticed, that I declared for the end value of my SDRAM to be 0x04000000, which is greater than the 64Mbytes in my SDRAM.  Could this be a potential problem?

 

Thanks,

 

Dave

Outcomes