Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

added args to simulavr to define serial device #3

Open
wants to merge 20 commits into
base: traumflug
Choose a base branch
from

Conversation

pat1
Copy link

@pat1 pat1 commented Dec 30, 2013

after problems with #1 and #2 I use this patch to try simulavr with arduino elf and use the "classic" serial monitor on stdin/stdout

Traumflug and others added 20 commits November 19, 2013 19:18
This enhances encapsulation and simplifies code, both of which are
generally considered to be a good thing.
About every tool on this planet uses a lowercase v for "verbose",
do it here, too.
This example is extremely simple, it does nothing fancy, breath taking
or showing advanced coding skills. It also depends on neither TCL nor
Python. It's purpose is to exercise the UART serial port and to show
how to make this port available in a simulation _without_ altering the
binary.

The code is tested on real hardware already and works just as expected.
For now this is a proof of concept. Storing parameters works fine,
reading them back, too, but instead of being used, they're simple
written to the console. For now the parameters are device type and
cpu frequency, but the concept can be extended easily to all other
command line parameters.

The proof is applied to the simple_serial example.

The point of this strategy is to avoid the neccessity to run
simulavr with more command line parameters than just the name of
the ELF file. At compilation time we know best for which device
we compile, after all.
Substantial part of this patch is a move from accessing protected
properties of class AvrDevice directly to using their Getters.
This makes the ELf file slightly bigger, but reading it more simple
and failure-proof.
avr-gcc has been seen to set the length field to zero. Clearly a bug,
but ignoring bugs doesn't help.
Applied to the simple_serial example, but no action yet,
just the info transport.
This class moves serial output to a file, to a special file or to
stdout.

While there's special_output_port already, using an UI device
neither changes the AVR code nor does it influence AVR behaviour.
Once I found out on how it's done, it was surprisingly simple.

Even better for the user: No need for TCL, no need for Python, no
need for Swig, just add a single, simple macro to your AVR source
code.
Almost the same as SIMINFO_SERIAL_IN(), but the other direction.
Just like the Rx counterpart, this is for communications between
a file/special file/console and the actually simulated UART. Works
beautifully.
Just as the Rx counterpart, you can now connect to the console,
a pipe file or even a serial device file of the host. All without
additional scripting and languages, just a macro in the AVR source
code.
@pat1 pat1 mentioned this pull request Dec 30, 2013
@Traumflug Traumflug force-pushed the traumflug branch 2 times, most recently from 0b2e965 to 076ca5c Compare February 24, 2015 23:43
@Traumflug Traumflug force-pushed the traumflug branch 3 times, most recently from 3e1b746 to 0f64e17 Compare September 18, 2015 11:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants