##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    06/Aug/2008  20:08:55 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\Pasha\elf\_MY_PROJECT_\naticq_mod2\conf_loader.c  #
#    Command line    =  D:\Pasha\elf\_MY_PROJECT_\naticq_mod2\conf_loader.c  #
#                       -D NEWSGOLD -D ELKA -D UIN_WRITE --preprocess        #
#                       D:\Pasha\elf\_MY_PROJECT_\naticq_mod2\Release_ELKA\L #
#                       ist\ -lC D:\Pasha\elf\_MY_PROJECT_\naticq_mod2\Relea #
#                       se_ELKA\List\ -o D:\Pasha\elf\_MY_PROJECT_\naticq_mo #
#                       d2\Release_ELKA\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\_MY_PROJECT_\naticq_mod2\Release_ELKA\L #
#                       ist\conf_loader.lst                                  #
#    Object file     =  D:\Pasha\elf\_MY_PROJECT_\naticq_mod2\Release_ELKA\O #
#                       bj\conf_loader.r79                                   #
#                                                                            #
#                                                                            #
##############################################################################

D:\Pasha\elf\_MY_PROJECT_\naticq_mod2\conf_loader.c
      1          #include "..\inc\swilib.h"
      2          #include "..\inc\cfg_items.h"
      3          #include "conf_loader.h"
      4          
      5          #pragma segment="CONFIG_C"

   \                                 In segment CODE, align 4, keep-with-next
      6          int SaveConfigData(const char *fname)
      7          {
      8            int f;
      9            unsigned int ul;
     10            int result=-1;
     11            unsigned int wlen;
     12            unsigned int len=(char *)__segment_end("CONFIG_C")-(char *)__segment_begin("CONFIG_C");
   \                     SaveConfigData:
   \   00000000   60109FE5           LDR      R1,??SaveConfigData_0  ;; SFE(CONFIG_C)
   \   00000004   F0402DE9           PUSH     {R4-R7,LR}
   \   00000008   5C509FE5           LDR      R5,??SaveConfigData_0+0x4  ;; SFB(CONFIG_C)
   \   0000000C   04D04DE2           SUB      SP,SP,#+4
   \   00000010   0040E0E3           MVN      R4,#+0
   \   00000014   056041E0           SUB      R6,R1,R5
     13          
     14            if ((f=fopen(fname,A_WriteOnly+A_BIN+A_Create+A_Truncate,P_WRITE,&ul))!=-1)
   \   00000018   0D30A0E1           MOV      R3,SP
   \   0000001C   402FA0E3           MOV      R2,#+256
   \   00000020   0110A0E3           MOV      R1,#+1
   \   00000024   831C81E3           ORR      R1,R1,#0x8300
   \   00000028   0A0000EF           SWI      +10
   \   0000002C   0070A0E1           MOV      R7,R0
   \   00000030   010077E3           CMN      R7,#+1
   \   00000034   0900000A           BEQ      ??SaveConfigData_1
     15            {
     16              wlen=fwrite(f,__segment_begin("CONFIG_C"),len,&ul);
   \   00000038   0D30A0E1           MOV      R3,SP
   \   0000003C   0620A0E1           MOV      R2,R6
   \   00000040   0510A0E1           MOV      R1,R5
   \   00000044   0C0000EF           SWI      +12
   \   00000048   0050A0E1           MOV      R5,R0
     17              fclose(f,&ul);
   \   0000004C   0D10A0E1           MOV      R1,SP
   \   00000050   0700A0E1           MOV      R0,R7
   \   00000054   0D0000EF           SWI      +13
     18              if (wlen==len) result=0;
   \   00000058   060055E1           CMP      R5,R6
   \   0000005C   0040A003           MOVEQ    R4,#+0
     19            }
     20            return(result);
   \                     ??SaveConfigData_1:
   \   00000060   0400A0E1           MOV      R0,R4
   \   00000064   F280BDE8           POP      {R1,R4-R7,PC}    ;; return
   \                     ??SaveConfigData_0:
   \   00000068   ........           DC32     SFE(CONFIG_C)
   \   0000006C   ........           DC32     SFB(CONFIG_C)
     21          }
     22          

   \                                 In segment CODE, align 4, keep-with-next
     23          int LoadConfigData(const char *fname, void* cfg,unsigned int len)
     24          {
   \                     LoadConfigData:
   \   00000000   F0402DE9           PUSH     {R4-R7,LR}
   \   00000004   04D04DE2           SUB      SP,SP,#+4
   \   00000008   0140A0E1           MOV      R4,R1
   \   0000000C   0250A0E1           MOV      R5,R2
     25            int f;
     26            unsigned int ul;
     27            int result=-1;
   \   00000010   0060E0E3           MVN      R6,#+0
     28            if ((f=fopen(fname,A_ReadOnly+A_BIN,P_READ,&ul))!=-1)
   \   00000014   0D30A0E1           MOV      R3,SP
   \   00000018   8020A0E3           MOV      R2,#+128
   \   0000001C   801CA0E3           MOV      R1,#+32768
   \   00000020   0A0000EF           SWI      +10
   \   00000024   0070A0E1           MOV      R7,R0
   \   00000028   010077E3           CMN      R7,#+1
   \   0000002C   0C00000A           BEQ      ??LoadConfigData_0
     29            {
     30              if (fread(f,cfg,len,&ul)==len)
   \   00000030   0D30A0E1           MOV      R3,SP
   \   00000034   0520A0E1           MOV      R2,R5
   \   00000038   0410A0E1           MOV      R1,R4
   \   0000003C   0B0000EF           SWI      +11
   \   00000040   050050E1           CMP      R0,R5
   \   00000044   0D10A0E1           MOV      R1,SP
   \   00000048   0700A0E1           MOV      R0,R7
   \   0000004C   0300001A           BNE      ??LoadConfigData_1
     31              {
     32                fclose(f,&ul);
   \   00000050   0D0000EF           SWI      +13
     33                result = 0;
   \   00000054   0060A0E3           MOV      R6,#+0
   \   00000058   0600A0E1           MOV      R0,R6
   \   0000005C   F280BDE8           POP      {R1,R4-R7,PC}
     34              }
     35              else
     36              {
     37                fclose(f,&ul);
   \                     ??LoadConfigData_1:
   \   00000060   0D0000EF           SWI      +13
     38              }
     39            }
     40            return(result);
   \                     ??LoadConfigData_0:
   \   00000064   0600A0E1           MOV      R0,R6
   \   00000068   F280BDE8           POP      {R1,R4-R7,PC}    ;; return
     41          }
     42          
     43          

   \                                 In segment DATA_I, align 4, align-sorted
     44          char *config_path=":\\zbin\\etc";
   \                     config_path:
   \   00000000                      DS8 4
   \   00000004                      REQUIRE `?<Initializer for config_path>`

   \                                 In segment CODE, align 4, keep-with-next
     45          int InitConfig(void* cfgstruct, int len, char *name,int disk)
     46          {
   \                     InitConfig:
   \   00000000   30402DE9           PUSH     {R4,R5,LR}
   \   00000004   80D04DE2           SUB      SP,SP,#+128
     47            int result;
     48            char config_name[128];
     49            sprintf(config_name, "%d%s\\%s.bcfg", disk, config_path,name);
   \   00000008   04002DE9           PUSH     {R2}
   \   0000000C   0150A0E1           MOV      R5,R1
   \   00000010   30109FE5           LDR      R1,??InitConfig_0  ;; config_path
   \   00000014   0040A0E1           MOV      R4,R0
   \   00000018   0300A0E1           MOV      R0,R3
   \   0000001C   003091E5           LDR      R3,[R1, #+0]
   \   00000020   24109FE5           LDR      R1,??InitConfig_0+0x4  ;; `?<Constant "%d%s\\\\%s.bcfg">`
   \   00000024   0020A0E1           MOV      R2,R0
   \   00000028   04008DE2           ADD      R0,SP,#+4
   \   0000002C   160000EF           SWI      +22
     50            result = LoadConfigData(config_name,  cfgstruct, len);
     51            return result;
   \   00000030   0520A0E1           MOV      R2,R5
   \   00000034   0410A0E1           MOV      R1,R4
   \   00000038   04008DE2           ADD      R0,SP,#+4
   \   0000003C   ........           BL       LoadConfigData
   \   00000040   84D08DE2           ADD      SP,SP,#+132
   \   00000044   3080BDE8           POP      {R4,R5,PC}       ;; return
   \                     ??InitConfig_0:
   \   00000048   ........           DC32     config_path
   \   0000004C   ........           DC32     `?<Constant "%d%s\\\\%s.bcfg">`
     52          }

   \                                 In segment DATA_ID, align 4, align-sorted
   \                     `?<Initializer for config_path>`:
   \   00000000   ........           DC32 `?<Constant ":\\\\zbin\\\\etc">`

   \                                 In segment CONFIG_C, align 1

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant ":\\\\zbin\\\\etc">`:
   \   00000000   3A5C7A62696E       DC8 ":\\zbin\\etc"
   \              5C65746300  
   \   0000000B   00                 DC8 0

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant "%d%s\\\\%s.bcfg">`:
   \   00000000   256425735C25       DC8 "%d%s\\%s.bcfg"
   \              732E62636667
   \              00          
   \   0000000D   000000             DC8 0, 0, 0

   Maximum stack usage in bytes:

     Function       CSTACK
     --------       ------
     InitConfig       144
     LoadConfigData    24
     SaveConfigData    24


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     SaveConfigData                  112
     LoadConfigData                  108
     config_path                       4
     InitConfig                       80
     ?<Initializer for config_path>    4
     ?<Constant ":\\zbin\\etc">       12
     ?<Constant "%d%s\\%s.bcfg">      16
      Others                          24

 
 312 bytes in segment CODE
  28 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 (+ 24 bytes shared)
  32 bytes of CONST memory
   4 bytes of DATA  memory

Errors: none
Warnings: none
