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
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