##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    01/Apr/2008  10:15:34 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2ndconfig\conf_ #
#                       loader.c                                             #
#    Command line    =  D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2ndconfig\conf_ #
#                       loader.c -D NEWSGOLD -D BCFG --preprocess            #
#                       D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2ndconfig\NEWSG #
#                       OLD\List\ -lC D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2 #
#                       ndconfig\NEWSGOLD\List\ -o                           #
#                       D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2ndconfig\NEWSG #
#                       OLD\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_mod\2ndconfig\NEWSG #
#                       OLD\List\conf_loader.lst                             #
#    Object file     =  D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2ndconfig\NEWSG #
#                       OLD\Obj\conf_loader.r79                              #
#                                                                            #
#                                                                            #
##############################################################################

D:\Pasha\elf\_MY_PROJECT_\naticq_mod\2ndconfig\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          
      8          
      9          
     10          #pragma segment="CONFIG_C"

   \                                 In segment CODE, align 4, keep-with-next
     11          int SaveConfigData(const char *fname)
     12          {
     13            int f;
     14            unsigned int ul;
     15            int result=-1;
     16            unsigned int wlen;
     17            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
     18          
     19            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
     20            {
     21              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
     22              fclose(f,&ul);
   \   0000004C   0D10A0E1           MOV      R1,SP
   \   00000050   0700A0E1           MOV      R0,R7
   \   00000054   0D0000EF           SWI      +13
     23              if (wlen==len) result=0;
   \   00000058   060055E1           CMP      R5,R6
   \   0000005C   0040A003           MOVEQ    R4,#+0
     24            }
     25            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)
     26          }
     27          
     28          
     29          #pragma segment="CONFIG_C"

   \                                 In segment CODE, align 4, keep-with-next
     30          int LoadConfigData(const char *fname)
     31          {
   \                     LoadConfigData:
   \   00000000   F0472DE9           PUSH     {R4-R10,LR}
     32            int f;
     33            unsigned int ul;
     34            char *buf;
     35            int result=0;
     36            void *cfg;
     37            unsigned int rlen, end;
     38          
     39            extern const CFG_HDR cfghdr0; //first var in CONFIG
     40            cfg=(void*)&cfghdr0;
     41          
     42            unsigned int len=(int)__segment_end("CONFIG_C")-(int)__segment_begin("CONFIG_C");
   \   00000004   C8609FE5           LDR      R6,??LoadConfigData_0  ;; SFE(CONFIG_C) - SFB(CONFIG_C)
   \   00000008   04D04DE2           SUB      SP,SP,#+4
   \   0000000C   0040A0E1           MOV      R4,R0
   \   00000010   0050A0E3           MOV      R5,#+0
     43          
     44            if (!(buf=malloc(len))) return -1;
   \   00000014   0600A0E1           MOV      R0,R6
   \   00000018   140000EF           SWI      +20
   \   0000001C   0070B0E1           MOVS     R7,R0
   \   00000020   0500E001           MVNEQ    R0,R5
   \   00000024   F287BD08           POPEQ    {R1,R4-R10,PC}
     45            if ((f=fopen(fname,A_ReadOnly+A_BIN,P_READ,&ul))!=-1)
   \   00000028   0D30A0E1           MOV      R3,SP
   \   0000002C   8020A0E3           MOV      R2,#+128
   \   00000030   801CA0E3           MOV      R1,#+32768
   \   00000034   0400A0E1           MOV      R0,R4
   \   00000038   0A0000EF           SWI      +10
   \   0000003C   0080A0E1           MOV      R8,R0
   \   00000040   010078E3           CMN      R8,#+1
   \   00000044   1800000A           BEQ      ??LoadConfigData_1
     46            {
     47              rlen=fread(f,buf,len,&ul);
   \   00000048   0D30A0E1           MOV      R3,SP
   \   0000004C   0620A0E1           MOV      R2,R6
   \   00000050   0710A0E1           MOV      R1,R7
   \   00000054   0B0000EF           SWI      +11
   \   00000058   0090A0E1           MOV      R9,R0
     48              end=lseek(f,0,S_END,&ul,&ul);
   \   0000005C   0D00A0E1           MOV      R0,SP
   \   00000060   01002DE9           PUSH     {R0}
   \   00000064   04308DE2           ADD      R3,SP,#+4
   \   00000068   0220A0E3           MOV      R2,#+2
   \   0000006C   0010A0E3           MOV      R1,#+0
   \   00000070   0800A0E1           MOV      R0,R8
   \   00000074   0F0000EF           SWI      +15
   \   00000078   00A0A0E1           MOV      R10,R0
     49              fclose(f,&ul);
   \   0000007C   04108DE2           ADD      R1,SP,#+4
   \   00000080   0800A0E1           MOV      R0,R8
   \   00000084   0D0000EF           SWI      +13
     50              if (rlen!=end || rlen!=len)  goto L_SAVENEWCFG;
   \   00000088   0A0059E1           CMP      R9,R10
   \   0000008C   04D08DE2           ADD      SP,SP,#+4
   \   00000090   06005901           CMPEQ    R9,R6
   \   00000094   0400001A           BNE      ??LoadConfigData_1
     51              memcpy(cfg,buf,len);
   \   00000098   38009FE5           LDR      R0,??LoadConfigData_0+0x4  ;; cfghdr0
   \   0000009C   0620A0E1           MOV      R2,R6
   \   000000A0   0710A0E1           MOV      R1,R7
   \   000000A4   1E0100EF           SWI      +286
   \   000000A8   020000EA           B        ??LoadConfigData_2
     52            }
     53            else
     54            {
     55            L_SAVENEWCFG:
     56              result=SaveConfigData(fname);
   \                     ??LoadConfigData_1:
   \   000000AC   0400A0E1           MOV      R0,R4
   \   000000B0   ........           BL       SaveConfigData
   \   000000B4   0050A0E1           MOV      R5,R0
     57            }
     58            mfree(buf);
   \                     ??LoadConfigData_2:
   \   000000B8   0700A0E1           MOV      R0,R7
   \   000000BC   150000EF           SWI      +21
     59            if (result>=0) successed_config_filename=fname;
   \   000000C0   000055E3           CMP      R5,#+0
   \   000000C4   10009F55           LDRPL    R0,??LoadConfigData_0+0x8  ;; successed_config_filename
   \   000000C8   00408055           STRPL    R4,[R0, #+0]
     60            return(result);
   \   000000CC   0500A0E1           MOV      R0,R5
   \   000000D0   F287BDE8           POP      {R1,R4-R10,PC}   ;; return
   \                     ??LoadConfigData_0:
   \   000000D4   ........           DC32     SFE(CONFIG_C) - SFB(CONFIG_C)
   \   000000D8   ........           DC32     cfghdr0
   \   000000DC   ........           DC32     successed_config_filename
     61          }
     62          

   \                                 In segment CODE, align 4, keep-with-next
     63          void InitConfig()
     64          {
   \                     InitConfig:
   \   00000000   10402DE9           PUSH     {R4,LR}
     65            if (LoadConfigData("4:\\ZBin\\etc\\NATICQMod.bcfg")<0)
   \   00000004   18409FE5           LDR      R4,??InitConfig_0  ;; `?<Constant "0:\\\\ZBin\\\\etc\\\\NATICQMod...">`
   \   00000008   1C0084E2           ADD      R0,R4,#+28
   \   0000000C   ........           BL       LoadConfigData
   \   00000010   000050E3           CMP      R0,#+0
   \   00000014   1080BD58           POPPL    {R4,PC}
     66            {
     67              LoadConfigData("0:\\ZBin\\etc\\NATICQMod.bcfg");
   \   00000018   0400A0E1           MOV      R0,R4
   \   0000001C   ........           BL       LoadConfigData
     68            }
     69          
     70          }
   \   00000020   1080BDE8           POP      {R4,PC}          ;; return
   \                     ??InitConfig_0:
   \   00000024   ........           DC32     `?<Constant "0:\\\\ZBin\\\\etc\\\\NATICQMod...">`

   \                                 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\\\\NATICQMod...">`:
   \   00000000   303A5C5A4269       DC8 "0:\\ZBin\\etc\\NATICQMod.bcfg"
   \              6E5C6574635C
   \              4E4154494351
   \              4D6F642E6263
   \              666700      
   \   0000001B   00                 DC8 0
   \   0000001C   343A5C5A4269       DC8 "4:\\ZBin\\etc\\NATICQMod.bcfg"
   \              6E5C6574635C
   \              4E4154494351
   \              4D6F642E6263
   \              666700      
   \   00000037   00                 DC8 0
     71          

   Maximum stack usage in bytes:

     Function       CSTACK
     --------       ------
     InitConfig         8
     LoadConfigData    40
     SaveConfigData    24


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     successed_config_filename         4
     SaveConfigData                  112
     LoadConfigData                  224
     InitConfig                       40
     ?<Initializer for successed_config_filename>
                                       4
     ?<Constant "">                    1
     ?<Constant "0:\\ZBin\\etc\\NATICQMod...">
                                      56
      Others                          24

 
 388 bytes in segment CODE
  57 bytes in segment DATA_C
   4 bytes in segment DATA_I
   4 bytes in segment DATA_ID
  12 bytes in segment INITTAB
 
 376 bytes of CODE  memory (+ 24 bytes shared)
  61 bytes of CONST memory
   4 bytes of DATA  memory

Errors: none
Warnings: none
