Re: Linker script patch to handle __flashN [Was: Handling __flash1 and .trampolines]

Georg-Johann Lay <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
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

_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
flash.sx (text/plain, 797 B)
#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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.