Is there a particular way I am supposed to type out commands in asm(); ?

asm (

    *"SET R30, R30, 0x15"*

);


  

Assembly statement "SET R30, R30, 0x15"

   creates a label, which may not be what was intended.


On Monday, November 6, 2017 at 3:42:17 AM UTC+5:30, Przemek Klosowski wrote:
>
>
>
> On Sun, Nov 5, 2017 at 10:07 AM, Alek Mabry <[email protected] 
> <javascript:>> wrote:
>
>>
>>
>> However in the C code, I have no idea what it's actually doing in 
>> assembly.
>>
>> Take a function for example, if I make a void function, will the 
>> assembler have a command that jumps to that part of the code, and then 
>> jumps back (adding two cycles or so), or will it just insert that code into 
>> wherever the function is called?
>>
> Well, the C compiler is just essentially generating machine code, just 
> lilke assembler---it's just that in assembler you specify the instructions, 
> so there's a simple 1:1 correspondence. You can force the compiler to list 
> the generated assembly and count instructions. You can also inject assembly 
> into your function using asm() compiler extensions; typically, you would 
> insert such assembly in the middle of a function. You can also call your C 
> functions from such assembly but it's a little tricky because you have to 
> observe the compiler ABI for register saving, stack operations and 
> parameter passing.
>
>>
>> Is there any way to force the C program to do something in a specified 
>> number of cycles, figure out how many cycles the C code is taking, or just 
>> write assembly for time-critical parts directly into the C code itself?
>>
> You can inspect the generated code, and count instructions to get the 
> cycles. You obviously can't force the compiler to use less cycles than it 
> already uses in an optimized compile, but you can in principle pad with 
> NOPs to artificially increase the cycle count. 
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/42c4d0ae-3720-4861-afc8-a5200b65dbed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to