From: Sebastien Bourdeauducq Date: Wed, 8 Feb 2012 14:08:03 +0000 (+0100) Subject: tools: remove bin2hex X-Git-Tag: 24jan2021_ls180~3247 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bfd2bf4ed391a7f4b845137613a12115d52964ab;p=litex.git tools: remove bin2hex --- diff --git a/tools/Makefile b/tools/Makefile index 0ed7497a..3c1e3079 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -TARGETS=bin2hex mkmmimg flterm +TARGETS=mkmmimg flterm CC=clang all: $(TARGETS) diff --git a/tools/bin2hex.c b/tools/bin2hex.c deleted file mode 100644 index e1ec2f10..00000000 --- a/tools/bin2hex.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Milkymist SoC - * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* WARNING: This tool is little endian in 16-bit mode - * and big endian in 32-bit mode. - */ - -#include -#include -#include - -int main(int argc, char *argv[]) -{ - int i; - int pad; - FILE *fdi, *fdo; - unsigned char w[4]; - int mode16; - - if((argc != 4) && (argc != 5)) { - fprintf(stderr, "Usage: bin2hex [16]\n"); - return 1; - } - pad = atoi(argv[3]); - if(pad <= 0) { - fprintf(stderr, "Incorrect size\n"); - return 1; - } - fdi = fopen(argv[1], "rb"); - if(!fdi) { - perror("Unable to open input file"); - return 1; - } - fdo = fopen(argv[2], "w"); - if(!fdo) { - perror("Unable to open output file"); - fclose(fdi); - return 1; - } - mode16 = (argc == 5) && (strcmp(argv[4], "16") == 0); - if(mode16) { - while(1) { - if(fread(w, 2, 1, fdi) <= 0) break; - fprintf(fdo, "%02hhx%02hhx\n", w[1], w[0]); - pad--; - } - } else { - while(1) { - if(fread(w, 4, 1, fdi) <= 0) break; - fprintf(fdo, "%02hhx%02hhx%02hhx%02hhx\n", w[0], w[1], w[2], w[3]); - pad--; - } - } - fclose(fdi); - if(pad<0) - fprintf(stderr, "Warning: Input binary is larger than specified size\n"); - if(mode16) { - for(i=0;i