* [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
@ 2021-04-28 19:15 Frederic Konrad
2021-04-28 19:17 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 7+ messages in thread
From: Frederic Konrad @ 2021-04-28 19:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael Rolnik, Frederic Konrad, philmd
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;
--
2.30.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
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é
2021-04-30 10:27 ` Joaquin de Andres
0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-04-28 19:17 UTC (permalink / raw)
To: Frederic Konrad, qemu-devel
Cc: Frederic Konrad, Michael Rolnik, Joaquin de Andres
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;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
2021-04-28 19:17 ` Philippe Mathieu-Daudé
@ 2021-04-30 10:27 ` Joaquin de Andres
2021-05-05 13:33 ` Fred Konrad
0 siblings, 1 reply; 7+ messages in thread
From: Joaquin de Andres @ 2021-04-30 10:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Frederic Konrad, qemu-devel
Cc: Frederic Konrad, Michael Rolnik
On 4/28/21 9:17 PM, Philippe Mathieu-Daudé wrote:
> 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;
>>
>
Good catch!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
2021-04-30 10:27 ` Joaquin de Andres
@ 2021-05-05 13:33 ` Fred Konrad
2021-05-05 14:00 ` Joaquin de Andres
0 siblings, 1 reply; 7+ messages in thread
From: Fred Konrad @ 2021-05-05 13:33 UTC (permalink / raw)
To: Joaquin de Andres, Philippe Mathieu-Daudé, qemu-devel; +Cc: Michael Rolnik
Le 4/30/21 à 12:27 PM, Joaquin de Andres a écrit :
> On 4/28/21 9:17 PM, Philippe Mathieu-Daudé wrote:
>> 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;
>>>
>>
> Good catch!
>
Thanks, does that count as a reviewed-by :)?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
2021-05-05 13:33 ` Fred Konrad
@ 2021-05-05 14:00 ` Joaquin de Andres
2021-05-13 17:04 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 7+ messages in thread
From: Joaquin de Andres @ 2021-05-05 14:00 UTC (permalink / raw)
To: Fred Konrad, Philippe Mathieu-Daudé, qemu-devel; +Cc: Michael Rolnik
On 5/5/21 3:33 PM, Fred Konrad wrote:
>
>
> Le 4/30/21 à 12:27 PM, Joaquin de Andres a écrit :
>> On 4/28/21 9:17 PM, Philippe Mathieu-Daudé wrote:
>>> 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;
>>>>
>>>
>> Good catch!
>>
>
> Thanks, does that count as a reviewed-by :)?
>
>
Yes! sorry.
Reviewed-by: Joaquin de Andres <me@xcancerberox.com.ar>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
2021-05-05 14:00 ` Joaquin de Andres
@ 2021-05-13 17:04 ` Philippe Mathieu-Daudé
2021-05-13 17:13 ` Laurent Vivier
0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-13 17:04 UTC (permalink / raw)
To: Joaquin de Andres, Fred Konrad, qemu-devel; +Cc: QEMU Trivial, Michael Rolnik
Cc'ing qemu-trivial@
On 5/5/21 4:00 PM, Joaquin de Andres wrote:
> On 5/5/21 3:33 PM, Fred Konrad wrote:
>>
>>
>> Le 4/30/21 à 12:27 PM, Joaquin de Andres a écrit :
>>> On 4/28/21 9:17 PM, Philippe Mathieu-Daudé wrote:
>>>> 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;
>>>>>
>>>>
>>> Good catch!
>>>
>>
>> Thanks, does that count as a reviewed-by :)?
>>
>>
> Yes! sorry.
>
>
> Reviewed-by: Joaquin de Andres <me@xcancerberox.com.ar>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] hw/avr/atmega.c: use the avr51 cpu for atmega1280
2021-05-13 17:04 ` Philippe Mathieu-Daudé
@ 2021-05-13 17:13 ` Laurent Vivier
0 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2021-05-13 17:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Joaquin de Andres, Fred Konrad, qemu-devel
Cc: QEMU Trivial, Michael Rolnik
Le 13/05/2021 à 19:04, Philippe Mathieu-Daudé a écrit :
> Cc'ing qemu-trivial@
Applied to my trivial-patches branch.
Thanks,
Laurent
> On 5/5/21 4:00 PM, Joaquin de Andres wrote:
>> On 5/5/21 3:33 PM, Fred Konrad wrote:
>>>
>>>
>>> Le 4/30/21 à 12:27 PM, Joaquin de Andres a écrit :
>>>> On 4/28/21 9:17 PM, Philippe Mathieu-Daudé wrote:
>>>>> 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;
>>>>>>
>>>>>
>>>> Good catch!
>>>>
>>>
>>> Thanks, does that count as a reviewed-by :)?
>>>
>>>
>> Yes! sorry.
>>
>>
>> Reviewed-by: Joaquin de Andres <me@xcancerberox.com.ar>
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-13 17:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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é
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
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).