hw/avr: Introduce few Arduino boards
v4 cover hw/avr: Introduce few Arduino boards
Hi,
This series add the arduino boards, aiming at removing the 'sample' board that doesn't follow any specification.
Since v3:
- Rebased on Michael's v41
- Drop 'extram' unused field (Igor)
- Renamed devices AVR -> Atmel (Aleksandar) (I haven't renamed structure names to ease review)
Since v2:
- rebased on Michael's v40
Since v1:
- Addressed Igor comments
- Addressed Aleksandar comments
- Fixed UART issue (was due to IRQ shifted by 2 in CPU)
Since Michael's work is not yet merged, Various of my patches
- which are trivials or simple renames - could be squashed directly on his patches, if we ever care.
[I believe sending this patches is easier/quicker than keeping asking Michael to respin his series infinitely].
Michael, do you mind testing it? The full series is available
here: https://gitlab.com/philmd/qemu/commits/arduino-v4
Regards,
Phil.
Obsoletes: <[email protected]>
Based-on: <[email protected]>
https://www.mail-archive.com/[email protected]/msg671707.html
Philippe Mathieu-Daudé (18):
MAINTAINERS: Move machine test to the machine section (not ARCH one)
MAINTAINERS: Move the AVR machines in new section (not within ARM) tests/acceptance: Do not set the machine type manually tests/acceptance: Keep multilines comment consistent with other tests hw/char/avr: Reduce USART I/O size
hw/timer/avr_timer16: Rename memory region debugging name hw/misc/avr_mask: Remove unused include
hw/avr/Makefile: Use CONFIG_AVR_SAMPLE variable
hw/char: Rename avr_usart -> atmel_usart
hw/timer: Rename avr_timer16 -> atmel_timer16
hw/misc: Rename avr_mask -> atmel_power
hw/avr: Introduce ATMEL_ATMEGA_MCU config
hw/avr: Add some ATmega microcontrollers
hw/avr: Add some Arduino boards
tests/boot-serial-test: Test some Arduino boards (AVR based) tests/acceptance: Test the Arduino MEGA2560 board
hw/avr: Remove the unrealistic AVR 'sample' board .travis.yml: Run the AVR acceptance tests
default-configs/avr-softmmu.mak | 2 +-
hw/avr/atmel_atmega.h | 48 ++
.../hw/char/{avr_usart.h => atmel_usart.h} | 10 +-
include/hw/misc/{avr_mask.h => atmel_power.h} | 11 +-
.../timer/{avr_timer16.h => atmel_timer16.h} | 10 +-
hw/avr/arduino.c | 175 +++++++
hw/avr/atmel_atmega.c | 464 ++++++++++++++++++
hw/avr/sample.c | 295 -----------
hw/char/{avr_usart.c => atmel_usart.c} | 6 +-
hw/misc/{avr_mask.c => atmel_power.c} | 4 +-
hw/timer/{avr_timer16.c => atmel_timer16.c} | 10 +-
tests/qtest/boot-serial-test.c | 3 +-
.travis.yml | 2 +-
MAINTAINERS | 29 +-
hw/avr/Kconfig | 11 +-
hw/avr/Makefile.objs | 3 +-
hw/char/Kconfig | 2 +-
hw/char/Makefile.objs | 2 +-
hw/misc/Kconfig | 2 +-
hw/misc/Makefile.objs | 2 +-
hw/timer/Kconfig | 2 +-
hw/timer/Makefile.objs | 2 +-
tests/acceptance/machine_avr6.py | 11 +-
23 files changed, 751 insertions(+), 355 deletions(-)
create mode 100644 hw/avr/atmel_atmega.h
rename include/hw/char/{avr_usart.h => atmel_usart.h} (93%)
rename include/hw/misc/{avr_mask.h => atmel_power.h} (89%)
rename include/hw/timer/{avr_timer16.h => atmel_timer16.h} (92%)
create mode 100644 hw/avr/arduino.c
create mode 100644 hw/avr/atmel_atmega.c
delete mode 100644 hw/avr/sample.c
rename hw/char/{avr_usart.c => atmel_usart.c} (99%)
rename hw/misc/{avr_mask.c => atmel_power.c} (97%)
rename hw/timer/{avr_timer16.c => atmel_timer16.c} (98%)Signature · 1 line
2.21.1
PATCH v4 1/18 MAINTAINERS: Move machine test to the machine section (not ARCH one)
---
!squash
--- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
@@ -168,7 +168,6 @@ M: Michael Rolnik <[email protected]> R: Sarah Harris <[email protected]> S: Maintained F: target/avr/ -F: tests/acceptance/machine_avr6.py F: default-configs/avr-softmmu.mak F: gdb-xml/avr-cpu.xml
@@ -501,6 +500,7 @@ F: hw/timer/avr_timer16.c F: include/hw/timer/avr_timer16.h F: hw/misc/avr_mask.c F: include/hw/misc/avr_mask.h +F: tests/acceptance/machine_avr6.py ARM PrimeCell and CMSDK devices M: Peter Maydell <[email protected]>
Signature · 1 line
2.21.1
PATCH v4 2/18 MAINTAINERS: Move the AVR machines in new section (not within ARM)
In reply to Philippe Mathieu-Daudé---
!squash
--- MAINTAINERS | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
MAINTAINERS +16 -13
@@ -489,19 +489,6 @@ F: hw/*/allwinner* F: include/hw/*/allwinner* F: hw/arm/cubieboard.c -AVR Machines -M: Michael Rolnik <[email protected]> -R: Sarah Harris <[email protected]> -S: Maintained -F: hw/avr/ -F: hw/char/avr_usart.c -F: include/hw/char/avr_usart.h -F: hw/timer/avr_timer16.c -F: include/hw/timer/avr_timer16.h -F: hw/misc/avr_mask.c -F: include/hw/misc/avr_mask.h -F: tests/acceptance/machine_avr6.py - ARM PrimeCell and CMSDK devices M: Peter Maydell <[email protected]> L: [email protected]
@@ -901,6 +888,22 @@ F: include/hw/*/nrf51*.h F: include/hw/*/microbit*.h F: tests/qtest/microbit-test.c +AVR Machines +------------- + +Atmel MCU +M: Michael Rolnik <[email protected]> +R: Sarah Harris <[email protected]> +S: Maintained +F: hw/avr/ +F: hw/char/avr_usart.c +F: include/hw/char/avr_usart.h +F: hw/timer/avr_timer16.c +F: include/hw/timer/avr_timer16.h +F: hw/misc/avr_mask.c +F: include/hw/misc/avr_mask.h +F: tests/acceptance/machine_avr6.py + CRIS Machines ------------- Axis Dev88
Signature · 1 line
2.21.1
PATCH v4 3/18 tests/acceptance: Do not set the machine type manually
In reply to Philippe Mathieu-DaudéSince commit ba21bde93 we don't need to set the machine type manually, the one set by the ":avocado: tags=machine" will be used.
--- tests/acceptance/machine_avr6.py | 1 - 1 file changed, 1 deletion(-)
tests/acceptance/machine_avr6.py +0 -1
@@ -41,7 +41,6 @@ class AVR6Machine(Test): rom_hash = '7eb521f511ca8f2622e0a3c5e8dd686efbb911d4' rom_path = self.fetch_asset(rom_url, asset_hash=rom_hash) - self.vm.set_machine('sample') self.vm.add_args('-bios', rom_path) self.vm.add_args('-nographic') self.vm.launch()
Signature · 1 line
2.21.1
PATCH v4 4/18 tests/acceptance: Keep multilines comment consistent with other tests
In reply to Philippe Mathieu-Daudé---
note to maintainer: squash before merge?
--- tests/acceptance/machine_avr6.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tests/acceptance/machine_avr6.py +3 -5
@@ -33,11 +33,9 @@ class AVR6Machine(Test): https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf constantly prints out 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWX' """ - rom_url = 'https://github.com/seharris/qemu-avr-tests' - rom_sha1= '36c3e67b8755dcf37e06af6730ef5d477b8ed16d' - rom_url += '/raw/' - rom_url += rom_sha1 - rom_url += '/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf' + rom_url = ('https://github.com/seharris/qemu-avr-tests' + '/raw/36c3e67b8755dcf/free-rtos/Demo' + '/AVR_ATMega2560_GCC/demo.elf') rom_hash = '7eb521f511ca8f2622e0a3c5e8dd686efbb911d4' rom_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
Signature · 1 line
2.21.1
PATCH v4 5/18 hw/char/avr: Reduce USART I/O size
In reply to Philippe Mathieu-DaudéPer the datasheet the USART uses 7 consecutive 8-bit registers.
--- hw/char/avr_usart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/avr_usart.c +1 -1
@@ -280,7 +280,7 @@ static void avr_usart_init(Object *obj)sysbus_init_irq (SYS_BUS_DEVICE (obj), &s->rxc_irq);sysbus_init_irq (SYS_BUS_DEVICE (obj), &s->dre_irq);sysbus_init_irq (SYS_BUS_DEVICE (obj), &s->txc_irq); -memory_region_init_io (&s->mmio, obj, &avr_usart_ops, s,TYPE_AVR_USART ,8 ); +memory_region_init_io (&s->mmio, obj, &avr_usart_ops, s,TYPE_AVR_USART ,7 );sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->mmio);qdev_init_gpio_in (DEVICE (s), avr_usart_pr,1 ); s->enabled = true;
Signature · 1 line
2.21.1
PATCH v4 8/18 hw/avr/Makefile: Use CONFIG_AVR_SAMPLE variable
In reply to Philippe Mathieu-Daudé--- hw/avr/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/avr/Makefile.objs +1 -1
@@ -1 +1 @@ -obj-y += sample.o +obj-$(CONFIG_AVR_SAMPLE) += sample.o
Signature · 1 line
2.21.1
PATCH v4 11/18 hw/misc: Rename avr_mask -> atmel_power
In reply to Philippe Mathieu-DaudéAVR is the architecture, Atmel the manufacturer.
---
!squash
---
include/hw/misc/{avr_mask.h => atmel_power.h} | 10 +++++-----
hw/avr/sample.c | 2 +-
hw/misc/{avr_mask.c => atmel_power.c} | 4 ++--
MAINTAINERS | 4 ++--
hw/avr/Kconfig | 2 +-
hw/misc/Kconfig | 2 +-
hw/misc/Makefile.objs | 2 +-
7 files changed, 13 insertions(+), 13 deletions(-)
rename include/hw/misc/{avr_mask.h => atmel_power.h} (89%)
rename hw/misc/{avr_mask.c => atmel_power.c} (97%)include/hw/misc/atmel_power.h renamed from include/hw/misc/avr_mask.h +5 -5
@@ -1,5 +1,5 @@/* -* AVR Power Reduction +* Atmel AVR Power Reduction Management * * Copyright (c) 2019 Michael Rolnik *
@@ -22,14 +22,14 @@* THE SOFTWARE. */ -#ifndef HW_avr_mask_H -#define HW_avr_mask_H +#ifndef HW_MISC_ATMEL_POWER_H +#define HW_MISC_ATMEL_POWER_H #include "hw/sysbus.h" #include "hw/hw.h" -#define TYPE_AVR_MASK "avr-mask" +#define TYPE_AVR_MASK "atmel-power" #define AVR_MASK(obj) OBJECT_CHECK(AVRMaskState, (obj), TYPE_AVR_MASK) typedef struct {
@@ -43,4 +43,4 @@ typedef struct { qemu_irq irq[8]; } AVRMaskState; -#endif /* HW_avr_mask_H */ +#endif /* HW_MISC_ATMEL_POWER_H */
hw/avr/sample.c +1 -1
@@ -46,7 +46,7 @@#include "include/hw/sysbus.h" #include "include/hw/char/atmel_usart.h" #include "include/hw/timer/atmel_timer16.h" -#include "include/hw/misc/avr_mask.h" +#include "include/hw/misc/atmel_power.h" #include "elf.h" #include "hw/misc/unimp.h"
hw/misc/atmel_power.c renamed from hw/misc/avr_mask.c +2 -2
@@ -1,5 +1,5 @@/* -* AVR Power Reduction +* Atmel AVR Power Reduction Management * * Copyright (c) 2019 Michael Rolnik *
@@ -23,7 +23,7 @@*/ #include "qemu/osdep.h" -#include "hw/misc/avr_mask.h" +#include "hw/misc/atmel_power.h" #include "qemu/log.h" #include "hw/qdev-properties.h" #include "hw/irq.h"
MAINTAINERS +2 -2
@@ -900,8 +900,8 @@ F: hw/char/atmel_usart.c F: include/hw/char/atmel_usart.h F: hw/timer/atmel_timer16.c F: include/hw/timer/atmel_timer16.h -F: hw/misc/avr_mask.c -F: include/hw/misc/avr_mask.h +F: hw/misc/atmel_power.c +F: include/hw/misc/atmel_power.h F: tests/acceptance/machine_avr6.py CRIS Machines
hw/avr/Kconfig +1 -1
@@ -2,5 +2,5 @@ config AVR_SAMPLE bool select ATMEL_TIMER16 select ATMEL_USART - select AVR_MASK + select ATMEL_POWER select UNIMP
hw/misc/Kconfig +1 -1
@@ -131,7 +131,7 @@ config MAC_VIA select MOS6522 select ADB -config AVR_MASK +config ATMEL_POWER bool source macio/Kconfig
hw/misc/Makefile.objs +1 -1
@@ -86,4 +86,4 @@ obj-$(CONFIG_MAC_VIA) += mac_via.o common-obj-$(CONFIG_GRLIB) += grlib_ahb_apb_pnp.o -obj-$(CONFIG_AVR_MASK) += avr_mask.o +obj-$(CONFIG_ATMEL_POWER) += atmel_power.o
Signature · 1 line
2.21.1
PATCH v4 7/18 hw/misc/avr_mask: Remove unused include
In reply to Philippe Mathieu-Daudé--- include/hw/misc/avr_mask.h | 1 - 1 file changed, 1 deletion(-)
include/hw/misc/avr_mask.h +0 -1
@@ -26,7 +26,6 @@#define HW_avr_mask_H#include "hw/sysbus.h" -#include "chardev/char-fe.h" #include "hw/hw.h"
Signature · 1 line
2.21.1
PATCH v4 9/18 hw/char: Rename avr_usart -> atmel_usart
In reply to Philippe Mathieu-DaudéAVR is the architecture, Atmel the manufacturer.
---
!squash
---
include/hw/char/{avr_usart.h => atmel_usart.h} | 10 +++++-----
hw/avr/sample.c | 2 +-
hw/char/{avr_usart.c => atmel_usart.c} | 4 ++--
MAINTAINERS | 4 ++--
hw/avr/Kconfig | 2 +-
hw/char/Kconfig | 2 +-
hw/char/Makefile.objs | 2 +-
7 files changed, 13 insertions(+), 13 deletions(-)
rename include/hw/char/{avr_usart.h => atmel_usart.h} (93%)
rename hw/char/{avr_usart.c => atmel_usart.c} (99%)include/hw/char/atmel_usart.h renamed from include/hw/char/avr_usart.h +5 -5
@@ -1,5 +1,5 @@/* -* AVR USART +* Atmel AVR USART * * Copyright (c) 2018 University of Kent * Author: Sarah Harris
@@ -19,8 +19,8 @@* <http://www.gnu.org/licenses/lgpl-2.1.html> */ -#ifndef HW_AVR_USART_H -#define HW_AVR_USART_H +#ifndef HW_CHAR_ATMEL_USART_H +#define HW_CHAR_ATMEL_USART_H #include "hw/sysbus.h" #include "chardev/char-fe.h"
@@ -56,7 +56,7 @@#define USART_CSRC_CSZ1 (1 << 2)#define USART_CSRC_CSZ0 (1 << 1) -#define TYPE_AVR_USART "avr-usart" +#define TYPE_AVR_USART "atmel-usart"#define AVR_USART (obj) \ OBJECT_CHECK(AVRUsartState, (obj), TYPE_AVR_USART)
@@ -90,4 +90,4 @@ typedef struct { qemu_irq dre_irq; } AVRUsartState; -#endif /* HW_AVR_USART_H */ +#endif /* HW_CHAR_ATMEL_USART_H */
hw/avr/sample.c +1 -1
@@ -44,7 +44,7 @@#include "qemu/error-report.h" #include "exec/address-spaces.h" #include "include/hw/sysbus.h" -#include "include/hw/char/avr_usart.h" +#include "include/hw/char/atmel_usart.h" #include "include/hw/timer/avr_timer16.h" #include "include/hw/misc/avr_mask.h" #include "elf.h"
hw/char/atmel_usart.c renamed from hw/char/avr_usart.c +2 -2
@@ -1,5 +1,5 @@/* -* AVR USART +* Atmel AVR USART * * Copyright (c) 2018 University of Kent * Author: Sarah Harris
@@ -20,7 +20,7 @@*/ #include "qemu/osdep.h" -#include "hw/char/avr_usart.h" +#include "hw/char/atmel_usart.h" #include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h"
MAINTAINERS +2 -2
@@ -896,8 +896,8 @@ M: Michael Rolnik <[email protected]> R: Sarah Harris <[email protected]> S: Maintained F: hw/avr/ -F: hw/char/avr_usart.c -F: include/hw/char/avr_usart.h +F: hw/char/atmel_usart.c +F: include/hw/char/atmel_usart.h F: hw/timer/avr_timer16.c F: include/hw/timer/avr_timer16.h F: hw/misc/avr_mask.c
hw/avr/Kconfig +1 -1
@@ -1,6 +1,6 @@ config AVR_SAMPLE bool select AVR_TIMER16 - select AVR_USART + select ATMEL_USART select AVR_MASK select UNIMP
hw/char/Kconfig +1 -1
@@ -47,5 +47,5 @@ config SCLPCONSOLE config TERMINAL3270 bool -config AVR_USART +config ATMEL_USART bool
hw/char/Makefile.objs +1 -1
@@ -21,7 +21,7 @@ obj-$(CONFIG_PSERIES) += spapr_vty.o obj-$(CONFIG_DIGIC) += digic-uart.o obj-$(CONFIG_STM32F2XX_USART) += stm32f2xx_usart.o obj-$(CONFIG_RASPI) += bcm2835_aux.o -common-obj-$(CONFIG_AVR_USART) += avr_usart.o +common-obj-$(CONFIG_ATMEL_USART) += atmel_usart.o common-obj-$(CONFIG_CMSDK_APB_UART) += cmsdk-apb-uart.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
Signature · 1 line
2.21.1
PATCH v4 6/18 hw/timer/avr_timer16: Rename memory region debugging name
In reply to Philippe Mathieu-DaudéThis device expose 3 different I/O regions. Name them differently to have a clearer 'info mtree' output.
--- hw/timer/avr_timer16.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/timer/avr_timer16.c +3 -3
@@ -563,11 +563,11 @@ static void avr_timer16_init(Object *obj)sysbus_init_irq (SYS_BUS_DEVICE (obj), &s->ovf_irq);memory_region_init_io (&s->iomem, obj, &avr_timer16_ops, - s,TYPE_AVR_TIMER16 ,0xe ); + s,"avr-timer16" ,0xe );memory_region_init_io (&s->imsk_iomem, obj, &avr_timer16_imsk_ops, - s,TYPE_AVR_TIMER16 ,0x1 ); + s,"avr-timer16-intmask" ,0x1 );memory_region_init_io (&s->ifr_iomem, obj, &avr_timer16_ifr_ops, - s,TYPE_AVR_TIMER16 ,0x1 ); + s,"avr-timer16-intflag" ,0x1 );sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->iomem);sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->imsk_iomem);
Signature · 1 line
2.21.1
PATCH v4 15/18 tests/boot-serial-test: Test some Arduino boards (AVR based)
In reply to Philippe Mathieu-DaudéThe Arduino Duemilanove is based on a AVR5 CPU, while the Arduino MEGA2560 on a AVR6 CPU.
--- tests/qtest/boot-serial-test.c | 2 ++ 1 file changed, 2 insertions(+)
tests/qtest/boot-serial-test.c +2 -0
@@ -113,6 +113,8 @@ typedef struct testdef {static testdef_t tests[] = { {"alpha" ,"clipper" ,"" ,"PCI:" }, {"avr" ,"sample" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr }, + {"avr" ,"arduino-duemilanove" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr }, + {"avr" ,"arduino-mega-2560-v3" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr}, {"ppc" ,"ppce500" ,"" ,"U-Boot" }, {"ppc" ,"40p" ,"-vga none -boot d" ,"Trying cd:," }, {"ppc" ,"g3beige" ,"" ,"PowerPC,750" },
Signature · 1 line
2.21.1
PATCH v4 12/18 hw/avr: Introduce ATMEL_ATMEGA_MCU config
In reply to Philippe Mathieu-Daudé--- hw/avr/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/avr/Kconfig +4 -1
@@ -1,6 +1,9 @@ -config AVR_SAMPLE +config ATMEL_ATMEGA_MCU bool select ATMEL_TIMER16 select ATMEL_USART select ATMEL_POWER + +config AVR_SAMPLE + select ATMEL_ATMEGA_MCU select UNIMP
Signature · 1 line
2.21.1
PATCH v4 14/18 hw/avr: Add some Arduino boards
In reply to Philippe Mathieu-DaudéArduino boards are build with AVR chipsets.
Add some of the popular boards:
- Arduino Duemilanove
- Arduino Uno
- Arduino Mega
For more information:
https://www.arduino.cc/en/Main/Products
https://store.arduino.cc/arduino-genuino/most-popular
---
v4:
- Remove unused 'extram*' fields (Igor)
v2:
- Reword description adding more information (Aleksandar)
- Use DEFINE_TYPES (Igor)
--- default-configs/avr-softmmu.mak | 1 + hw/avr/arduino.c | 175 ++++++++++++++++++++++++++++++++ hw/avr/Kconfig | 4 + hw/avr/Makefile.objs | 1 + 4 files changed, 181 insertions(+) create mode 100644 hw/avr/arduino.c
default-configs/avr-softmmu.mak +1 -0
@@ -2,4 +2,5 @@ # Boards: # +CONFIG_ARDUINO=y CONFIG_AVR_SAMPLE=y
hw/avr/arduino.c new file +175 -0
175 lines not on this page · raw message
hw/avr/Kconfig +4 -0
@@ -4,6 +4,10 @@ config ATMEL_ATMEGA_MCU select ATMEL_USART select ATMEL_POWER +config ARDUINO + select ATMEL_ATMEGA_MCU + select UNIMP + config AVR_SAMPLE select ATMEL_ATMEGA_MCU select UNIMP
hw/avr/Makefile.objs +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_ATMEL_ATMEGA_MCU) += atmel_atmega.o +obj-$(CONFIG_ARDUINO) += arduino.o obj-$(CONFIG_AVR_SAMPLE) += sample.o
Signature · 1 line
2.21.1
PATCH v4 10/18 hw/timer: Rename avr_timer16 -> atmel_timer16
In reply to Philippe Mathieu-DaudéAVR is the architecture, Atmel the manufacturer.
---
!squash
---
include/hw/timer/{avr_timer16.h => atmel_timer16.h} | 10 +++++-----
hw/avr/sample.c | 2 +-
hw/timer/{avr_timer16.c => atmel_timer16.c} | 4 ++--
MAINTAINERS | 4 ++--
hw/avr/Kconfig | 2 +-
hw/timer/Kconfig | 2 +-
hw/timer/Makefile.objs | 2 +-
7 files changed, 13 insertions(+), 13 deletions(-)
rename include/hw/timer/{avr_timer16.h => atmel_timer16.h} (92%)
rename hw/timer/{avr_timer16.c => atmel_timer16.c} (99%)include/hw/timer/atmel_timer16.h renamed from include/hw/timer/avr_timer16.h +5 -5
@@ -1,5 +1,5 @@/* -* AVR 16 bit timer +* Atmel AVR 16 bit timer * * Copyright (c) 2018 University of Kent * Author: Ed Robbins
@@ -25,8 +25,8 @@* On ATmega640/V-1280/V-1281/V-2560/V-2561/V timers 1, 3, 4 and 5 are 16 bit */ -#ifndef AVR_TIMER16_H -#define AVR_TIMER16_H +#ifndef HW_TIMER_ATMEL_TIMER16_H +#define HW_TIMER_ATMEL_TIMER16_H #include "hw/sysbus.h" #include "qemu/timer.h"
@@ -40,7 +40,7 @@ enum NextInterrupt { CAPT }; -#define TYPE_AVR_TIMER16 "avr-timer16" +#define TYPE_AVR_TIMER16 "atmel-timer16"#define AVR_TIMER16 (obj) \ OBJECT_CHECK(AVRTimer16State, (obj), TYPE_AVR_TIMER16)
@@ -91,4 +91,4 @@ typedef struct AVRTimer16State { enum NextInterrupt next_interrupt; } AVRTimer16State; -#endif /* AVR_TIMER16_H */ +#endif /* HW_TIMER_ATMEL_TIMER16_H */
hw/avr/sample.c +1 -1
@@ -45,7 +45,7 @@#include "exec/address-spaces.h" #include "include/hw/sysbus.h" #include "include/hw/char/atmel_usart.h" -#include "include/hw/timer/avr_timer16.h" +#include "include/hw/timer/atmel_timer16.h" #include "include/hw/misc/avr_mask.h" #include "elf.h" #include "hw/misc/unimp.h"
hw/timer/atmel_timer16.c renamed from hw/timer/avr_timer16.c +2 -2
@@ -1,5 +1,5 @@/* -* AVR 16 bit timer +* Atmel AVR 16 bit timer * * Copyright (c) 2018 University of Kent * Author: Ed Robbins
@@ -32,7 +32,7 @@*/ #include "qemu/osdep.h" -#include "hw/timer/avr_timer16.h" +#include "hw/timer/atmel_timer16.h" #include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h"
MAINTAINERS +2 -2
@@ -898,8 +898,8 @@ S: Maintained F: hw/avr/ F: hw/char/atmel_usart.c F: include/hw/char/atmel_usart.h -F: hw/timer/avr_timer16.c -F: include/hw/timer/avr_timer16.h +F: hw/timer/atmel_timer16.c +F: include/hw/timer/atmel_timer16.h F: hw/misc/avr_mask.c F: include/hw/misc/avr_mask.h F: tests/acceptance/machine_avr6.py
hw/avr/Kconfig +1 -1
@@ -1,6 +1,6 @@ config AVR_SAMPLE bool - select AVR_TIMER16 + select ATMEL_TIMER16 select ATMEL_USART select AVR_MASK select UNIMP
hw/timer/Kconfig +1 -1
@@ -36,5 +36,5 @@ config CMSDK_APB_DUALTIMER bool select PTIMER -config AVR_TIMER16 +config ATMEL_TIMER16 bool
hw/timer/Makefile.objs +1 -1
@@ -36,4 +36,4 @@ common-obj-$(CONFIG_CMSDK_APB_DUALTIMER) += cmsdk-apb-dualtimer.o common-obj-$(CONFIG_MSF2) += mss-timer.o common-obj-$(CONFIG_RASPI) += bcm2835_systmr.o -obj-$(CONFIG_AVR_TIMER16) += avr_timer16.o +obj-$(CONFIG_ATMEL_TIMER16) += atmel_timer16.o
Signature · 1 line
2.21.1
PATCH v4 16/18 tests/acceptance: Test the Arduino MEGA2560 board
In reply to Philippe Mathieu-DaudéAs the path name demonstrates, the FreeRTOS tests target a board based on a ATMega2560 MCU. We have one, the Arduino MEGA2560.
Complementary documentation:
https://feilipu.me/2012/01/15/ethermega-arduino-mega-2560-and-freertos/
https://feilipu.me/2015/11/24/arduino_freertos/ (see 'Compatibility')
--- tests/acceptance/machine_avr6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/acceptance/machine_avr6.py +1 -1
@@ -27,7 +27,7 @@ class AVR6Machine(Test): def test_freertos(self): """ :avocado: tags=arch:avr - :avocado: tags=machine:sample + :avocado: tags=machine:arduino-mega-2560-v3 """ """ https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf
Signature · 1 line
2.21.1
PATCH v4 17/18 hw/avr: Remove the unrealistic AVR 'sample' board
In reply to Philippe Mathieu-DaudéThe 'arduino-mega-2560-v3' board fully replace the 'sample' board.
---
!squash?
--- default-configs/avr-softmmu.mak | 1 - hw/avr/sample.c | 295 -------------------------------- tests/qtest/boot-serial-test.c | 1 - hw/avr/Kconfig | 4 - hw/avr/Makefile.objs | 1 - 5 files changed, 302 deletions(-) delete mode 100644 hw/avr/sample.c
default-configs/avr-softmmu.mak +0 -1
@@ -3,4 +3,3 @@ # Boards: # CONFIG_ARDUINO=y -CONFIG_AVR_SAMPLE=y
hw/avr/sample.c deleted +0 -295
295 lines not on this page · raw message
tests/qtest/boot-serial-test.c +0 -1
@@ -112,7 +112,6 @@ typedef struct testdef {static testdef_t tests[] = { {"alpha" ,"clipper" ,"" ,"PCI:" }, - {"avr" ,"sample" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr }, {"avr" ,"arduino-duemilanove" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr }, {"avr" ,"arduino-mega-2560-v3" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr}, {"ppc" ,"ppce500" ,"" ,"U-Boot" },
hw/avr/Kconfig +0 -4
@@ -7,7 +7,3 @@ config ATMEL_ATMEGA_MCU config ARDUINO select ATMEL_ATMEGA_MCU select UNIMP - -config AVR_SAMPLE - select ATMEL_ATMEGA_MCU - select UNIMP
hw/avr/Makefile.objs +0 -1
@@ -1,3 +1,2 @@ obj-$(CONFIG_ATMEL_ATMEGA_MCU) += atmel_atmega.o obj-$(CONFIG_ARDUINO) += arduino.o -obj-$(CONFIG_AVR_SAMPLE) += sample.o
Signature · 1 line
2.21.1
PATCH v4 18/18 .travis.yml: Run the AVR acceptance tests
In reply to Philippe Mathieu-DaudéWe have one test so far, and it is very fast:
$ avocado --show=app run -t arch:avr tests/acceptance/ (1/1) tests/acceptance/machine_avr6.py:AVR6Machine.test_freertos: PASS (2.13 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 2.30 s
--- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
@@ -268,7 +268,7 @@ matrix: # Acceptance (Functional) tests - env: - - CONFIG="--python=/usr/bin/python3 --target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,sparc-softmmu" + - CONFIG="--python=/usr/bin/python3 --target-list=x86_64-softmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmmu,alpha-softmmu,ppc-softmmu,ppc64-softmmu,m68k-softmmu,sparc-softmmu,avr-softmmu" - TEST_CMD="make check-acceptance" after_script: - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP")]' | xargs cat
Signature · 1 line
2.21.1
PATCH v4 13/18 hw/avr: Add some ATmega microcontrollers
In reply to Philippe Mathieu-DaudéAdd some microcontrollers from the megaAVR family (ATmega series):
- middle range: ATmega168 and ATmega328
- high range: ATmega1280 and ATmega2560
For product comparison:
https://www.microchip.com/wwwproducts/ProductCompare/ATmega168P/ATmega328P
https://www.microchip.com/wwwproducts/ProductCompare/ATmega1280/ATmega2560
Datasheets:
http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf
http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2549-8-bit-AVR-Microcontroller-ATmega640-1280-1281-2560-2561_datasheet.pdf
---
v2:
- Reword description adding more information (Aleksandar)
- Use DEFINE_TYPES and memory_region_init_ram (Igor)
--- hw/avr/atmel_atmega.h | 48 +++++ hw/avr/atmel_atmega.c | 464 ++++++++++++++++++++++++++++++++++++++++++ hw/avr/Makefile.objs | 1 + 3 files changed, 513 insertions(+) create mode 100644 hw/avr/atmel_atmega.h create mode 100644 hw/avr/atmel_atmega.c
hw/avr/atmel_atmega.h new file +48 -0
@@ -0,0 +1,48 @@ +/* +* QEMU ATmega MCU +* +* Copyright (c) 2019 Philippe Mathieu-Daudé +* +* This work is licensed under the terms of the GNU GPLv2 or later. +* See the COPYING file in the top-level directory. +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_AVR_ATMEL_ATMEGA_H +#define HW_AVR_ATMEL_ATMEGA_H + +#include "hw/char/atmel_usart.h" +#include "hw/timer/atmel_timer16.h" +#include "hw/misc/atmel_power.h" +#include "target/avr/cpu.h" + +#define TYPE_ATMEGA_MCU "ATmega" +#define TYPE_ATMEGA168_MCU "ATmega168" +#define TYPE_ATMEGA328_MCU "ATmega328" +#define TYPE_ATMEGA1280_MCU "ATmega1280" +#define TYPE_ATMEGA2560_MCU "ATmega2560" + +#define ATMEGA_MCU (obj) OBJECT_CHECK(AtmegaMcuState, (obj), TYPE_ATMEGA_MCU) + +#define POWER_MAX 2 +#define USART_MAX 4 +#define TIMER_MAX 6 +#define GPIO_MAX 12 + +typedef struct AtmegaMcuState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +AVRCPU cpu; +MemoryRegion flash; +MemoryRegion eeprom; +MemoryRegion sram; +DeviceState *io; +AVRMaskState pwr[POWER_MAX ]; +AVRUsartState usart[USART_MAX ]; +AVRTimer16State timer[TIMER_MAX ]; +uint64_t xtal_freq_hz; +}AtmegaMcuState ; + +#endif /* HW_AVR_ATMEL_ATMEGA_H */
hw/avr/atmel_atmega.c new file +464 -0
464 lines not on this page · raw message
hw/avr/Makefile.objs +1 -0
@@ -1 +1,2 @@ +obj-$(CONFIG_ATMEL_ATMEGA_MCU) += atmel_atmega.o obj-$(CONFIG_AVR_SAMPLE) += sample.o
Signature · 1 line
2.21.1
Quoted 26 lines · Philippe Mathieu-Daudé
Hi,
This series add the arduino boards, aiming at removing the 'sample' board that doesn't follow any specification.
Since v3:
- Rebased on Michael's v41
- Drop 'extram' unused field (Igor)
- Renamed devices AVR -> Atmel (Aleksandar) (I haven't renamed structure names to ease review)Since v2:
- rebased on Michael's v40Since v1:
- Addressed Igor comments
- Addressed Aleksandar comments
- Fixed UART issue (was due to IRQ shifted by 2 in CPU)Since Michael's work is not yet merged, Various of my patches
- which are trivials or simple renames - could be squashed directly on his patches, if we ever care.
[I believe sending this patches is easier/quicker than keeping asking Michael to respin his series infinitely].
Quoted 8 lines
Michael, do you mind testing it? The full series is available
here: https://gitlab.com/philmd/qemu/commits/arduino-v4Regards,
Phil.
Obsoletes: <[email protected]>
Argh the correct tag is:
Supersedes: <[email protected]>
Paolo: will this work? (replying to the cover)
Quoted 22 lines
Based-on: <[email protected]>
https://www.mail-archive.com/[email protected]/msg671707.htmlPhilippe Mathieu-Daudé (18):
MAINTAINERS: Move machine test to the machine section (not ARCH one)
MAINTAINERS: Move the AVR machines in new section (not within ARM) tests/acceptance: Do not set the machine type manually tests/acceptance: Keep multilines comment consistent with other tests hw/char/avr: Reduce USART I/O size
hw/timer/avr_timer16: Rename memory region debugging name hw/misc/avr_mask: Remove unused include
hw/avr/Makefile: UseCONFIG_AVR_SAMPLEvariable
hw/char: Renameavr_usart->atmel_usart
hw/timer: Renameavr_timer16->atmel_timer16
hw/misc: Renameavr_mask->atmel_power
hw/avr: IntroduceATMEL_ATMEGA_MCUconfig
hw/avr: Add some ATmega microcontrollers
hw/avr: Add some Arduino boards
tests/boot-serial-test: Test some Arduino boards (AVR based) tests/acceptance: Test the Arduino MEGA2560 board
hw/avr: Remove the unrealistic AVR 'sample' board .travis.yml: Run the AVR acceptance tests
Re: [PATCH v4 15/18] tests/boot-serial-test: Test some Arduino boards (AVR based)
In reply to Philippe Mathieu-DaudéQuoted 14 lines · Philippe Mathieu-Daudé
The Arduino Duemilanove is based on a AVR5 CPU, while the Arduino MEGA2560 on a AVR6 CPU.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/qtest/boot-serial-test.c | 2 ++ 1 file changed, 2 insertions(+)tests/qtest/boot-serial-test.c +0
-0
tests/qtest/boot-serial-test.c typedef struct testdef { · line 120
Quoted 8 lines
tests/qtest/boot-serial-test.c +2
-0@@ -113,6 +113,8 @@ typedef struct testdef {static testdef_t tests[] = { {"alpha" ,"clipper" ,"" ,"PCI:" }, {"avr" ,"sample" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr }, + {"avr" ,"arduino-duemilanove" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr }, + {"avr" ,"arduino-mega-2560-v3" ,"" ,"T" ,sizeof (bios_avr),NULL , bios_avr}, {"ppc" ,"ppce500" ,"" ,"U-Boot" }, {"ppc" ,"40p" ,"-vga none -boot d" ,"Trying cd:," }, {"ppc" ,"g3beige" ,"" ,"PowerPC,750" },
Hi Philippe.
1. I cannot access https://gitlab.com/philmd/qemu/commits/arduino-v4
2. I merged your series into my workspace using patchwork
3. I payed attention that that you don't use automatic CPU detection (as suggested by Aleksandar) by reading elf.
4. There is difference between -bios and -kernel (arduino boars crash when -bios is used, but this seems because I run avr6 on avr5 CPU). I would be happy if you explained what is the difference between these two arguments.
5. make check-acceptance pass correctly
6. make check-qtest-avr pass correctly
Quoted 95 lines · Philippe Mathieu-Daudé
Hi,
This series add the arduino boards, aiming at removing the 'sample' board that doesn't follow any specification.
Since v3:
- Rebased on Michael's v41
- Drop 'extram' unused field (Igor)
- Renamed devices AVR -> Atmel (Aleksandar) (I haven't renamed structure names to ease review)Since v2:
- rebased on Michael's v40Since v1:
- Addressed Igor comments
- Addressed Aleksandar comments
- Fixed UART issue (was due to IRQ shifted by 2 in CPU)Since Michael's work is not yet merged, Various of my patches
- which are trivials or simple renames - could be squashed directly on his patches, if we ever care.
[I believe sending this patches is easier/quicker than keeping asking Michael to respin his series infinitely].Michael, do you mind testing it? The full series is available
here: https://gitlab.com/philmd/qemu/commits/arduino-v4Regards,
Phil.
Obsoletes: <[email protected]>
Based-on: <[email protected]>
https://www.mail-archive.com/[email protected]/msg671707.htmlPhilippe Mathieu-Daudé (18):
MAINTAINERS: Move machine test to the machine section (not ARCH one)
MAINTAINERS: Move the AVR machines in new section (not within ARM) tests/acceptance: Do not set the machine type manually tests/acceptance: Keep multilines comment consistent with other tests hw/char/avr: Reduce USART I/O size
hw/timer/avr_timer16: Rename memory region debugging name hw/misc/avr_mask: Remove unused include
hw/avr/Makefile: UseCONFIG_AVR_SAMPLEvariable
hw/char: Renameavr_usart->atmel_usart
hw/timer: Renameavr_timer16->atmel_timer16
hw/misc: Renameavr_mask->atmel_power
hw/avr: IntroduceATMEL_ATMEGA_MCUconfig
hw/avr: Add some ATmega microcontrollers
hw/avr: Add some Arduino boards
tests/boot-serial-test: Test some Arduino boards (AVR based) tests/acceptance: Test the Arduino MEGA2560 board
hw/avr: Remove the unrealistic AVR 'sample' board .travis.yml: Run the AVR acceptance testsdefault-configs/avr-softmmu.mak | 2 +- hw/avr/atmel_atmega.h | 48 ++ .../hw/char/{avr_usart.h => atmel_usart.h} | 10 +- include/hw/misc/{avr_mask.h => atmel_power.h} | 11 +- .../timer/{avr_timer16.h => atmel_timer16.h} | 10 +- hw/avr/arduino.c | 175 +++++++ hw/avr/atmel_atmega.c | 464 ++++++++++++++++++ hw/avr/sample.c | 295 ----------- hw/char/{avr_usart.c => atmel_usart.c} | 6 +- hw/misc/{avr_mask.c => atmel_power.c} | 4 +- hw/timer/{avr_timer16.c => atmel_timer16.c} | 10 +- tests/qtest/boot-serial-test.c | 3 +- .travis.yml | 2 +- MAINTAINERS | 29 +- hw/avr/Kconfig | 11 +- hw/avr/Makefile.objs | 3 +- hw/char/Kconfig | 2 +- hw/char/Makefile.objs | 2 +- hw/misc/Kconfig | 2 +- hw/misc/Makefile.objs | 2 +- hw/timer/Kconfig | 2 +- hw/timer/Makefile.objs | 2 +- tests/acceptance/machine_avr6.py | 11 +- 23 files changed, 751 insertions(+), 355 deletions(-) create mode 100644 hw/avr/atmel_atmega.h rename include/hw/char/{avr_usart.h => atmel_usart.h} (93%) rename include/hw/misc/{avr_mask.h => atmel_power.h} (89%) rename include/hw/timer/{avr_timer16.h => atmel_timer16.h} (92%) create mode 100644 hw/avr/arduino.c create mode 100644 hw/avr/atmel_atmega.c delete mode 100644 hw/avr/sample.c rename hw/char/{avr_usart.c => atmel_usart.c} (99%) rename hw/misc/{avr_mask.c => atmel_power.c} (97%) rename hw/timer/{avr_timer16.c => atmel_timer16.c} (98%)--
2.21.1
Signature · 2 lines
Best Regards, Michael Rolnik
Quoted 4 lines · Michael Rolnik
Hi Philippe.
1. I cannot access https://gitlab.com/philmd/qemu/commits/arduino-v4
Oops I pushed to GitHub instead =) Now it is on GitLab too.
Quoted 2 lines
2. I merged your series into my workspace using patchwork
3. I payed attention that that you don't use automatic CPU detection (as suggested by Aleksandar) by reading elf.
I see, I based my work on your v38, and missed the later changes:
changes since v38
- fix elf loader function bug introduced by prev version
And probably:
changes since v39
- add frequency parameter to AVR timer
I'll look at Aleksandar suggestion and your last your changes, and update.
Quoted 1 line
4. There is difference between -bios and -kernel (arduino boars crash when -bios is used, but this seems because I run avr6 on avr5 CPU). I would be happy if you explained what is the difference between these two arguments.
qemu man page is not very helpful...
-bios file
Set the filename for the BIOS.
-kernel bzImage
Use bzImage as kernel image. The kernel can be either a
Linux kernel or in multiboot format.
Paolo, Peter, do you have a simple explanation?
Quoted 105 lines
5. make check-acceptance pass correctly
6. make check-qtest-avr pass correctlyQuoted 92 lines · Philippe Mathieu-Daudé
Hi,
This series add the arduino boards, aiming at removing the 'sample' board that doesn't follow any specification.
Since v3:
- Rebased on Michael's v41
- Drop 'extram' unused field (Igor)
- Renamed devices AVR -> Atmel (Aleksandar) (I haven't renamed structure names to ease review)Since v2:
- rebased on Michael's v40Since v1:
- Addressed Igor comments
- Addressed Aleksandar comments
- Fixed UART issue (was due to IRQ shifted by 2 in CPU)Since Michael's work is not yet merged, Various of my patches
- which are trivials or simple renames - could be squashed directly on his patches, if we ever care.
[I believe sending this patches is easier/quicker than keeping asking Michael to respin his series infinitely].Michael, do you mind testing it? The full series is available
here: https://gitlab.com/philmd/qemu/commits/arduino-v4Regards,
Phil.
Obsoletes: <[email protected]>
Based-on: <[email protected]>
https://www.mail-archive.com/[email protected]/msg671707.htmlPhilippe Mathieu-Daudé (18):
MAINTAINERS: Move machine test to the machine section (not ARCH one)
MAINTAINERS: Move the AVR machines in new section (not within ARM) tests/acceptance: Do not set the machine type manually tests/acceptance: Keep multilines comment consistent with other tests hw/char/avr: Reduce USART I/O size
hw/timer/avr_timer16: Rename memory region debugging name hw/misc/avr_mask: Remove unused include
hw/avr/Makefile: UseCONFIG_AVR_SAMPLEvariable
hw/char: Renameavr_usart->atmel_usart
hw/timer: Renameavr_timer16->atmel_timer16
hw/misc: Renameavr_mask->atmel_power
hw/avr: IntroduceATMEL_ATMEGA_MCUconfig
hw/avr: Add some ATmega microcontrollers
hw/avr: Add some Arduino boards
tests/boot-serial-test: Test some Arduino boards (AVR based) tests/acceptance: Test the Arduino MEGA2560 board
hw/avr: Remove the unrealistic AVR 'sample' board .travis.yml: Run the AVR acceptance testsdefault-configs/avr-softmmu.mak | 2 +- hw/avr/atmel_atmega.h | 48 ++ .../hw/char/{avr_usart.h => atmel_usart.h} | 10 +- include/hw/misc/{avr_mask.h => atmel_power.h} | 11 +- .../timer/{avr_timer16.h => atmel_timer16.h} | 10 +- hw/avr/arduino.c | 175 +++++++ hw/avr/atmel_atmega.c | 464 ++++++++++++++++++ hw/avr/sample.c | 295 ----------- hw/char/{avr_usart.c => atmel_usart.c} | 6 +- hw/misc/{avr_mask.c => atmel_power.c} | 4 +- hw/timer/{avr_timer16.c => atmel_timer16.c} | 10 +- tests/qtest/boot-serial-test.c | 3 +- .travis.yml | 2 +- MAINTAINERS | 29 +- hw/avr/Kconfig | 11 +- hw/avr/Makefile.objs | 3 +- hw/char/Kconfig | 2 +- hw/char/Makefile.objs | 2 +- hw/misc/Kconfig | 2 +- hw/misc/Makefile.objs | 2 +- hw/timer/Kconfig | 2 +- hw/timer/Makefile.objs | 2 +- tests/acceptance/machine_avr6.py | 11 +- 23 files changed, 751 insertions(+), 355 deletions(-) create mode 100644 hw/avr/atmel_atmega.h rename include/hw/char/{avr_usart.h => atmel_usart.h} (93%) rename include/hw/misc/{avr_mask.h => atmel_power.h} (89%) rename include/hw/timer/{avr_timer16.h => atmel_timer16.h} (92%) create mode 100644 hw/avr/arduino.c create mode 100644 hw/avr/atmel_atmega.c delete mode 100644 hw/avr/sample.c rename hw/char/{avr_usart.c => atmel_usart.c} (99%) rename hw/misc/{avr_mask.c => atmel_power.c} (97%) rename hw/timer/{avr_timer16.c => atmel_timer16.c} (98%)Quoted 3 lines
--
2.21.1--
Best Regards,
Michael Rolnik
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 1 line
4. There is difference between -bios and -kernel (arduino boars crash when -bios is used, but this seems because I run avr6 on avr5 CPU). I would be happy if you explained what is the difference between these two arguments.
qemu man page is not very helpful...
Quoted 8 lines
-bios file
Set the filename for the BIOS.-kernel bzImage
Use bzImage as kernel image. The kernel can be either a
Linux kernel or in multiboot format.Paolo, Peter, do you have a simple explanation?
It depends on your target board. They *can* do very different things.
E.g. for "pc" (x86) machine, -bios sets the seabios image to use, and -kernel loads a kernel image that seabios will invoke.
E.g. for "dp264" (alpha) machine, -bios sets the palcode image to use and -kernel loads a kernel image. Note that in this case, the alpha kernel relies on palcode services, so both must be present for the system to work.
E.g. for "virt" (arm) machine, -bios loads a raw image at which the reset vector will be pointed, whereas -kernel loads a linux kernel image and follows the arm-linux kernel boot protocol. In other words the images are treated very differently.
I don't know what, if anything, an avr kernel would require from boot services.
I suspect the two options *could* be treated identically.
r~
Quoted 23 lines · Richard Henderson
Quoted 4 lines · Philippe Mathieu-Daudé
Quoted 1 line
4. There is difference between -bios and -kernel (arduino boars crash when -bios is used, but this seems because I run avr6 on avr5 CPU). I would be happy if you explained what is the difference between these two arguments.
qemu man page is not very helpful...
Quoted 8 lines
-bios file
Set the filename for the BIOS.-kernel bzImage
Use bzImage as kernel image. The kernel can be either a
Linux kernel or in multiboot format.Paolo, Peter, do you have a simple explanation?
It depends on your target board. They *can* do very different things.
E.g. for "pc" (x86) machine, -bios sets the seabios image to use, and -kernel loads a kernel image that seabios will invoke.
E.g. for "dp264" (alpha) machine, -bios sets the palcode image to use and -kernel loads a kernel image. Note that in this case, the alpha kernel relies on palcode services, so both must be present for the system to work.
Quoted 7 lines
E.g. for "virt" (arm) machine, -bios loads a raw image at which the reset vector will be pointed, whereas -kernel loads a linux kernel image and follows the arm-linux kernel boot protocol. In other words the images are treated very differently.
I don't know what, if anything, an avr kernel would require from boot services.
I suspect the two options *could* be treated identically.
I think -bios used to be dumb, and originally it would only load a binary blob at a fixed memory address (like mapping a ROM or a parallel flash). And -kernel was a bit smarter, understanding ELF format. It can set (Linux) arch-specific registers, in particular when used with -append (cmdline) and -dtb (device tree).
At some point -bios got to understand ELF too, so QEMU could load ROMs mapped at different base address (and not force a default one).