int _debug;
+bool arg_print_sizes;
#define ARG_MATCH 0
#define ARG_NOMATCH 1
fprintf(stderr, " -h|--help Print this help\n");
fprintf(stderr, " -d|--debug Print verbose debugging info\n");
fprintf(stderr, " Repeat for more verbose debugging\n");
+ fprintf(stderr, " -s|--psize Print the size of the code after assembling\n");
}
int parse_args(int argc, char **argv)
return 1;
} else if ((res = cmp_arg(argv, &i, "--debug", "-d", 0)) == ARG_MATCH) {
_debug++;
+ } else if ((res = cmp_arg(argv, &i, "--psize", "-s", 0)) == ARG_MATCH) {
+ arg_print_sizes = 1;
} else {
fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
goto out_usage;
#ifndef BCM43xx_ASM_ARGS_H_
#define BCM43xx_ASM_ARGS_H_
+#include "util.h"
+
+
int parse_args(int argc, char **argv);
int open_input_file(void);
void close_input_file(void);
extern int _debug;
+extern bool arg_print_sizes;
#define IS_DEBUG (_debug > 0)
#define IS_VERBOSE_DEBUG (_debug > 1)
struct initval_raw raw;
struct fw_header hdr;
unsigned int size;
+ unsigned int filesize = 0;
memset(&hdr, 0, sizeof(hdr));
hdr.type = FW_TYPE_IV;
fn_len = strlen(outfile_name) + 512;
fn = xmalloc(fn_len);
- snprintf(fn, fn_len, "%s.%s.initval", outfile_name, ctx->sect->name);
+ snprintf(fn, fn_len, "%s.%s.initvals", outfile_name, ctx->sect->name);
fd = fopen(fn, "w+");
if (!fd) {
fprintf(stderr, "Could not open initval output file \"%s\"\n", fn);
fprintf(stderr, "Could not write initvals outfile\n");
exit(1);
}
+ filesize += size;
}
+
+ if (arg_print_sizes) {
+ printf("%s: %d values (%u bytes)\n",
+ fn, ctx->ivals_count, filesize);
+ }
+
fclose(fd);
free(fn);
}
break;
}
}
+
+ if (arg_print_sizes) {
+ printf("%s: text = %u instructions (%u bytes)\n",
+ fn, insn_count, insn_count * sizeof(uint64_t));
+ }
+
fclose(fd);
free(fn);
}