############################################################################## # # # IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION 14/Jan/2011 23:28:43 # # Copyright 1999-2005 IAR Systems. All rights reserved. # # # # Cpu mode = interwork # # Endian = little # # Stack alignment = 4 # # Source file = D:\pasha\elf\googlecode\MySMSYS\Mss3\conf_loader.c # # Command line = D:\pasha\elf\googlecode\MySMSYS\Mss3\conf_loader.c # # -D NEWSGOLD -D ELKA -D LANG_EN -lcN # # D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN # # \List\ -o D:\pasha\elf\googlecode\MySMSYS\Mss3\Relea # # se_ELKA_EN\Obj\ -s9 --no_unroll --cpu_mode arm # # --endian little --cpu ARM926EJ-S --stack_align 4 # # --interwork -e --fpu None --dlib_config # # "D:\pasha\Embedded Workbench 4.0 # # Evaluation2\ARM\LIB\dl5tpainl8n.h" -I # # "D:\pasha\Embedded Workbench 4.0 # # Evaluation2\ARM\INC\" --inline_threshold=2 # # List file = D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN # # \List\conf_loader.lst # # Object file = D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN # # \Obj\conf_loader.r79 # # # # # ############################################################################## D:\pasha\elf\googlecode\MySMSYS\Mss3\conf_loader.c 1 #include "..\..\inc\swilib.h" 2 #include "..\..\inc\cfg_items.h" 3 #include "conf_loader.h" 4 5 const char *successed_config_filename=""; 6 #pragma segment="CONFIG_C" 7 8 int LoadConfigData(const char *fname) 9 { 10 int f; 11 unsigned int ul; 12 char *buf; 13 int result=0; 14 void *cfg; 15 16 extern const CFG_HDR cfghdr0; //first var in CONFIG 17 cfg=(void*)&cfghdr0; 18 19 unsigned int len=(int)__segment_end("CONFIG_C")-(int)__segment_begin("CONFIG_C"); 20 21 if (!(buf=(char*)malloc(len))) return -1; 22 if ((f=fopen(fname,A_ReadOnly+A_BIN,P_READ,&ul))!=-1) 23 { 24 if (fread(f,buf,len,&ul)==len) 25 { 26 memcpy(cfg,buf,len); 27 fclose(f,&ul); 28 } 29 else 30 { 31 fclose(f,&ul); 32 goto L_SAVENEWCFG; 33 } 34 } 35 else 36 { 37 L_SAVENEWCFG: 38 if ((f=fopen(fname,A_ReadWrite+A_Create+A_Truncate,P_READ+P_WRITE,&ul))!=-1) 39 { 40 if (fwrite(f,cfg,len,&ul)!=len) result=-1; 41 fclose(f,&ul); 42 } 43 else 44 result=-1; 45 } 46 mfree(buf); 47 if (result>=0) successed_config_filename=fname; 48 return(result); 49 } 50 51 void InitConfig(void) 52 { 53 if(LoadConfigData("4:\\ZBin\\etc\\Mss3.bcfg")<0) 54 { 55 LoadConfigData("0:\\ZBin\\etc\\Mss3.bcfg"); 56 } 57 /* 58 #ifdef MEGADIAL 59 if (LoadConfigData("4:\\ZBin\\etc\\MssMD.bcfg")<0) 60 { 61 LoadConfigData("0:\\ZBin\\etc\\MssMD.bcfg"); 62 } 63 #else 64 if (LoadConfigData("4:\\ZBin\\etc\\MySMSYS.bcfg")<0) 65 { 66 LoadConfigData("0:\\ZBin\\etc\\MySMSYS.bcfg"); 67 } 68 #endif*/ 69 } 70 Maximum stack usage in bytes: Function CSTACK -------- ------ InitConfig 8 LoadConfigData 36 Segment part sizes: Function/Label Bytes -------------- ----- successed_config_filename 4 LoadConfigData 260 InitConfig 40 ? 4 ? 1 ? 48 Others 20 308 bytes in segment CODE 49 bytes in segment DATA_C 4 bytes in segment DATA_I 4 bytes in segment DATA_ID 12 bytes in segment INITTAB 300 bytes of CODE memory (+ 20 bytes shared) 53 bytes of CONST memory 4 bytes of DATA memory Errors: none Warnings: none