Hi Thomas:
El 02/11/15 a las 19:01, Thomas Jarosch escibió:
Hi SET,
Am 22.10.2015 um 21:11 schrieb Salvador Eduardo Tropea:
Hi!
I'm trying to include some data inside the EEPROM generated by ftdi_eeprom tool.
I modified the ftdi_eeprom tool and libftdi to:
1) Support a "--build-eeprom" command line option that just generates the
EEPROM image (only flashed if --flash-eeprom is provided)
2) Support two configuration options:
- user_data_addr an integer indicating the offset where we want to put the
user provided data.
- user_data_file a string indicating the filename that contains the binary data
to be added.
3) Extended libftdi API to store the above mentioned data inside the eeprom
struct.
4) Extended ftdi_eeprom_build to include this data.
I'm attaching the output of "git diff".
Is this patch acceptable?
Regards, SET
PS: I fixed a couple of computations that assumed the EEPROM size is 128.
thanks for your patch! It looks quite good and
just needs a few minor tweaks:
- ftdi_eeprom: Warn the user if the supplied user data
is too big for the storage area. Right now we silently truncate it.
Ok, I added a warning about it.
- Do we need to hardcode the hex offsets in "free_start"?
Could we also do "free_start += 1;" and so on?
Hmmm ... not sure. I just added this value after the last index used for
each part.
Now I moved it to a switch/case adjusting for each part.
- Hardcoding of 128 byte limit again in this line:
if (eeprom->size>128) user_area_size+=eeprom->size-128;
?
Would be good to add a comment here that explains why
it's there.
I think it was wrong. I eliminated it.
- Why not ftdi_error_return() in dangerous cases like this:
fprintf(stderr,"Warning, user data overlaps the strings area!\n");
?
Because the user could be doing it on purpose ;-)
Suppose the user knows that ftdi_eeprom lacks some obscure feature and
wants to overwrite an address that is supposed to be properly filled by
ftdi_eeprom.
- ftdi_set_eeprom_user_buf() -> rename to "ftdi_set_eeprom_user_data()"
Ok!
I'm attaching a patch with the above changes.
Regards, SET
--
Ing. Salvador Eduardo Tropea http://utic.inti.gob.ar/
INTI - Micro y Nanoelectrónica (CMNB) http://www.inti.gob.ar/
Unidad Técnica Sistemas Inteligentes Av. General Paz 5445
Tel: (+54 11) 4724 6300 ext. 6919 San Martín - B1650KNA
FAX: (+54 11) 4754 5194 Buenos Aires * Argentina
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
user_data.patch
Description: Text Data
|