Assembly code porting from GCC with Cosmic to CodeWarrior

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

Assembly code porting from GCC with Cosmic to CodeWarrior

1,245件の閲覧回数
June6
Contributor I

Hi,could you pls help me how to port below assembly code with Cosmic from GCC to CW?

#pragma section (text_aligned)
static void DelayAligned(uint16_t Count)
{
_asm("align 4,0x01\n$N: dbne d2,$L\n", Count);
}
#pragma section ()

Thank you 

Gavin

0 件の賞賛
返信
1 返信

1,228件の閲覧回数
lama
NXP TechSupport
NXP TechSupport

Hi,

if you have already read compiler manual (part of the CodeWarrior installation directory) you can find info that alignment of functions in C code project is possible only via PRM file where you can create special memory space in flash (aligned) and place function there. You can also find info about arguments passing which will lead you to following solution.

static asm void DelayAligned (unsigned int Count)   // D2 is used to store Count as argument before call of the function
                                                                                   // so it is directly used in the loop
{
loop1: dbne D2,loop1
}

You can then step the function call through assembler instructions steps and test to be sure it is working.

Best regards,

Ladislav

0 件の賞賛
返信