Forum Discussion
Altera_Forum
Honored Contributor
12 years agoActually you can make it even simpler (and generate better code).
If you assign known fixed addresses to your peripherals then you can safely define the addresses in the linker script. eg:my_peripheral = 0x81000000; Your C can then contain: struct {
volatile int reg;
};
extern struct my_peripheral;
...
x = my_peripheral.reg; If you don't have a data cache and can arrange for the 'small io' and tightly coupled memory to be within 64k you can put everything in .sdata sections and have efficient access from the gp register. Alternatively grab the patch to ld I posted a couple of weeks ago and put your 'small io' above 0x7fff8000 (above 0xffff8000 for uncached access) so that it can be accessed by a small offset from r0. (Without a data cache below 0x8000 works just as well and probably uses less logic.)