[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:[microblaze-uclinux]writing into main memory(in uClinux)





hi yashi

 thanks for your suggestion..i changed the code 
and typecasted the mem locations to 'unsigned char *'
..and it works fine now...i looked at the assembly
generated in both cases and as u observed 
'sw' was being used instead of 'sb'....

my doubt here is..as far as writing to the screen goes
does this really matter?..i mean if its an 'int*' or a 'char*'..here is the assembly when i use (unsigned char *)location...
.....
.....
main:
        .frame  r19,16,r15              # vars= 8, regs= 1/0, args= 0, extra= 0
        .mask   0x00080000,-4
        addik   r1,r1,-16
        swi     r19,r1,12
        addk    r19,r1,r0
        addik   r3,r0,-2080768  # 0xffe04000
        sw      r3,r0,r19
        lw      r3,r0,r19
        addik   r4,r0,1 # 0x1
        sb      r4,r0,r3
        lw      r4,r0,r19
        addik   r3,r4,1
        sb      r0,r0,r3
        lw      r4,r0,r19
        addik   r3,r4,2
        addik   r4,r0,1 # 0x1
        sb      r4,r0,r3
        addk    r3,r0,r0
        bri     $L2
........
........
........

apart from
this there was another bug in the hw framebuffer driver
which was resulting in those 'patterns' appearing
on the vga screen...now after both are fixed it is fine..
i am able to see as many dots as i write to..not more not less..:-)..btw...we are using 1 bit per pixel(monochrome)..
..so each bit will have an address location that is unique..


Thanks and Regards

V.Anand
(www.tenet.res.in)










At 13 Sep 2004 07:26:23 -0000,
>anand_12 wrote:
>[...]
>> 1. is the above piece of code correct to write to a particular location in memory?
>
>it'd be nice to have volatile. also location should be unsigned.
>
>> 2. can user apps directly write to absolute addresses in main memory (with uClinux)?
>
>yes.
>
>> 3. if yes,then why is it that multiple pixels are getting enabled
>> when infact i am writing only a byte using a resolution of 320x240(1
>> bit per pixel)?
>
>don't know ;)
>
>seriously, are you accessing word aligned address? if you access byte
>aligned address to write a byte data, use "unsigned char *"
>instead. (this generates assembly code with `sb' instead of `sw')
>
>if you have a doubt in your code, see generated assembly code.  if the
>generated assembly code represents what you inteded to do, and also
>doesn't have any fault according to MicroBlaze Processor Reference
>Guide, there might be a bug in the cpu.
>
>>  thanks for any help in this regard
>> 
>> if it helps,when the same code is executed directly on hardware
>> without uClinux,it works perfectly fine..i mean only that particular
>> pixel is enabled...so what i essentially see a dot on the top left
>> corner of the vga monitor...i guess my understanding of how uclinux
>> handles memory is still unclear...any pointers are most welcome!!.
>
>hmm... I've seen a symptom; a value in a register changes when I just
>read. I still can't make test code for this.
>
>I'm not sure this is the same symptom.
>
>best,
>--
>        yashi
>___________________________
>microblaze-uclinux mailing list
>microblaze-uclinux@itee.uq.edu.au
>Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
>Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
>
>
****************************************
"Being happy doesn't mean that everything is perfect... It just means that
you have decided to see beyond the imperfections"  --  Rash

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/