[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] moving assembly code to the bootloader section
From: |
Erik Christiansen |
Subject: |
Re: [avr-gcc-list] moving assembly code to the bootloader section |
Date: |
Thu, 18 Mar 2004 11:58:31 +1100 |
User-agent: |
Mutt/1.3.28i |
On Wed, Mar 17, 2004 at 03:10:50PM -0800, Kevin Vanwulpen wrote:
> (I can succefully link regular code with assembly, I can put a C-bootloader
> in the bootloader section but linking assembly so it ends up in the
> bootloader is something I don't seem able to get to work).
>
> The beginning of bootloader.s looks like this:
>
> .section .bootloader
> .global bootloader
> bootloader:
The problem may be no more that the missing "a" (see below), but does
your linker script have something like:
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = 62K
boot (rx) : ORIGIN = 62K, LENGTH = 2K /* OK for ATmega64 */
data (rw!x) : ORIGIN = 0x800100, LENGTH = 4K
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 2K
}
SECTIONS
{
...
.boot :
{
*(.boot_vectors) /* If you like to make this separate. */
*(.bootloader)
} > boot
...
}
> (I have tried putting ,"x",@progbits behind the .section .bootloader without
> success)
Assuming an ELF output format, my guess is that this is your problem.
Try changing "x" to "ax". Then the loader will know it should load the
section.
> The interesting thing is that avr-size actually tells me the correct size
> and offset for my bootloader but... when I open the output binary in a hex
> editor and go to the address where the bootloader starts there is nothing
> there (contrary to when I use a bootloader written in C), which utterly blew
> me away honestly speaking.
I've never tried avr-size, but "avr-objdump -h" shows the size,
run-address (VMA), and load address (LMA) of each section. It also
reveals whether each section will be allocated to memory. e.g.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000607e 00000000 00000000 00000094 2**3
CONTENTS, ALLOC, LOAD, READONLY, CODE
...
5 .stab 0000f7bc 00000000 00000000 000061a0 2**2
CONTENTS, READONLY, DEBUGGING
The .text section is "ALLOC, LOAD", but the debugging gumpf (.stab) is
naturally not. What does it say for your .bootloader section?
HTH,
Erik
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list