Writing in program area with PIC32

General questions about Firewing...

Writing in program area with PIC32

Postby Coccoliso » Fri Aug 24, 2018 11:54 am

Hi at all,
someone tried to use the program area of PIC32 to store some data ?
I found an example in the FW32 loader but my ASM is very limited and I have problems with these functions:
Code: Select all
private inline function mips_intr_disable() as uinteger   
    // asm volatile ("di   %0" : "=r" (status))
    dim status as uinteger = 0
    asm
      di   %0 :  "=r" (status)
    end asm
    return status
end function

private inline sub mips_write_c0_register(reg as uinteger, sel as uinteger, value as uinteger)
   // asm  volatile ( "mtc0   %z0, $%1, %2 \n ehb" : : "r" ((unsigned int) (value)), "K" (reg), "K" (sel))
   asm
      mtc0   %z0 , $%1, %2 \n ehb : : "r"  ((unsigned int) (value)), "K" (reg), "K" (sel)
   end asm
end sub


I have many "undeclared (firs use in this function)" :(
In the generated assembler I find the ASM line as it should be but surely I did not understand how to define interface variables :roll:

.. or an alternative system to get the same result : disable the interrupts and then restore them to how they were before.
User avatar
Coccoliso
 
Posts: 171
Joined: Sat Sep 27, 2014 10:02 am

Re: Writing in program area with PIC32

Postby Coccoliso » Sun Oct 07, 2018 8:35 am

Sometimes if you leave a fixed thought and then come back to it after a while,
everything becomes clearer and more comprehensible

:D :D :D :D :D

Code: Select all
private inline function DisableInterrupts() as reg0
    asm
      di %0 : "=r" (reg0)
    end asm
    return reg0
//       volatile ("di   %0" : "=r" (status))
end function

private inline sub RestoreInterrupts(value as reg0)
   asm
      mtc0   %z0 , $12, 0 \n ehb : : "r"  ((unsigned int) (reg0))
   end asm
//       volatile ( "mtc0   %z0, $%1, %2 \n ehb" : : "r" ((unsigned int) (value)), "K" (reg), "K" (sel))
end sub

... and now dee_emulation_pic32 also works
User avatar
Coccoliso
 
Posts: 171
Joined: Sat Sep 27, 2014 10:02 am


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x