qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: Liviu Ionescu <ilg@livius.net>
Cc: QEMU Developers <Qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC] QOM design - add instance data to Object
Date: Sat, 13 Jun 2015 15:48:41 -0700	[thread overview]
Message-ID: <CAEgOgz4B7wPKS3+KF4N+4aaC0CexLvTStS0BuGCLjn=+vycxxA@mail.gmail.com> (raw)
In-Reply-To: <42AEE112-EC4A-4814-B3C7-56EF1EF41363@livius.net>

On Sat, Jun 13, 2015 at 11:57 AM, Liviu Ionescu <ilg@livius.net> wrote:
>
>> On 13 Jun 2015, at 21:29, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
>>
>>
>> ... As all the information
>> you need to construct the object is constant per-concrete class, the
>> information can be added to the class to resolve.
>
> the one-instance-per-class might be true for MCUs, but generally it isn't, for example the LED object, you can have several LEDs in a machine, all having a common class, but different instances. similarly for GPIOs.
>

But there doesn't seem to be any demand for construction-sensitive
info there - at least yet.

> so, no, the class structure is not suitable for multi-instances objects, and even for singletons I think that using it for passing such configuration data is generally abusive.
>
>>> static STM32Capabilities stm32f103rb_capabilities = {
>>>    .cortexm = {
>>>        .device_name = TYPE_STM32F103RB,
>>
>> Why is the capabilities struct aware of its container type?
>
> ah, just for having the information available for verbosity. here is a typical run for a simple blinky application:
>

can you use object_get_typename?

Regards,
Peter

> GNU ARM Eclipse 64-bits QEMU v2.3.50 (qemu-system-gnuarmeclipse).
> Board: 'STM32-H103' (Olimex Header Board for STM32F103RBT6 (Experimental)).
> Device: 'STM32F103RB' (Cortex-M3, MPU), Flash: 128 KB, RAM: 20 KB.
> Image: '/Users/ilg/My Files/MacBookPro Projects/GNU ARM Eclipse/Eclipse Workspaces/qemu-images-44-osx/f1-h103-blink-sh-shd/Debug/f1-h103-blink-sh-shd.elf'.
> Command line: 'cm3 4' (5 bytes).
> Cortex-M3 core initialised.
> Cortex-M core reset.
>
> main(argc=2, argv=["cm3", "4"]);
> Hello ARM World!
> Standard output message.
> Standard error message.
> System clock: 72000000 Hz.
> [Green LED Off]
> [Green LED On]
> [Green LED Off]
> Second 1
> [Green LED On]
> [Green LED Off]
> Second 2
> [Green LED On]
> [Green LED Off]
> Second 3
> [Green LED On]
> [Green LED Off]
> Second 4
> QEMU exit(0)
>
>> Why do you need to make it one giant struct with its own inheritance
>> hierarchy? With the class idea, you would just split this to two
>> structs for cortexm and stm32.
>
> sure, this can be done, but when using constructors, this requires passing two pointers instead of one.
>
>
> regards,
>
> Liviu
>
>
>
>

  parent reply	other threads:[~2015-06-13 22:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 11:33 [Qemu-devel] [RFC] QOM design - add instance data to Object Liviu Ionescu
2015-06-13  8:42 ` Liviu Ionescu
2015-06-13  9:29 ` Peter Crosthwaite
2015-06-13 11:41   ` Liviu Ionescu
2015-06-13 17:53     ` [Qemu-devel] [RFC] QOM design - add instance data to Object (-> add constructors) Liviu Ionescu
2015-06-13 18:29     ` [Qemu-devel] [RFC] QOM design - add instance data to Object Peter Crosthwaite
2015-06-13 18:57       ` Liviu Ionescu
2015-06-13 19:52         ` [Qemu-devel] [RFC] QOM design - add instance data to Object (-> add constructors) Liviu Ionescu
2015-06-13 22:46           ` Peter Crosthwaite
2015-06-14  0:56             ` Liviu Ionescu
2015-06-14  1:49               ` Peter Crosthwaite
2015-06-14 12:43                 ` Liviu Ionescu
2015-06-14 13:39                   ` Liviu Ionescu
2015-06-15  7:35                   ` Liviu Ionescu
2015-06-14 14:21                 ` Liviu Ionescu
2015-06-13 22:48         ` Peter Crosthwaite [this message]
2015-06-14 18:47   ` [Qemu-devel] [RFC] QOM design - add instance data to Object Liviu Ionescu
2015-06-14 21:28     ` Peter Crosthwaite

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='CAEgOgz4B7wPKS3+KF4N+4aaC0CexLvTStS0BuGCLjn=+vycxxA@mail.gmail.com' \
    --to=peter.crosthwaite@xilinx.com \
    --cc=Qemu-devel@nongnu.org \
    --cc=ilg@livius.net \
    /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).