/**************************************************************************** * There must be a tno_template.bin in the current directory. * * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is Ndless code. * * The Initial Developer of the Original Code is Olivier ARMAND * . * Portions created by the Initial Developer are Copyright (C) 2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): ****************************************************************************/ #include #include #include #include #define MAX(a,b) ({typeof(a) __a = (a); typeof(b) __b = (b); (__a > __b) ? __a : __b;}) void error(const char* msg) { fprintf(stderr, "Error: %s.\n", msg); exit(1); } unsigned file_size(FILE *f) { int pos, end; pos = ftell(f); fseek (f, 0, SEEK_END); end = ftell(f); fseek (f, pos, SEEK_SET); return end; } typedef struct { const char *os_name; unsigned addrs[2]; } s_os_addrs; // OS-specific s_os_addrs os_addrs[] = { { "3.1.0-ncas", { 0x1004DE18 /* mov lr, #0 */, 0x1037BC8C /* strcpy */} }, { "3.1.0-cas", { 0x1004DD54 /* mov lr, #0 */, 0x1037C3BC /* strcpy */} }, { "3.1.0-ncascx", { 0x1004D514 /* mov lr, #0 */, 0x1037954C /* strcpy */} }, { "3.1.0-cascx", { 0x1004D478 /* mov lr, #0 */, 0x10379CDC /* strcpy */} }, { "3.1.0-cmc", { 0x10049FB0 /* mov lr, #0 */, 0x10362918 /* strcpy */} }, { "3.1.0-cascmc", { 0x10049F14 /* mov lr, #0 */, 0x103630A8 /* strcpy */} }, }; int main(int argc, const char* argv[]) { if (argc != 6) { puts("Usage: MakeTNO