⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makelo.c

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* -*-C-*- * * Copyright (c) 1996 Advanced RISC Machines Limited * All Rights Reserved * * $Revision: 1.17.6.1 $ *   $Author: rivimey $ *     $Date: 1998/03/03 13:49:11 $ * * makelo.c - This file is part of the Angel build world. It is used * to construct the assembler manifests source file. This ensures that * we only need to maintain a single copy of important definitions, * with this program being used to automatically build the target * header, if the 'C' source headers change. * * It is unfortunate that we need to keep this file up-to-date by * hand. However, the assembler values will always match the 'C' * definitions... and the build will fail if a definition required by * assembler code has not been added to this file. */#include <stdio.h>#include <time.h>/* The following are the Angel headers from which we take information: */#include "angel.h"#include "adp.h"#include "arm.h"#include "devices.h"#include "serial.h"#include "serlock.h"#include "devconf.h"#include "support.h"#include "hw.h"#define maxstring       (256)int main(int argc, char **argv){  time_t     tval = time(NULL);   /* seconds since "January 1st 1970 GMT" */  struct tm *timeptr;             /* full time structure */  FILE      *outfile = stdout;    /* in-case we want to add code to write                                   * to a specified file */  char       buffer[maxstring];   /* temporary string construction buffer */  char      *tptr;                /* temporary string pointer */  int        index;               /* general index counter */  timeptr = gmtime(&tval);  if (timeptr == NULL) timeptr = localtime(&tval);  /*   * some sanity checks on configuration parameters   */  if (DE_NUM_INT_HANDLERS != IH_NUM_DEVICES)  {      fprintf(stderr,              "ERROR: DE_NUM_INT_HANDLERS (%d) != IH_NUM_DEVICES (%d)\n",              DE_NUM_INT_HANDLERS, IH_NUM_DEVICES);      return 1;  }  /* Check for a command line parameter, and if so, use as the output file */  if (argc > 1)   {      if ((outfile = fopen(argv[1], "w")) <= (FILE *)0)          outfile = stdout;  }  /*   * output the file header   */  fprintf(outfile, "\tTTL Automatically generated by \"%s\"\n",argv[0]);  fprintf(outfile, "\t; Do not edit this file directly. Changes made to the 'C' header\n");  fprintf(outfile, "\t; files will force this file to be re-built by the make process.\n");  fprintf(outfile, "\tASSERT\t(listopts_s)\t; ensure listopt.s included\n");  fprintf(outfile, "old_opt\tSETA\t{OPT}\n");  fprintf(outfile, "\tOPT\t(opt_off)\n\n");  fprintf(outfile, "\t\tGBLL\tlolevel_s\n");  fprintf(outfile, "lolevel_s\tSETL\t{TRUE}\n\n");  /*   * We provide time and date information, in-case the developer wants   * to embed identification information into the lo-level assembler   * code:   */  fprintf(outfile, "\t; Time and Date variables\n");  fprintf(outfile, "\tGBLA\tMakeTime\t; secs since 1st Jan 1970\n");  fprintf(outfile, "\tGBLS\tMakeDate\t; full ANSI time and date\n");  fprintf(outfile, "\tGBLS\tMakeDay\t\t; full weekday name\n");  fprintf(outfile, "\tGBLS\tMakeMDay\t; month day\n");  fprintf(outfile, "\tGBLS\tMakeMonth\t; full month name\n");  fprintf(outfile, "\tGBLS\tMakeYear\t; full year number\n");  fprintf(outfile, "\tGBLS\tMakeClock\t; 24hour clock\n\n");  fprintf(outfile, "MakeTime\tSETA\t&%08X\n", tval);  sprintf(buffer, "%s", ctime(&tval));  for (tptr = buffer; (*tptr && (*tptr != '\n')); tptr++)    /* do nothing */    ;  *tptr = '\0'; /* replace newline with NULL */  fprintf(outfile, "MakeDate\tSETS\t\"%s\"\n", buffer);  index = strftime(buffer, maxstring, "%A", timeptr);  buffer[index] = '\0';  fprintf(outfile, "MakeDay\t\tSETS\t\"%s\"\n", buffer);  index = strftime(buffer, maxstring, "%d", timeptr);  buffer[index] = '\0';  fprintf(outfile, "MakeMDay\tSETS\t\"%s\"\n", buffer);  index = strftime(buffer, maxstring, "%B", timeptr);  buffer[index] = '\0';  fprintf(outfile, "MakeMonth\tSETS\t\"%s\"\n", buffer);  index = strftime(buffer, maxstring, "%Y", timeptr);  buffer[index] = '\0';  fprintf(outfile, "MakeYear\tSETS\t\"%s\"\n", buffer);  index = strftime(buffer, maxstring, "%H:%M", timeptr);  buffer[index] = '\0';  fprintf(outfile, "MakeClock\tSETS\t\"%s\"\n", buffer);  /* Standard ARM definitions */  fprintf(outfile, "\n\t; Standard ARM definitions\n");  fprintf(outfile, "reg_a1\tRN\t%d\n", reg_a1);  fprintf(outfile, "reg_a2\tRN\t%d\n", reg_a2);  fprintf(outfile, "reg_a3\tRN\t%d\n", reg_a3);  fprintf(outfile, "reg_a4\tRN\t%d\n", reg_a4);  fprintf(outfile, "reg_v1\tRN\t%d\n", reg_v1);  fprintf(outfile, "reg_v2\tRN\t%d\n", reg_v2);  fprintf(outfile, "reg_v3\tRN\t%d\n", reg_v3);  fprintf(outfile, "reg_v4\tRN\t%d\n", reg_v4);  fprintf(outfile, "reg_v5\tRN\t%d\n", reg_v5);  fprintf(outfile, "reg_v6\tRN\t%d\n", reg_v6);  fprintf(outfile, "reg_sl\tRN\t%d\n", reg_sl);  fprintf(outfile, "reg_fp\tRN\t%d\n", reg_fp);  fprintf(outfile, "reg_ip\tRN\t%d\n", reg_ip);  fprintf(outfile, "reg_sp\tRN\t%d\n", reg_sp);  fprintf(outfile, "reg_lr\tRN\t%d\n", reg_lr);  fprintf(outfile, "reg_pc\tRN\t%d\n", reg_pc);  fprintf(outfile, "reg_sb\tRN\t%d\n", reg_sb);  fprintf(outfile, "\nIRQDisable\t\tEQU\t0x%08X\n", IRQDisable);  fprintf(outfile, "FIQDisable\t\tEQU\t0x%08X\n", FIQDisable);  fprintf(outfile, "InterruptMask\t\tEQU\t0x%08X\n", InterruptMask);  fprintf(outfile, "ModeMask\t\tEQU\t0x%08X\n", ModeMask);  fprintf(outfile, "ModeMaskUFIS\t\tEQU\t0x%08X\n", ModeMaskUFIS);  fprintf(outfile, "USRmode\t\t\tEQU\t0x%08X\n", USRmode);  fprintf(outfile, "SYSmode\t\t\tEQU\t0x%08X\n", SYSmode);  fprintf(outfile, "SVCmode\t\t\tEQU\t0x%08X\n", SVCmode);  fprintf(outfile, "IRQmode\t\t\tEQU\t0x%08X\n", IRQmode);  fprintf(outfile, "FIQmode\t\t\tEQU\t0x%08X\n", FIQmode);  fprintf(outfile, "ABTmode\t\t\tEQU\t0x%08X\n", ABTmode);  fprintf(outfile, "UNDmode\t\t\tEQU\t0x%08X\n", UNDmode);  fprintf(outfile, "USR26mode\t\tEQU\t0x%08X\n", USR26mode);  fprintf(outfile, "IRQ26mode\t\tEQU\t0x%08X\n", IRQ26mode);  fprintf(outfile, "SVC26mode\t\tEQU\t0x%08X\n", SVC26mode);  fprintf(outfile, "cond_EQ\t\t\tEQU\t0x%08X\n", cond_EQ);  fprintf(outfile, "cond_mask\t\tEQU\t0x%08X\n", cond_mask);  fprintf(outfile, "Tbit\tEQU\t0x%08X\n", Tbit);  fprintf(outfile, "vec_reset\t\t\tEQU\t0x%08X\n", vec_reset);  fprintf(outfile, "vec_undefined_instruction\tEQU\t0x%08X\n",          vec_undefined_instruction);  fprintf(outfile, "vec_SWI\t\t\t\tEQU\t0x%08X\n", vec_SWI);  fprintf(outfile, "vec_prefetch_abort\t\tEQU\t0x%08X\n", vec_prefetch_abort);  fprintf(outfile, "vec_data_abort\t\t\tEQU\t0x%08X\n", vec_data_abort);  fprintf(outfile, "vec_unused\t\t\tEQU\t0x%08X\n", vec_unused);  fprintf(outfile, "vec_IRQ\t\t\t\tEQU\t0x%08X\n", vec_IRQ);  fprintf(outfile, "vec_FIQ\t\t\t\tEQU\t0x%08X\n", vec_FIQ);  fprintf(outfile, "\nangel_BreakPointInstruction_ARM\t\tEQU\t0x%08X\n",          angel_BreakPointInstruction_ARM);  fprintf(outfile, "angel_BreakPointInstruction_THUMB\tEQU\t0x%08X\n",          angel_BreakPointInstruction_THUMB);  fprintf(outfile, "angel_SWI_ARM\t\t\t\tEQU\t0x%08X\n", angel_SWI_ARM);  fprintf(outfile, "angel_SWI_THUMB\t\t\t\tEQU\t0x%08X\n", angel_SWI_THUMB);  fprintf(outfile, "angel_SWIreason_CLibBase\t\tEQU\t0x%08X\n",          angel_SWIreason_CLibBase);  fprintf(outfile, "angel_SWIreason_CLibLimit\t\tEQU\t0x%08X\n",          angel_SWIreason_CLibLimit);  fprintf(outfile, "angel_SWIreasonLimit\t\t\tEQU\t0x%08X\n",          angel_SWIreasonLimit);  fprintf(outfile, "angel_SWIreason_EnterSVC\t\tEQU\t0x%08X\n",          angel_SWIreason_EnterSVC);  fprintf(outfile, "angel_SWIreason_ReportException\t\tEQU\t0x%08X\n",          angel_SWIreason_ReportException);  fprintf(outfile, "angel_SWIreason_ApplDevice\t\tEQU\t0x%08X\n",          angel_SWIreason_ApplDevice);  fprintf(outfile, "angel_SWIreason_LateStartup\t\tEQU\t0x%08X\n",          angel_SWIreason_LateStartup);  fprintf(outfile, "AL_CONTINUE\t\tEQU\t0x%08X\n", AL_CONTINUE);  fprintf(outfile, "AL_BLOCK\t\tEQU\t0x%08X\n", AL_BLOCK);  fprintf(outfile, "\nFIQ_SAFETYLEVEL\t\tEQU\t0x%08X\n", FIQ_SAFETYLEVEL);  fprintf(outfile, "FIQ_NeverUsesSerialiser_DoesNotReschedule_HasNoBreakpoints\t\tEQU\t0x%08X\n",          FIQ_NeverUsesSerialiser_DoesNotReschedule_HasNoBreakpoints);  fprintf(outfile, "FIQ_NeverUsesSerialiser_DoesNotReschedule\t\tEQU\t0x%08X\n",          FIQ_NeverUsesSerialiser_DoesNotReschedule);  fprintf(outfile, "FIQ_NeverUsesSerialiser\t\tEQU\t0x%08X\n",          FIQ_NeverUsesSerialiser);  fprintf(outfile, "BRANCH_TO_HIGH_ROM_ON_RESET\t\tEQU\t0x%08X\n",          BRANCH_TO_HIGH_ROM_ON_RESET);  {    angel_RegBlock *rbp = (angel_RegBlock *)NULL;    fprintf(outfile, "\nAngel_RegBlock_R0offset\t\tEQU\t0x%08X\n",            &(rbp->r[0]));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -