Hi,

Following my last post, I noticed that libraries (libc) are located
below the "64K" limit, in ".text" section!
My first question is; How to put them inside the ".fartext" section to
save memory space for datas ?

Should I recompile all msp430-libc with specify "FAR" attribute to any functions declaration ?

I use Objdump to see what the compiler does ! In the ".text" section I
have all mixed informations :  source and disassemby language, but on
".fartext" section I have only disassembly language !
It's seem that there is a confusion between ".text" and ".fartext" addresses in objdump (binutils)!

To see what's happen, I force the start ".fartext" section address at 0x15C00 (0x5C00 + 0x10000) !

I made a example :

In lower memory space:
0x05C36    : My_Asm_add_function_in_text
0x05C3A    : My_C_sub_function_in_text

In upper memory space:
0x15C00     :My_Asm_add_function_in_fartext
0x15C04    : My_C_sub_function_in_fartext
0x15C08    : main

I have all mixed Informations on both section at same place for lower memory and only disassembly language for high memory !

Disassembly of section .text:

00005c00 <__init_stack>:
    5c00:    31 40 ee 5b     mov    #23534,    r1    ;#0x5bee

00005c04 <__low_level_init>:
    return a - b;
}

CODE
int My_C_sub_function_in_fartext(int a, int b)
{
    5c04:    b2 40 80 5a     mov    #23168, &0x015c    ;#0x5a80
    5c08:    5c 01

00005c0a <__do_clear_bss>:
}


CODE
int main(void)
{
    5c0a:    3f 40 00 00     mov    #0,    r15    ;#0x0000
int volatile a = 10, b = 20;
    5c0e:    0f 93           tst    r15
    5c10:    04 24           jz    $+10         ;abs 0x5c1a
    5c12:    1f 83           dec    r15
5c14: cf 43 00 1c mov.b #0, 7168(r15);r3 As==00, 0x1c00(r15)

while (1)
    {
    // main loop
    a = My_Asm_add_function_in_text(a, b);
    5c18:    fc 23           jnz    $-6          ;abs 0x5c12

00005c1a <__do_copy_data>:
    5c1a:    3f 40 00 00     mov    #0,    r15    ;#0x0000
    5c1e:    0f 93           tst    r15
    5c20:    06 24           jz    $+14         ;abs 0x5c2e
    5c22:    2f 83           decd    r15
5c24: 40 18 9f 4f movx 23616(r15),7168(r15);0x05c40(r15), 0x01c00(r15)
    5c28:    40 5c 00 1c

    a = My_C_sub_function_in_text(a, b);
    5c2c:    fa 23           jnz    $-10         ;abs 0x5c22

00005c2e <__jump_to_main>:
    5c2e:    80 01 08 5c     bra    #0x15c08

00005c32 <__ctors_end>:
    5c32:    80 00 3e 5c     bra    #0x05c3e

00005c36 <My_Asm_add_function_in_text>:

    b = My_Asm_add_function_in_fartext(a, b);
    5c36:    0f 5e           add    r14,    r15
    5c38:    10 01           reta

00005c3a <My_C_sub_function_in_text>:
int My_Asm_add_function_in_fartext(int a, int b);


int My_C_sub_function_in_text(int a, int b)
{
    return a - b;
    5c3a:    0f 8e           sub    r14,    r15
}
    5c3c:    10 01           reta

00005c3e <_unexpected_>:
    5c3e:    00 13           reti

Disassembly of section .fartext:

00015c00 <My_Asm_add_function_in_fartext>:
   15c00:    0f 5e           add    r14,    r15
   15c02:    10 01           reta

00015c04 <My_C_sub_function_in_fartext>:
   15c04:    0f 8e           sub    r14,    r15
   15c06:    10 01           reta

00015c08 <main>:
   15c08:    31 40 ea 5b     mov    #23530,    r1    ;#0x5bea
   15c0c:    b1 40 0a 00     mov    #10,    0(r1)    ;#0x000a, 0x0000(r1)
   15c10:    00 00
   15c12:    b1 40 14 00     mov    #20,    2(r1)    ;#0x0014, 0x0002(r1)
   15c16:    02 00
   15c18:    1e 41 02 00     mov    2(r1),    r14    ;0x0002(r1)
   15c1c:    2f 41           mov    @r1,    r15
   15c1e:    b0 13 36 5c     calla    #0x05c36
   15c22:    81 4f 00 00     mov    r15,    0(r1)    ;0x0000(r1)
   15c26:    1e 41 02 00     mov    2(r1),    r14    ;0x0002(r1)
   15c2a:    2f 41           mov    @r1,    r15
   15c2c:    b0 13 3a 5c     calla    #0x05c3a
   15c30:    81 4f 00 00     mov    r15,    0(r1)    ;0x0000(r1)
   15c34:    1e 41 02 00     mov    2(r1),    r14    ;0x0002(r1)
   15c38:    2f 41           mov    @r1,    r15
   15c3a:    b1 13 00 5c     calla    #0x15c00
   15c3e:    81 4f 02 00     mov    r15,    2(r1)    ;0x0002(r1)
   15c42:    1e 41 02 00     mov    2(r1),    r14    ;0x0002(r1)
   15c46:    2f 41           mov    @r1,    r15
   15c48:    b1 13 04 5c     calla    #0x15c04
   15c4c:    81 4f 02 00     mov    r15,    2(r1)    ;0x0002(r1)
   15c50:    e3 3f           jmp    $-56         ;abs 0x5c18



Regards, Thierry

------------------------------------------------------------------------------
This SF Dev2Dev email is sponsored by:

WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to