asm branch out of range

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

asm branch out of range

ソリューションへジャンプ
2,099件の閲覧回数
michaelhuslig
Contributor IV

I am trying to port an "asm void function(){}" in a C file from CW to KSDK.  The latter half of the converted function is below.  However I am getting a branch out of range error for the second instruction, the "cbz r0,noshift".  This is the only forward reference for any branch in the routine;  the reverse references, such as the "bne shiftloop" don't have a problem.  Actually, I would prefer to move the routine to a .S file and make it a pure assembly language routine and avoid the extra overhead at the beginning and end of the C routine, but then I have other problems with the assembler not recognizing several of the asm instructions that the compiler recognizes, such as push/pop {r0-r11,lr}.

 

 

__asm("str   r1,[r2,#4]");

 

    __asm("cbz   r0,noshift");
    __asm("ldr   r2,[sp,#2*4]");   
    __asm("ldr   r0,[sp,#0]");  
    __asm("asr   r2,r2,#2");

shiftloop:

    __asm("ldr   r3,[r0,#8]");
    __asm("ldr   r4,[r0,#12]");
    __asm("str   r3,[r0,#0]");
    __asm("str   r4,[r0,#4]");
    __asm("add   r0,#8");   
    __asm("sub   r2,#1");   
    __asm("bne   shiftloop");

   

noshift:

    __asm("pop   {r0-r11,lr}");
    __asm("bx   lr");

}

ラベル(1)
0 件の賞賛
返信
1 解決策
1,838件の閲覧回数
michaelhuslig
Contributor IV

I don't know about the forward reference, but I did find out why I was getting errors on the push/pop instructions.  I needed to add ".syntax unified" to the .S file.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,839件の閲覧回数
michaelhuslig
Contributor IV

I don't know about the forward reference, but I did find out why I was getting errors on the push/pop instructions.  I needed to add ".syntax unified" to the .S file.

0 件の賞賛
返信