Hello,

On 1/12/07, Mary-Ann Johnson <[EMAIL PROTECTED]> wrote:
> I'm porting some 8051 assembler into C, and I need to locate some
> functions at specific memory locations.
Try something like the following:

#define BEGIN_CODE_ABS_LOCATION(uniqueName, address)    \
void _##uniqueName##_Begin(void) _naked                 \
{                                                       \
        _asm                                            \
                .area ABSCODE (ABS,CODE)                \
        _endasm;                                        \
        _asm                                            \
                .org address                            \
        _endasm;                                        \
}

// return to normal mode by using this macro.
#define END_CODE_ABS_LOCATION(uniqueName)               \
void _##uniqueName##_End(void) _naked                   \
{                                                       \
        _asm                                            \
                .area CSEG (REL,CODE)                   \
        _endasm;                                        \
}

BEGIN_CODE_ABS_LOCATION(Task0, 0xABCD)  // NOTE:  No semicolon!
void Task0 ()
{
}
END_CODE_ABS_LOCATION(Task0)            // NOTE:  No semicolon!


I have copied it from a post on sdcc-user a long time ago but i don't
remember the author :)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to