-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EEPROM image generator #2
base: master
Are you sure you want to change the base?
Conversation
Looks good! Any chance you can add build instructions to the readme? |
eepromgen.c
Outdated
|
||
int main() { | ||
size_t i; | ||
FILE* eepromFile = fopen("./eeprom.bin", "wb"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid the ./
prefix. It will break some platforms.
eepromgen.c
Outdated
fwrite(default_eeprom, 1, 256, eepromFile); | ||
fclose(eepromFile); | ||
} else { | ||
printf("Opening eeprom.bin for write failed!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fprintf(stderr, ...
eepromgen.c
Outdated
fwrite(default_eeprom, 1, 256, eepromFile); | ||
fclose(eepromFile); | ||
} else { | ||
printf("Opening eeprom.bin for write failed!\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd suggest to have const char* path = "eeprom.bin";
for the fopen(path, "wb")
and then use "Creating '%s' failed.", path
eepromgen.c
Outdated
size_t i; | ||
FILE* eepromFile = fopen("./eeprom.bin", "wb"); | ||
if (eepromFile) { | ||
fwrite(default_eeprom, 1, 256, eepromFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could should check if all 256 bytes were written probably.
At very least an assert would be good
eepromgen.c
Outdated
}; | ||
|
||
int main() { | ||
size_t i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is never used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, not sure why I added that one in the first place. Has since been removed.
eepromgen.c
Outdated
#include <stddef.h> | ||
|
||
/* Bunnies eeprom */ | ||
const unsigned char default_eeprom[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Make this static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
As suggested in xqemu/xqemu-manager#57 , here comes an EEPROM image (generator).