avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Linker script patch to handle __flashN [Was: Handling


From: Georg-Johann Lay
Subject: Re: [avr-gcc-list] Linker script patch to handle __flashN [Was: Handling __flash1 and .trampolines]
Date: Thu, 13 Dec 2012 14:26:33 +0100
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

Erik Christiansen schrieb:

Here are two test cases based on one source code example compared with
Johann's requirements for the script behaviour.

Here is more torture.  Assemble with, e.g.

$ avr-gcc flash.sx -o flash.elf -DSTUBS=10 -DP1=0x200 -DTEXT=0x20000 -mmcu=atmega2560 -Wl,-Map,flash.map
$ avr-objdump -d -j .text -j .data flash.elf > flash.lst

Following macros are recognized:

P0, P1, P2, P3 : bytes of data in respective .progmem
TEXT, LOWTEXT  : bytes added to .text, .lowtext
STUBS          : generate code that might need STUBS stubs

TEXT is not the complete .text site because startup code and STUBS and more like _exit will add.

Notice that most users let the driver (avr-gcc) call the linker to supply it with the right options and multilibs.



The driver knows how to handle -T, see the output with -v

Johann
#ifndef TEXT
#define TEXT 0
#endif

#ifndef LOWTEXT
#define LOWTEXT 0
#endif

#ifndef STUBS
#define STUBS 0
#endif

#ifndef P0
#define P0 0
#endif

#ifndef P1
#define P1 0
#endif

#ifndef P2
#define P2 0
#endif

#ifndef P3
#define P3 0
#endif

.macro Flash n num
    .section .progmem\n\().data.foo\n\(),"a",@progbits
    .global flash\n\()_start
    .type flash\n\()_start,@object
    flash\n\()_start:
        .fill \num
    .size flash\n\()_start, .-flash\n\()_start
.endm


Flash  , P0
Flash 1, P1
Flash 2, P2
Flash 3, P3

.text
.global main
main:
.rept TEXT / 2
    nop
.endr
    
.rept STUBS
    0:
    ldi r16, lo8(gs(0b))
    ldi r17, hi8(gs(0b))
.endr
.size main, .-main


.section .lowtext,"ax",@progbits
.global lowfunc
lowfunc:
.rept LOWTEXT / 2
    nop
.endr
.size lowfunc, .-lowfunc

reply via email to

[Prev in Thread] Current Thread [Next in Thread]