summaryrefslogtreecommitdiff
path: root/utils/imxtools/sbtools/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imxtools/sbtools/elf.c')
-rw-r--r--utils/imxtools/sbtools/elf.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/imxtools/sbtools/elf.c b/utils/imxtools/sbtools/elf.c
index 5626c0f58c..76f29c6db7 100644
--- a/utils/imxtools/sbtools/elf.c
+++ b/utils/imxtools/sbtools/elf.c
@@ -20,6 +20,7 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "elf.h" 21#include "elf.h"
22#include "misc.h" 22#include "misc.h"
23#include <stdarg.h>
23 24
24/** 25/**
25 * Definitions 26 * Definitions
@@ -723,3 +724,28 @@ void elf_release(struct elf_params_t *params)
723 seg = next_seg; 724 seg = next_seg;
724 } 725 }
725} 726}
727
728void elf_std_printf(void *user, bool error, const char *fmt, ...)
729{
730 if(!g_debug && !error)
731 return;
732 (void) user;
733 va_list args;
734 va_start(args, fmt);
735 vprintf(fmt, args);
736 va_end(args);
737}
738
739void elf_std_write(void *user, uint32_t addr, const void *buf, size_t count)
740{
741 FILE *f = user;
742 fseek(f, addr, SEEK_SET);
743 fwrite(buf, count, 1, f);
744}
745
746bool elf_std_read(void *user, uint32_t addr, void *buf, size_t count)
747{
748 if(fseek((FILE *)user, addr, SEEK_SET) == -1)
749 return false;
750 return fread(buf, 1, count, (FILE *)user) == count;
751}