#960 initializing code data at fixed address

closed-later
nobody
5
2014-08-26
2005-07-29
Anonymous
No

In my C code, when I write at the last lines :

struct IDT_s
{
uint8_t ljmp;
void (*function)(void);
};

code at 0x10000 - sizeof(struct IDT_s) struct IDT_s IDT
= {LJMP_OPCODE, soft_interrupt};

where soft_interrupt is a function with prototype :

void soft_interrupt (void);

sdcc correctly set the address of IDT to be able to
referance it in the code but do not initialize the value.

the .ihx file do not contain any line to set the
addresses 0xFFFD with LJMP_OPCODE, 0xFFFE with
soft_interrupt >> 8 and 0xFFFF with soft_interrup.

And the assembly generate code does not seem to contain
any initialization code.

you will find attached to this mail 4 files "config"
"Makefile", "updater.c" and "updater.ihx".

just type make to generate evry other ones.

I currently use :

SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.1 #1058 (Jul 13 2005) (UNIX)

If you want to contact me my e-mail address is :

henri@data-tools.com

Best regards, and sorry for my poor english.

Discussion

  • Nobody/Anonymous

    An archive containing mentionned files.

     
  • Maarten Brock

    Maarten Brock - 2005-07-29

    Logged In: YES
    user_id=888171

    This is already RFE 859412.

    But there is a work-around in SDCC 2.5.2. Put this line in a
    separate file idt.c

    code struct IDT_s IDT = {LJMP_OPCODE, soft_interrupt};

    compile it with:

    sdcc --codeseg IDTSEG -c idt.c

    and link it with:

    sdcc -Wl-b IDTSEG=0xFFFD updater.rel config.rel idt.rel

    Hope this helps,
    Maarten

     
  • Maarten Brock

    Maarten Brock - 2005-07-29
    • status: open --> closed-later
     
  • Jesus Calvino-Fraga

    Logged In: YES
    user_id=603650

    Hummm, at the very end of your source file you could add the
    code below (otherwise any code after this function will be at
    an absolute code area, not a relocatable one):

    void my_dummy_function (void) _naked
    {
    _asm
    .area MYAREA (ABS)
    .org 0xfffd
    ljmp _soft_interrupt
    _endasm;
    }

    With this code you will receive a warning:

    "warning: extended linear address encountered; you probably
    want the -r flag."

    because the program counter after the ljmp is 0x10000, but
    that is ok and harmless. (You won't get the warning if you
    place the code at address 0xff00 for example) Any other
    relocatable code segments will be concatenated after
    whatever you pass using --code-loc (default is 0), and the hex
    file will have a record with the ljmp at the right address:

    [...]
    :0EFC0100759850759110758920758DCAD28E38
    :04FC0F00438E1022EE
    :03FFFD0002F524E6 <---Here it is!
    :0EFC87005374617274206F66206D656D6F722C
    :0AFC9500792064756D70203A0A00B2
    [...]

    Jesus

     
  • Nobody/Anonymous

    Logged In: NO

    Thanks for all.
    For now I use jesusc work-around, which work quiet well.

    Henri

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks