I am using a version of the TINIm400 and the TINIs400 reference design with an FPGA connected to CE3 and CE4.
I wish to access the registers I have placed in the FPGA but am wondering how to do it. I assume by default the FPGA is effectively at 0x60 0000 (for CE3) but how do I place a variable at this address so I can access with a C instruction.
on the command line: sdcc -c -mds400 --model-flat24 --stack-10bit --no-xinit-opt main.c
I get this error: main.c:13 error: illegal cast of LITERAL value to 'generic' pointer from type 'literal-long-int' to type 'struct __00010000 generic* '
which essentially doesn't like: regs = (FPGA_REGS *)(0x600000);
Although I have written a fair amount of code I am not that knowledgable of how to assign a varaible to a location and compilers sometimes treat things differently. This request is perhaps unusual for a 8051 processor which has a 24 bit linear addressing mode.
The 8051 family addressing can be a pain ... you probably need to qualify the type of pointer being created. Your FPGA is probably in xdata memory space.
I've never used the SDCC compiler, but you probably need to do something like this to explain that you're creating a pointer to xdata (far) memory:
After looking at it, that might not work. You may have to specify the size of the regs item. Like this: xdata at 0x600000 volatile UC regs[put size here];
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.