Hello World_ I am working on my special bootloader project, i am having difficulty jumping to a assembler label from my main C function. Let me illustrate what i am attempting to do... ****Assembly***** XDEF UseBootCode UseBootCode: clr COPCTL ; disable watchdog ; BootCopy: lds #StackTop ; initialize the stack pointer ldx #BootStart ; point to the start of the Flash bootloader in Flash. ldy #RAMBoot256 ..etc...etc.. ***** main.c ****** #define JumpBootCode {__asm JMP UseBootCode:;} void main(void){ JumpBootCode; } ******************** I get the errror ---> "C10035: C Object Expected" I am not very experienced with assembler so this one may be a easy one to solve.. Thanks, John Pitito. PS. What happens to you guys (in the states) over Thanksgiving?? When does the holiday start and stop? |
|
Codewarrior C/assembly inline statements
Started by ●November 27, 2003
Reply by ●November 27, 20032003-11-27
Hi John. Here below, an "asm and C mixed" base project created with CodeWarrior V3.0 stationery wizard. (Note: the project below is compiled using "banked" memory model, -Mb option). Regards, Gilles PS. Our Dept. is based in Europe. No Thanksgiving holiday here :-( /*** main.asm file start ************************************************/ ;************************************************************** ;* This stationery serves as the framework for a * ;* user application. For a more comprehensive program that * ;* demonstrates the more advanced functionality of this * ;* processor, please see the demonstration applications * ;* located in the examples subdirectory of the * ;* Metrowerks CodeWarrior for the HC12 Program directory * ;************************************************************** ; export symbols XDEF asm_main ; we use export 'Entry' as symbol. This allows us to ; reference 'Entry' either in the linker .prm file ; or from C/C++ later on ; variable/data section MY_EXTENDED_RAM: SECTION ; Insert here your data definition. For demonstration, temp_byte is used. temp_byte ds.b 1 ; code section MyCode: SECTION ; this assembly routine is called by the C/C++ application asm_main: CLI ; enable interrupts MOVB #1,temp_byte ; just some demonstration code NOP ; Insert here you own code RTC ; return to caller /*** main.asm file end ************************************************/ /*** main.c file start ************************************************/ #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void main(void) { /* put your own code here */ EnableInterrupts; asm_main(); /* call the assembly function */ for(;;) {} /* wait forever */ } /*** main.c file end ************************************************/ At 06:52 AM 11/27/2003, you wrote: >Hello World_ > >I am working on my special bootloader project, i am having difficulty >jumping to a assembler label from my main C function. Let me >illustrate what i am attempting to do... > >****Assembly***** > > XDEF UseBootCode > >UseBootCode: > clr COPCTL ; disable watchdog >; >BootCopy: lds #StackTop ; initialize the >stack pointer > ldx #BootStart ; point to the start of the >Flash bootloader in Flash. > ldy #RAMBoot256 >..etc...etc.. > >***** main.c ****** > >#define JumpBootCode {__asm JMP UseBootCode:;} > >void main(void){ > >JumpBootCode; > >} > >******************** > >I get the errror ---> "C10035: C Object Expected" > >I am not very experienced with assembler so this one may be a easy >one to solve.. > >Thanks, > >John Pitito. > >PS. What happens to you guys (in the states) over Thanksgiving?? When >does the holiday start and stop? > >-------------------- > >">http://docs.yahoo.com/info/terms/ |