##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    06/Jul/2010  10:16:47 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  F:\SVN\cn\TIIGPRSLogo\conf_loader.c                  #
#    Command line    =  F:\SVN\cn\TIIGPRSLogo\conf_loader.c -D NEWSGOLD -lC  #
#                       F:\SVN\cn\TIIGPRSLogo\S7Cv47\List\ -o                #
#                       F:\SVN\cn\TIIGPRSLogo\S7Cv47\Obj\ -s9 --no_unroll    #
#                       --cpu_mode arm --endian little --cpu ARM926EJ-S      #
#                       --stack_align 4 --interwork -e --fpu None -I         #
#                       "F:\software\Embedded Workbench 4.0                  #
#                       Evaluation\ARM\INC\" --inline_threshold=2            #
#    List file       =  F:\SVN\cn\TIIGPRSLogo\S7Cv47\List\conf_loader.lst    #
#    Object file     =  F:\SVN\cn\TIIGPRSLogo\S7Cv47\Obj\conf_loader.r79     #
#                                                                            #
#                                                                            #
##############################################################################

F:\SVN\cn\TIIGPRSLogo\conf_loader.c
      1          #include "..\inc\swilib.h"
      2          #include "..\inc\cfg_items.h"
      3          #include "conf_loader.h"
      4          
      5          #pragma segment="CONFIG_DATA_ID"
      6          #pragma segment="CONFIG_DATA_I"

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

   \                                 In segment CODE, align 4, keep-with-next
     42          int InitConfig(void)
     43          {
   \                     InitConfig:
   \   00000000   10402DE9           PUSH     {R4,LR}
     44            if (LoadConfigData("4:\\ZBin\\etc\\TIIGPRSLogo.bcfg")<0)
   \   00000004   28409FE5           LDR      R4,??InitConfig_0  ;; `?<Constant "0:\\\\ZBin\\\\etc\\\\TIIGPRSLo...">`
   \   00000008   200084E2           ADD      R0,R4,#+32
   \   0000000C   ........           BL       LoadConfigData
   \   00000010   000050E3           CMP      R0,#+0
   \   00000014   0400005A           BPL      ??InitConfig_1
     45            {
     46              if (LoadConfigData("0:\\ZBin\\etc\\TIIGPRSLogo.bcfg")<0)
   \   00000018   0400A0E1           MOV      R0,R4
   \   0000001C   ........           BL       LoadConfigData
   \   00000020   000050E3           CMP      R0,#+0
     47              	return -1;
   \   00000024   0000E043           MVNMI    R0,#+0
   \   00000028   1080BD48           POPMI    {R4,PC}
     48            }
     49            return 1;
   \                     ??InitConfig_1:
   \   0000002C   0100A0E3           MOV      R0,#+1
   \   00000030   1080BDE8           POP      {R4,PC}          ;; return
   \                     ??InitConfig_0:
   \   00000034   ........           DC32     `?<Constant "0:\\\\ZBin\\\\etc\\\\TIIGPRSLo...">`
     50          }

   \                                 In segment CONFIG_DATA_I, align 1

   \                                 In segment CONFIG_DATA_ID, align 1

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant "0:\\\\ZBin\\\\etc\\\\TIIGPRSLo...">`:
   \   00000000   303A5C5A4269       DC8 "0:\\ZBin\\etc\\TIIGPRSLogo.bcfg"
   \              6E5C6574635C
   \              544949475052
   \              534C6F676F2E
   \              6263666700  
   \   0000001D   000000             DC8 0, 0, 0
   \   00000020   343A5C5A4269       DC8 "4:\\ZBin\\etc\\TIIGPRSLogo.bcfg"
   \              6E5C6574635C
   \              544949475052
   \              534C6F676F2E
   \              6263666700  
   \   0000003D   000000             DC8 0, 0, 0

   Maximum stack usage in bytes:

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


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     LoadConfigData                  264
     InitConfig                       56
     ?<Constant "0:\\ZBin\\etc\\TIIGPRSLo...">
                                      64
      Others                           8

 
 328 bytes in segment CODE
  64 bytes in segment DATA_C
 
 320 bytes of CODE  memory (+ 8 bytes shared)
  64 bytes of CONST memory

Errors: none
Warnings: none
