##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    29/Oct/2008  03:34:12 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\Pasha\elf\_MY_PROJECT_\NRSS\conf_loader.c         #
#    Command line    =  D:\Pasha\elf\_MY_PROJECT_\NRSS\conf_loader.c -D      #
#                       NEWSGOLD -D ELKA -lCN D:\Pasha\elf\_MY_PROJECT_\NRSS #
#                       \Release_ELKA\List\ -la D:\Pasha\elf\_MY_PROJECT_\NR #
#                       SS\Release_ELKA\List\ -o D:\Pasha\elf\_MY_PROJECT_\N #
#                       RSS\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_\NRSS\Release_ELKA\List\con #
#                       f_loader.lst                                         #
#    Object file     =  D:\Pasha\elf\_MY_PROJECT_\NRSS\Release_ELKA\Obj\conf #
#                       _loader.r79                                          #
#                                                                            #
#                                                                            #
##############################################################################

D:\Pasha\elf\_MY_PROJECT_\NRSS\conf_loader.c
      1          #include "..\inc\swilib.h"
      2          #include "..\inc\cfg_items.h"
      3          #include "conf_loader.h"
      4          

   \                                 In segment DATA_I, align 4, align-sorted
      5          const char *successed_config_filename="";
   \                     successed_config_filename:
   \   00000000                      DS8 4
   \   00000004                      REQUIRE `?<Initializer for successed_config_filename>`
      6          
      7          #pragma segment="CONFIG_C"

   \                                 In segment CODE, align 4, keep-with-next
      8          int LoadConfigData(const char *fname)
      9          {
   \                     LoadConfigData:
   \   00000000   F14F2DE9           PUSH     {R0,R4-R11,LR}
     10            int f;
     11            unsigned int ul;
     12            char *buf;
     13            int result=0;
     14            void *cfg;
     15            unsigned int rlen, end;
     16          
     17            cfg=(char *)__segment_begin("CONFIG_C");
     18          
     19            unsigned int len=(char *)__segment_end("CONFIG_C")-(char *)__segment_begin("CONFIG_C");
   \   00000004   18519FE5           LDR      R5,??LoadConfigData_0  ;; SFB(CONFIG_C)
   \   00000008   18019FE5           LDR      R0,??LoadConfigData_0+0x4  ;; SFE(CONFIG_C)
   \   0000000C   04D04DE2           SUB      SP,SP,#+4
   \   00000010   0040A0E3           MOV      R4,#+0
   \   00000014   056040E0           SUB      R6,R0,R5
     20          
     21            if (!(buf=malloc(len))) return -1;
   \   00000018   0600A0E1           MOV      R0,R6
   \   0000001C   140000EF           SWI      +20
   \   00000020   0070B0E1           MOVS     R7,R0
   \   00000024   0400E001           MVNEQ    R0,R4
   \   00000028   F68FBD08           POPEQ    {R1,R2,R4-R11,PC}
     22            if ((f=fopen(fname,A_ReadOnly+A_BIN,P_READ,&ul))!=-1)
   \   0000002C   04009DE5           LDR      R0,[SP, #+4]
   \   00000030   0D30A0E1           MOV      R3,SP
   \   00000034   8020A0E3           MOV      R2,#+128
   \   00000038   801CA0E3           MOV      R1,#+32768
   \   0000003C   0A0000EF           SWI      +10
   \   00000040   00A0A0E1           MOV      R10,R0
   \   00000044   0480E0E1           MVN      R8,R4
   \   00000048   08005AE1           CMP      R10,R8
   \   0000004C   1800000A           BEQ      ??LoadConfigData_1
     23            {
     24              rlen=fread(f,buf,len,&ul);
   \   00000050   0D30A0E1           MOV      R3,SP
   \   00000054   0620A0E1           MOV      R2,R6
   \   00000058   0710A0E1           MOV      R1,R7
   \   0000005C   0B0000EF           SWI      +11
   \   00000060   0090A0E1           MOV      R9,R0
     25              end=lseek(f,0,S_END,&ul,&ul);
   \   00000064   0D00A0E1           MOV      R0,SP
   \   00000068   01002DE9           PUSH     {R0}
   \   0000006C   04308DE2           ADD      R3,SP,#+4
   \   00000070   0220A0E3           MOV      R2,#+2
   \   00000074   0010A0E3           MOV      R1,#+0
   \   00000078   0A00A0E1           MOV      R0,R10
   \   0000007C   0F0000EF           SWI      +15
   \   00000080   00B0A0E1           MOV      R11,R0
     26              fclose(f,&ul);
   \   00000084   04108DE2           ADD      R1,SP,#+4
   \   00000088   0A00A0E1           MOV      R0,R10
   \   0000008C   0D0000EF           SWI      +13
     27              if (rlen!=end || rlen!=len)  goto L_SAVENEWCFG;
   \   00000090   0B0059E1           CMP      R9,R11
   \   00000094   04D08DE2           ADD      SP,SP,#+4
   \   00000098   06005901           CMPEQ    R9,R6
   \   0000009C   0400001A           BNE      ??LoadConfigData_1
     28              memcpy(cfg,buf,len);
   \   000000A0   0620A0E1           MOV      R2,R6
   \   000000A4   0710A0E1           MOV      R1,R7
   \   000000A8   0500A0E1           MOV      R0,R5
   \   000000AC   1E0100EF           SWI      +286
   \   000000B0   130000EA           B        ??LoadConfigData_2
     29            }
     30            else
     31            {
     32            L_SAVENEWCFG:
     33              if ((f=fopen(fname,A_ReadWrite+A_Create+A_Truncate,P_READ+P_WRITE,&ul))!=-1)
   \                     ??LoadConfigData_1:
   \   000000B4   04009DE5           LDR      R0,[SP, #+4]
   \   000000B8   0D30A0E1           MOV      R3,SP
   \   000000BC   602FA0E3           MOV      R2,#+384
   \   000000C0   0210A0E3           MOV      R1,#+2
   \   000000C4   C01F81E3           ORR      R1,R1,#0x300
   \   000000C8   0A0000EF           SWI      +10
   \   000000CC   00A0A0E1           MOV      R10,R0
   \   000000D0   08005AE1           CMP      R10,R8
   \   000000D4   0900000A           BEQ      ??LoadConfigData_3
     34              {
     35                if (fwrite(f,cfg,len,&ul)!=len) result=-1;
   \   000000D8   0D30A0E1           MOV      R3,SP
   \   000000DC   0620A0E1           MOV      R2,R6
   \   000000E0   0510A0E1           MOV      R1,R5
   \   000000E4   0C0000EF           SWI      +12
   \   000000E8   060050E1           CMP      R0,R6
   \   000000EC   0840A011           MOVNE    R4,R8
     36                fclose(f,&ul);
   \   000000F0   0D10A0E1           MOV      R1,SP
   \   000000F4   0A00A0E1           MOV      R0,R10
   \   000000F8   0D0000EF           SWI      +13
   \   000000FC   000000EA           B        ??LoadConfigData_2
     37              }
     38              else
     39                result=-1;
   \                     ??LoadConfigData_3:
   \   00000100   0840A0E1           MOV      R4,R8
     40            }
     41            mfree(buf);
   \                     ??LoadConfigData_2:
   \   00000104   0700A0E1           MOV      R0,R7
   \   00000108   150000EF           SWI      +21
     42            if (result>=0) successed_config_filename=fname;
   \   0000010C   000054E3           CMP      R4,#+0
   \   00000110   14009F55           LDRPL    R0,??LoadConfigData_0+0x8  ;; successed_config_filename
   \   00000114   04109D55           LDRPL    R1,[SP, #+4]
   \   00000118   00108055           STRPL    R1,[R0, #+0]
     43            return(result);
   \   0000011C   0400A0E1           MOV      R0,R4
   \   00000120   F68FBDE8           POP      {R1,R2,R4-R11,PC}  ;; return
   \                     ??LoadConfigData_0:
   \   00000124   ........           DC32     SFB(CONFIG_C)
   \   00000128   ........           DC32     SFE(CONFIG_C)
   \   0000012C   ........           DC32     successed_config_filename
     44          }
     45          

   \                                 In segment CODE, align 4, keep-with-next
     46          void InitConfig()
     47          {
   \                     InitConfig:
   \   00000000   10402DE9           PUSH     {R4,LR}
     48            if (LoadConfigData("4:\\ZBin\\etc\\NRSS.bcfg")<0)
   \   00000004   18409FE5           LDR      R4,??InitConfig_0  ;; `?<Constant "0:\\\\ZBin\\\\etc\\\\NRSS.bcfg">`
   \   00000008   180084E2           ADD      R0,R4,#+24
   \   0000000C   ........           BL       LoadConfigData
   \   00000010   000050E3           CMP      R0,#+0
   \   00000014   1080BD58           POPPL    {R4,PC}
     49            {
     50              LoadConfigData("0:\\ZBin\\etc\\NRSS.bcfg");
   \   00000018   0400A0E1           MOV      R0,R4
   \   0000001C   ........           BL       LoadConfigData
     51            }
     52          }
   \   00000020   1080BDE8           POP      {R4,PC}          ;; return
   \                     ??InitConfig_0:
   \   00000024   ........           DC32     `?<Constant "0:\\\\ZBin\\\\etc\\\\NRSS.bcfg">`

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

   \                                 In segment CONFIG_C, align 1

   \                                 In segment DATA_C, align 1, align-sorted
   \                     `?<Constant "">`:
   \   00000000   00                 DC8 ""

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant "0:\\\\ZBin\\\\etc\\\\NRSS.bcfg">`:
   \   00000000   303A5C5A4269       DC8 "0:\\ZBin\\etc\\NRSS.bcfg"
   \              6E5C6574635C
   \              4E5253532E62
   \              63666700    
   \   00000016   0000               DC8 0, 0
   \   00000018   343A5C5A4269       DC8 "4:\\ZBin\\etc\\NRSS.bcfg"
   \              6E5C6574635C
   \              4E5253532E62
   \              63666700    
   \   0000002E   0000               DC8 0, 0

   Maximum stack usage in bytes:

     Function       CSTACK
     --------       ------
     InitConfig         8
     LoadConfigData    48


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     successed_config_filename         4
     LoadConfigData                  304
     InitConfig                       40
     ?<Initializer for successed_config_filename>
                                       4
     ?<Constant "">                    1
     ?<Constant "0:\\ZBin\\etc\\NRSS.bcfg">
                                      48
      Others                          20

 
 352 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
 
 344 bytes of CODE  memory (+ 20 bytes shared)
  53 bytes of CONST memory
   4 bytes of DATA  memory

Errors: none
Warnings: none
