Personal tools
You are here: Home Forums R8C/Tiny ldintb from C

ldintb from C

Up to R8C/Tiny

ldintb from C

Posted by Bruce Douglas at August 24. 2008

Hi there,

I am working on a bootloader for the AA device, and I would like to switch vector tables in my main app.

In sect30.inc, I have the following sequence:

...

        .section        itable_NE,ROMDATA
.glb    APP_VECTOR
APP_VECTOR      .equ    04020H
        .org            APP_VECTOR;   this area stores the second interrupt table
    .lword    dummy_int        ; vector 0
    .lword    dummy_int        ; vector 1

...


From my main app, I am changing vector tables using the following command:

asm("    ldintb    #4020h");


Personally, I would prefer to switch tables using the const APP_VECTOR, however, whenever I try to implement something like:

asm("     ldintb   #$$", APP_VECTOR);

the compiler will complain either of the fact that I haven't marked APP_VECTOR as extern, or that it isn't a constant (along with another 250 errors from that statement).

What is the proper syntax for setting up the ldintb instruction from C?

Thanks.



Re: ldintb from C

Posted by Icecap at August 25. 2008
An asm("") is NOT a C-instruction, it's a "pure text-insert" into the compiling process. And afaik all labels/consts in C are preloaded with an underscore in asm, thus: asm(" ldintb #_APP_VECTOR"); could possibly be correct if APP_SECTOR is defined in C. But it seems like You define that in asm, thus it should be: asm(" ldintb #APP_VECTOR"); But I might be wrong...

Re: ldintb from C

Posted by FrankL at August 26. 2008

Use HEW to generate an application with C Startup code and check how it is done there. This application does exactly what you are looking for.

Powered by Ploneboard