Assembly code porting from GCC with Cosmic to CodeWarrior

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Assembly code porting from GCC with Cosmic to CodeWarrior

832 次查看
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 回复

815 次查看
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 项奖励
回复