Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor
6  tools/Makefile
... ...
@@ -1,4 +1,4 @@
1  
-TARGETS=bin2hex mkmmimg flterm
  1
+TARGETS=mkmmimg flterm
2 2
 CC=clang
3 3
 
4 4
 all: $(TARGETS)
@@ -7,8 +7,8 @@ all: $(TARGETS)
7 7
 	$(CC) -O2 -Wall -I. -s -o $@ $<
8 8
 
9 9
 install: mkmmimg flterm
10  
-	cp mkmmimg /usr/bin
11  
-	cp flterm /usr/bin
  10
+	install -d /usr/local/bin
  11
+	install -m755 -t /usr/local/bin $^
12 12
 
13 13
 .PHONY: clean install
14 14
 
83  tools/bin2hex.c
... ...
@@ -1,83 +0,0 @@
1  
-/*
2  
- * Milkymist SoC
3  
- * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
4  
- *
5  
- * This program is free software: you can redistribute it and/or modify
6  
- * it under the terms of the GNU General Public License as published by
7  
- * the Free Software Foundation, version 3 of the License.
8  
- *
9  
- * This program is distributed in the hope that it will be useful,
10  
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  
- * GNU General Public License for more details.
13  
- *
14  
- * You should have received a copy of the GNU General Public License
15  
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  
- */
17  
- 
18  
-/* WARNING: This tool is little endian in 16-bit mode 
19  
- * and big endian in 32-bit mode. 
20  
- */
21  
-
22  
-#include <stdlib.h>
23  
-#include <string.h>
24  
-#include <stdio.h>
25  
-
26  
-int main(int argc, char *argv[])
27  
-{
28  
-	int i;
29  
-	int pad;
30  
-	FILE *fdi, *fdo;
31  
-	unsigned char w[4];
32  
-	int mode16;
33  
-	
34  
-	if((argc != 4) && (argc != 5)) {
35  
-		fprintf(stderr, "Usage: bin2hex <infile> <outfile> <size> [16]\n");
36  
-		return 1;
37  
-	}
38  
-	pad = atoi(argv[3]);
39  
-	if(pad <= 0) {
40  
-		fprintf(stderr, "Incorrect size\n");
41  
-		return 1;
42  
-	}
43  
-	fdi = fopen(argv[1], "rb");
44  
-	if(!fdi) {
45  
-		perror("Unable to open input file");
46  
-		return 1;
47  
-	}
48  
-	fdo = fopen(argv[2], "w");
49  
-	if(!fdo) {
50  
-		perror("Unable to open output file");
51  
-		fclose(fdi);
52  
-		return 1;
53  
-	}
54  
-	mode16 = (argc == 5) && (strcmp(argv[4], "16") == 0);
55  
-	if(mode16) {
56  
-		while(1) {
57  
-			if(fread(w, 2, 1, fdi) <= 0) break;
58  
-			fprintf(fdo, "%02hhx%02hhx\n", w[1], w[0]);
59  
-			pad--;
60  
-		}
61  
-	} else {
62  
-		while(1) {
63  
-			if(fread(w, 4, 1, fdi) <= 0) break;
64  
-			fprintf(fdo, "%02hhx%02hhx%02hhx%02hhx\n", w[0], w[1], w[2], w[3]);
65  
-			pad--;
66  
-		}
67  
-	}
68  
-	fclose(fdi);
69  
-	if(pad<0)
70  
-		fprintf(stderr, "Warning: Input binary is larger than specified size\n");
71  
-	if(mode16) {
72  
-		for(i=0;i<pad;i++)
73  
-			fprintf(fdo, "0000\n");
74  
-	} else {
75  
-		for(i=0;i<pad;i++)
76  
-			fprintf(fdo, "00000000\n");
77  
-	}
78  
-	if(fclose(fdo) != 0) {
79  
-		perror("Unable to close output file");
80  
-		return 1;
81  
-	}
82  
-	return 0;
83  
-}

No commit comments for this range

Something went wrong with that request. Please try again.