data memory mapping microblaze

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi everyone,

I'm dealing with an mb-lite which is clone of the microblaze  
architecture and I'm trying to understand how the memory mapping works.

We have memory mapped registers which are needed to exchange data  
between the uP and the FPGA and it should be pretty straight forward to  
map this memory into a segment in 'data memory', but unfortunately it  
seems the object-dump does not seem to show anything but a list of  
segments with no distinction between 'data memory' and 'instruction  
memory'.

IIRC on similar Harvard Architectures (like the ADSP21xx) you could  
write the linker script to store data and instructions.

I'm using a mb-gcc and I've looked to the ld refernce, but how can you  
specify that a set of registers need to go to the data memory to a  
specific address? Or is it implicitely assumed that .data segments would  
go to a 'data memory'?

Anyone with any pointer?

Al

--  
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
We've slightly trimmed the long signature. Click to see the full one.
Re: data memory mapping microblaze [disregard]
Hi all,

[]
Quoted text here. Click to load it

please disregard this thread since it is essentially covered by the  
following:

Subject: MicroBlaze program memory vs data memory

Apologize for stepping on somebody else's foot, I missed it when reading  
the latest articles.

Al

Re: data memory mapping microblaze
Hi Tim,

[]
Quoted text here. Click to load it

I'm doing it for you, since I believe c.a.e. is more appropriate. It's  
kind of funny the thread picked up more momentum here than there.

Quoted text here. Click to load it

Not really. Being able to map registers into a specific location is an  
important thing, but here the subject is a bit different.

On an Harvard Architecture data memory and program memory are simply two  
different worlds. They can both start at location 0x00000000, but I  
didn't find a way to say that to the linker without getting a  
'memory/section overlap'.

Quoted text here. Click to load it

I knew Ganssle from 'The Art of Embedded Systems Designs', a must, but I  
wasn't aware about Barr, I'll definitely have a look at his advices.

Quoted text here. Click to load it

Actually I need to map the 'real memory', memory mapped registers are  
just the second in line, but they should follow the same 'reasoning'.

I have a data memory space and I want to place it at address 0, but it  
ain't working (section overlap). One thing I thought about was tricking  
the linker into thinking that pm and dm are in different locations but  
since I do not need 32bit address for my embedded system I can say  
0x00000000 for pm and 0x80000000 for my dm. Say only 20bit for the dm  
address are used, I can safely say that my dm really starts from  
physical address 0. But is that really ortodox? It sounds a nasty  
workaround to me.

Quoted text here. Click to load it

Interesting, but how do you make sure you don't incur into memory  
overlaps? I used to have some sort of BASEADDRESS and refer all  
addressing w.r.t. it:

#define REGISTER_0 (*((volatile int32_t *)(BASEADDRESS + 0x00000000)))
#define REGISTER_1 (*((volatile int32_t *)(BASEADDRESS + 0x00000004)))

still there's high risk that you may fall into temptetion to change the  
type without readjusting the address location.
An alternative might be doing something like:

#define REGISTER_0 (*((volatile int32_t *)(BASEADDRESS + 0*sizeof(int32_t))))
#define REGISTER_1 (*((volatile int32_t *)(BASEADDRESS + 1*sizeof(int32_t))))

but again you need to be rigourous, should a change in type occourr, to  
change both the type and the address.

Anyway, this is off topic since I'm not able to specify the dm address  
for .data section and others.

Al

Re: data memory mapping microblaze
On Sun, 08 Feb 2015 21:38:37 +0000, alb wrote:

Quoted text here. Click to load it

This is a question for someone who's much more of a linker wonk than I am.

Have you tried Googling on "ld" and "Harvard architecture"?

--  
www.wescottdesign.com

Re: data memory mapping microblaze
Hi Tim,

[]
Quoted text here. Click to load it

I did and I got some interesting hits on the AVR which is also Harvard:

[http://www.nongnu.org/avr-libc/user-manual/mem_sections.html#harvard_arch ]
Quoted text here. Click to load it

I'm not sure if this is all about it.

Another hit on a mailing list [1] reported the option -no-check-sections  
which allows to have .data and .text starting both at 0x0, but it would  
be too dangerous to silent this error and find yourself with two data  
sections overlapping.

There's another hit here [2] which might also be interesting but is more  
about having to do with putting .data section into flash.

And after some more search I believe this [3] does shed some light...not  
sure if enough!

Al

[1] http://sourceware.org/ml/binutils/2001-04/msg00366.html
[2] http://www.embeddedrelated.com/groups/lpc2000/show/54079.php
[3] http://www.atmel.com/webdoc/AVRLibcReferenceManual/pgmspace_1pgmspace_introduction.html

Re: data memory mapping microblaze
On Mon, 09 Feb 2015 17:36:25 +0000, alb wrote:

Quoted text here. Click to load it
mem_sections.html#harvard_arch]
Quoted text here. Click to load it
pgmspace_1pgmspace_introduction.html

It might be worth it to figure out what is the right mailing list to get  
onto, subscribe, and then ask your question.

It'll probably be better to ask "Using ld for Harvard architectures", or  
"Using ld for two independent memory spaces" -- the reason that I ignored  
your original post was because I don't know, or care about, Microblaze.

--  

Tim Wescott
Wescott Design Services
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline