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?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
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:
I did and I got some interesting hits on the AVR which is also Harvard:
I'm not sure if this is all about it.
Another hit on a mailing list  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  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  does shed some light...not sure if enough!
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.