data memory mapping microblaze

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? 
A: Top-posting. 
Q: What is the most annoying thing on usenet and in e-mail?
Reply to
alb
Loading thread data ...

Hi all,

alb wrote: []

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

Message-ID: Subject: MicroBlaze program memory vs data memory

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

Al

Reply to
alb

Hi Tim,

Tim Wescott wrote: []

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.

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'.

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.

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.

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

Reply to
alb

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
Reply to
Tim Wescott

Hi Tim,

Tim Wescott wrote: []

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

formatting link

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]
formatting link
[2]
formatting link
[3]
formatting link
Reply to
alb

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 
http://www.wescottdesign.com
Reply to
Tim Wescott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.