Originally Posted by
rags_to_riches
Your sprintf() in the function, now what are you trying to do there on the whole? Maybe issue a system command?
sprintf takes as its first argument an array of characters into which to copy the string, with the replacements.
I have done the corrections you offered, although they look like general clean-up, not really substantive changes. Although I guess clean code is better.
I used the sprintf function because it was used in an earlier overwrite function in the file, not because I was sure it was the correct tool.
I am trying to overwrite the BCB file to be 512 bytes (or 1088. either way), consisting of only 0's. That's really it.
That thread appears to me to be on a
developers forum, not an end-user forum?
The devs there tend to use the board to release software and offer support for it. I was the one poster who was willing and able to work on it. My C programming skill is obviously lacking. The fellow poster who was giving the majority of the advice was posting repeated snippets of unix commands.
I didn't start that thread and it is not devoted to code generally or this project period.
When I needed to learn how to diff and patch, I went to a linux forum and got help. If I needed to learn how to flash the bootloader, then I would certainly take it to the device board. I had a problem with C, so I went to a forum devoted to the topic.
Here is where I am. Any and all comment is appreciated.
Function
Code:
int clear_recovery_instructions_file(const char* file, char value) {
lcd_is_enabled = 0;
sprintf("fatsave mmc 1:2 0x81c00000 BCB 0x200", &value, file);
sprintf("fatsave mmc ${mmcromdev}:2 0x81c00000 devconf/BootCnt 4", &value, file);
lcd_is_enabled = 1;
}
call
Code:
if ((key & HOME_KEY) && (cursor == CLEAR_RECOVERY_INSTRUCTIONS)) { //clear boot count and reset BCB
clear_recovery_instructions_file ("BCB", '0');
udelay(RESET_TICK);
highlight_boot_line(cursor, HIGHLIGHT_GREEN);
do {udelay(RESET_TICK);} while (tps65921_keypad_keys_pressed(&key)); //wait for release
}
It compiles just fine, but won't resize the file. I know that it can be resized, because one early version resized it to 73 bytes. I have since found (I think) the area where the bytes are defined (0x200 in the top code block) but can no longer get the thing to change.
I cannot shake the feeling I am somewhat close, yet am doing something impossibly noobish to screw it up.