FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-29-2006, 08:49 AM
Marco T.
Guest
 
Posts: n/a
Default Storing variables into data ocm memory

Hallo,
I' developing a microcontroller based on powerpc.
the only way I know to store some variables into a specific region of memory
is instantiating them directly using the command:

unsigned char (*variable_name) = (unsigned char(*))XPAR_PERIPHERAL_BASEADDR;

There are other ways?

If use use the linker script there is a way to "choose" which variables
store into a certain region of memory?

Many Thanks
Marco


Reply With Quote
  #2 (permalink)  
Old 03-29-2006, 10:28 AM
Peter Monta
Guest
 
Posts: n/a
Default Re: Storing variables into data ocm memory

Hi Marco,

> If use use the linker script there is a way to "choose" which variables
> store into a certain region of memory?


Yes, you can use a linker script for this, together with
a gcc attribute to indicate which segment should receive
a given variable.

For example, somewhere in the linker script you could add

.. = 0x40000000;
..ocm : { *(.ocm) }

This creates a new segment, "ocm", starting at address 0x40000000
(or wherever your OCM is mapped). To actually cause variables
to be allocated to this segment, use something like

#define __ocm__ __attribute__((aligned(32),section(".ocm")))

and then declare your variables:

int __ocm__ foo;
int __ocm__ bar[128];

You can verify that these ended up in the ocm segment with objdump.
And you'll want "ld -T my_linker_script.ld"; google linker-script
for tutorials.

Cheers,
Peter
Reply With Quote
  #3 (permalink)  
Old 03-29-2006, 03:39 PM
Marco T.
Guest
 
Posts: n/a
Default Re: Storing variables into data ocm memory


"Peter Monta" <[email protected]> wrote in message
news:[email protected] et...
> Hi Marco,
>
>> If use use the linker script there is a way to "choose" which variables
>> store into a certain region of memory?

>
> Yes, you can use a linker script for this, together with
> a gcc attribute to indicate which segment should receive
> a given variable.
>
> For example, somewhere in the linker script you could add
>
> . = 0x40000000;
> .ocm : { *(.ocm) }
>
> This creates a new segment, "ocm", starting at address 0x40000000
> (or wherever your OCM is mapped). To actually cause variables
> to be allocated to this segment, use something like
>
> #define __ocm__ __attribute__((aligned(32),section(".ocm")))
>
> and then declare your variables:
>
> int __ocm__ foo;
> int __ocm__ bar[128];
>
> You can verify that these ended up in the ocm segment with objdump.
> And you'll want "ld -T my_linker_script.ld"; google linker-script
> for tutorials.
>
> Cheers,
> Peter


Many Thanks for your reply!
Marco


Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Memory Implementation Mahurshi Akilla Verilog 1 04-19-2007 05:26 AM
Streaming data to memory... Marwan Verilog 3 02-24-2007 08:37 PM
Storing a file onto FPGA Robert FPGA 24 10-22-2005 07:57 AM
storing convolution coeeff's Xilinx V2 8000 Geoffrey Wall FPGA 1 12-15-2004 09:12 PM
Re: Loading data into memory from a file Kevin Neilson Verilog 0 07-24-2003 10:12 PM


All times are GMT +1. The time now is 01:05 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved