Re: [Flashforth-devel] building flashforth with avra?
Brought to you by:
oh2aun
|
From: Christopher H. <chr...@li...> - 2021-05-10 14:03:07
|
Hi, I think I'm getting fairly close to figuring this out. Aiming at
first for output on the 328p, I found the default avr5.x linker script
in avr-binutils sources. I seem to be able to accomplish what I want
adding a section like so:
.nrww ADDR(.text) + __TEXT_REGION_LENGTH__ - 0x400 :
{ PROVIDE (__nrww_start = .)
; *(.nrww) *(.nrww*) *(COMMON) PROVIDE (__nrww_end = .)
; } > text
and running
avr-gcc --verbose -mmcu=atmega328p -I. -D__ATmega328P__ -x assembler-
with-cpp -nostartfiles -T linker/avr5.x ff-libre.asm -o 328p.out
I was wondering though if you could help me with two questions:
(1) Is there a significant difference between the following?
.nrww ADDR(.text) + __TEXT_REGION_LENGTH__ - 0x400 :
and
.nrww ADDR(.text) + __TEXT_REGION_LENGTH__ - 0x400 : AT (ADDR
(.nrww))
(2) To make this work specifically for 328P, I had to adjust the linker
script line
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ?
__TEXT_REGION_LENGTH__ : 128K;
to
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ?
__TEXT_REGION_LENGTH__ : 32K;
I thought I should be able instead to just pass in
-D__TEXT_REGION_LENGTH__=32K to avr-gcc, but that does work. If I try
that the address location of .nrww comes out to just before 128K. Do
you know how to properly pass in this define?
I suspect that this is a problem because I am using an entirely new
linker script, rather than just passing in the new section to augment
the default script. But I haven't learned yet how to pass in just one
new section to the linker. Maybe if I was doing that, then avr-gcc
would have the correct region lengths set for the particular chip I had
specified.
On Wed, 2021-05-05 at 09:29 +0300, Mikael Nordman wrote:
> Have you tried the linker option "-nostartfiles" ? That is what I am
> using to skip linking the "crt.s" file.
>
> On 2021-05-04 15:35, Christopher Howard wrote:
> > avr-ld: /home/christopher/.guix-
> > profile/avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined
> > reference to `main'
> >
--
Christopher Howard
blog: https://librehacker.com
social: https://gnusocial.club/librehacker
|