qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Frederic Konrad <konrad@adacore.com>, qemu-devel@nongnu.org
Cc: Frederic Konrad <frederic.konrad@adacore.com>,
	Michael Rolnik <mrolnik@gmail.com>,
	Joaquin de Andres <me@xcancerberox.com.ar>
Subject: Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
Date: Wed, 28 Apr 2021 21:17:50 +0200	[thread overview]
Message-ID: <7970a6ec-f5ac-bcc9-9184-d8450b64b116@amsat.org> (raw)
In-Reply-To: <1619637319-22299-1-git-send-email-frederic.konrad@adacore.com>

Cc'ing Joaquín.

On 4/28/21 9:15 PM, Frederic Konrad wrote:
> According to the as documentation:
>  (https://sourceware.org/binutils/docs-2.36/as/AVR-Options.html)
> 
> "Instruction set avr51 is for the enhanced AVR core with exactly 128K
>  program memory space (MCU types: atmega128, atmega128a, atmega1280,
>  atmega1281, atmega1284, atmega1284p, atmega128rfa1, atmega128rfr2,
>  atmega1284rfr2, at90can128, at90usb1286, at90usb1287, m3000)."
> 
> But when compiling a program for atmega1280 or avr51 and trying to execute
> it:
> 
> $ cat > test.S << EOF
>> loop:
>>     rjmp loop
>> EOF
> $ avr-gcc -nostdlib -nostartfiles -mmcu=atmega1280 test.S -o test.elf
> $ qemu-system-avr -serial mon:stdio -nographic -no-reboot -M mega \
>                   -bios test.elf
> qemu-system-avr: Current machine: Arduino Mega (ATmega1280) with 'avr6' CPU
> qemu-system-avr: ELF image 'test.elf' is for 'avr51' CPU
> 
> So this fixes the atmega1280 class to use an avr51 CPU.
> 
> Signed-off-by: Frederic Konrad <frederic.konrad@adacore.com>
> ---
>  hw/avr/atmega.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c
> index 44c6afebbb..e3ea5702f5 100644
> --- a/hw/avr/atmega.c
> +++ b/hw/avr/atmega.c
> @@ -402,7 +402,7 @@ static void atmega1280_class_init(ObjectClass *oc, void *data)
>  {
>      AtmegaMcuClass *amc = ATMEGA_MCU_CLASS(oc);
>  
> -    amc->cpu_type = AVR_CPU_TYPE_NAME("avr6");
> +    amc->cpu_type = AVR_CPU_TYPE_NAME("avr51");
>      amc->flash_size = 128 * KiB;
>      amc->eeprom_size = 4 * KiB;
>      amc->sram_size = 8 * KiB;
> 



  reply	other threads:[~2021-04-28 19:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 19:15 [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280 Frederic Konrad
2021-04-28 19:17 ` Philippe Mathieu-Daudé [this message]
2021-04-30 10:27   ` Joaquin de Andres
2021-05-05 13:33     ` Fred Konrad
2021-05-05 14:00       ` Joaquin de Andres
2021-05-13 17:04         ` Philippe Mathieu-Daudé
2021-05-13 17:13           ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7970a6ec-f5ac-bcc9-9184-d8450b64b116@amsat.org \
    --to=f4bug@amsat.org \
    --cc=frederic.konrad@adacore.com \
    --cc=konrad@adacore.com \
    --cc=me@xcancerberox.com.ar \
    --cc=mrolnik@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).