Comments (13)
I suspect the corresponding m->tags[]
bytes are not set.
(off-topic: I also suspect the python implementation/wrapper of progress reporting does something else than the AVRDUDE progress reporting as I haven't seen the behaviour that "ing 0 %" is written for the latter.)
from avrdude.
The progress indication is indeed quite simplified.
Who is responsible for setting the tags? (and how is it done? :)
from avrdude.
As I've got that m->put
method, it could certainly somehow handle setting the tags.
from avrdude.
Who is responsible for setting the tags? (and how is it done? :)
Reading in a file for writing sets the tags (to manage holes in files in the Intel hex or Motorola S record format)
from avrdude.
Yes, the progress reporter is a much simplified version in my test (it's a plain Python callback now).
I guess I have to assign m->tag[]
in my m.put()
helper then, yes.
from avrdude.
Yep, works now:
>>> m=ad.avr_locate_mem(p, 'eeprom')
>>> ad.avr_read_mem(pgm, p, m)
Reading 100 %
512
>>> m.get(10)
b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
>>> m.put(b'The quick brown fox jumps over the lazy dog.')
44
>>> ad.avr_write_mem(pgm, p, m, 44)
Writing 100 %
44
>>> ad.avr_read_mem(pgm, p, m)
Reading 100 %
512
>>> m.get(44)
b'The quick brown fox jumps over the lazy dog.'
from avrdude.
All is working.
Finally, I could also write back my previously saved flash contents from the test device:
>>> m=ad.avr_locate_mem(p, 'flash')
>>> with open("dump.bin","rb") as f:
... b=f.read()
...
>>> len(b)
8666
>>> m.put(b)
8666
>>> ad.avr_write_mem(pgm, p, m, 8666)
avrdude: padding flash [0x2180, 0x21ff]
Writing 100 %
8666
from avrdude.
m.put
andm.get
are Python access methods tom->buf
, accepting or returning Python bytes objects
m.put
and m.get
ought to take an address within buffer argument as well in order to provide random access to m->buf
from avrdude.
They do, it is called offset
. It just defaults to 0.
from avrdude.
And for m.put
, the length is taken from the input byte string, while for m.get
, the length needs to be specified.
from avrdude.
Remember, this is Python, we can have default values for arguments. :-) (The SWIG wrapper can handle them, even though the C backend functions cannot.)
from avrdude.
They do, it is called offset. It just defaults to 0.
Ahh, great.
Yes, the progress reporter is a much simplified version in my test (it's a plain Python callback now).
In order to support the logic of libavrdude progress reporting, the application-specific update_progress()
functions should not do anything before a header was provided and they should stop updating on progress as soon as a terminating progress report call was issued. Basically, it's a logic that dances around
Lines 2685 to 2686 in 34366a6
This needs documentation, and this could be provided at the same time when Issue #1721 is dealt with.
from avrdude.
I think the existing progress_callback
in my Python test code works basically like that:
# very simplified progress callback
global prog_hdr
prog_hdr = ""
def progress_callback(percent: int, etime: float, hdr: str, finish: int):
if hdr:
global prog_hdr
prog_hdr = hdr
print(f"{prog_hdr} {percent:3d} %", end='\r', file=sys.stderr, flush=True)
if (percent == 100):
print("", file=sys.stderr)
But that's merely a simplified example right now. There's room for fine-tuning. :-)
from avrdude.
Related Issues (20)
- Which programmer supports "-E reset"? HOT 8
- Regression: EEPROM issue with official STK500 V1 FW -- avrdude 7.1 is okay but not 7.2 and 7.3 HOT 12
- EE-Prom data falsified by mySmartUSB Progammer HOT 32
- avr_{read,write}_mem fail to initialize progress reporting HOT 4
- Old `avrdude_message()` can go away HOT 3
- Progress reporting functions should be better documented HOT 1
- avr*timestamp() oddities HOT 4
- Help wanted: CMake to compile Qt .ui files HOT 7
- Wrong message level in `jtag3_prmsg()` HOT 1
- 0xff optimization when reading HOT 7
- Error when using linuxgpio HOT 3
- v7.3 detected as malware HOT 1
- Add support for libgpiod v2+ API HOT 2
- "jtag2 is not a unique start of a programmer name"
- `-F` option not honored
- Add support for more AVR-DU parts HOT 2
- Add support for emscripten HOT 6
- Trouble with Raspberry pi 5 HOT 13
- linuxgpio sysfs fallback improvement to deal with shifted GPIO numbering in new kernel version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avrdude.