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

Print port as an unsigned number#8

Open
simark wants to merge 21 commits intoTraumflug:traumflugfrom
simark:traumflug
Open

Print port as an unsigned number#8
simark wants to merge 21 commits intoTraumflug:traumflugfrom
simark:traumflug

Conversation

@simark
Copy link

@simark simark commented Aug 28, 2015

When connecting with gdb, it changes

Connection opened by host 127.0.0.1, port -31795.

to something like

Connection opened by host 127.0.0.1, port 35990.

Traumflug and others added 21 commits February 25, 2015 00:06
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.
Sync "#ifdef _MSC_VER" ELFLoad definition with src/avrreadelf.h
declaration.
There were errors like this:

  WARNING: file avrreadelf.cpp: line 417: ELF signature 0xffffffff taking precedence over ELF siminfo device name atmega644
  WARNING: file avrreadelf.cpp: line 441: unknown signature in ELF file: 0xffffffff

Problem was variable "signature" being initialised to max(), but
checked against zero.

To avoid more such confusions the whole function was rewritten in
a more sorted order. Functionality should be still the same.
Simply make them the same as their non-p counterparts, even is this
isn't entirley correct; e.g. 644 has only one UART, 644p has two.

No need to also change src/avrsignature.cpp, these variants are
already known there.
For unknown reasons, AvrDevice::Step() of an ATmega644
occasionally returns 1. This was ignored up until the breaking
patch came along. Return to ignoring this flag again.
The message combined the expected runtime with the actual number
of cycles simulated. These two don't fit in case the simulation
was aborted prematurely by some means.
It changes something like

  Connection opened by host 127.0.0.1, port -31795.

to something like

  Connection opened by host 127.0.0.1, port 35990.
@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.

3 participants