This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in winarm?


hello all,

maybe this info is usefull for others, so i post it here.

it seems that the winarm toolchain is just a bit (better: a byte) different 
from the linux version.

memory layout is:

MEMORY 
{
        ram     : ORIGIN = 0x40000000, LENGTH = 64K     /* free RAM area        
*/
        flash   : ORIGIN = 0x80000000, LENGTH = 1M      /* FLASH ROM            
*/      
}

assuming the following section in the linker script (only a part shown here):

        .fastcode :
        {
                __fastcode_load = LOADADDR(.fastcode);
                __fastcode_start = .;
                /* functions with __attribute__ ((section 
(".text.fastcode")))*/
                *(.text.fastcode) 
        ...
        ...
                __fastcode_end = .;
        } >ram AT>flash

and this section in the startup assembly (again, only a part shown):

                /* Copy .fastcode & .data section (Copy from ROM to RAM) */
                ldr     R0, =__fastcode_load /*_etext*/
                ldr     R1, =__fastcode_start /*_data*/
                ...
                ...

the bug is that the MSB for __fastcode_load is correctly 0x80 on the linux 
toolchain, but 0xC0 on the windows toolchain.

a quick workaround is to "or" the address in R0 with 0x8FFFFFFF:

                ldr     R0, =__fastcode_load /*_etext*/
                ldr   r3, entry_mask    /* this and the next instruction are 
an workaround  */
                and   r0, r0, r3        /* for some ugly bug in winarm to 
force msb to 0x80 */

where:
entry_mask:     .word   0x8FFFFFFF

has anyone else seen this bug before? or am i missing something in the .ld?

anyway, this just shows that carefully inspecting a disassembly of the code in 
question is always a good thing (tm) ... ;-D

greets,

chris

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]