- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My intention is to define a variable on a specific address which is connected to io bus.
So that everytime i place a value in the variable it will automaticly route itself to the io's thanksLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) Define the symbol value in the linker script, eg:
/* Address of systom monitor - interrupts and timers/counters.
* Mapped to be accessible as offsets from %gp.
* See nios_sysmon.h */
nios_sysmon = 0x20000;
2) Define an absolute symbol in a assembly source file: eg (I think): .global nios_sysmon
.equ nios_sysmon,0x20000
This should also work inside an asm() statement in a C file - even in a .h file. Remember to make the C variable 'volatile' and to define an address that will bypass the data cache - my example above is real, but I don' use the data cache. Such 'direct access' to variables requires 2 instructions (because the NIOS doesn't have 32bit address offsets). The compiler can't know that multiple variables are in nearby addresses - so has to generate separate addresses for each - which adds a lot of register pressure (as well as a few extra instructions). I arranged for my IO and tightly coupled data memory to be accessable from %gp - but had to fix the compiler so that it would add structure offsets into the offset from %gp (ok because if the start of an item is in the 'small data area' then so must be the end).
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page