##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.41A/W32 EVALUATION    09/Dec/2007  21:14:58 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\Pasha\elf\googlecode\SieTextView\conf_loader.c    #
#    Command line    =  D:\Pasha\elf\googlecode\SieTextView\conf_loader.c    #
#                       -D NEWSGOLD -D ELKA -lC D:\Pasha\elf\googlecode\SieT #
#                       extView\Release\List\ -lA                            #
#                       D:\Pasha\elf\googlecode\SieTextView\Release\List\    #
#                       -o D:\Pasha\elf\googlecode\SieTextView\Release\Obj\  #
#                       -s9 --no_unroll --cpu_mode arm --endian little       #
#                       --cpu ARM926EJ-S --stack_align 4 --interwork -e      #
#                       --fpu None -I "D:\Pasha\ARM_Embedded_Workbench\Embed #
#                       ded Workbench 4.0 Evaluation\ARM\INC\"               #
#                       --inline_threshold=2                                 #
#    List file       =  D:\Pasha\elf\googlecode\SieTextView\Release\List\con #
#                       f_loader.lst                                         #
#    Object file     =  D:\Pasha\elf\googlecode\SieTextView\Release\Obj\conf #
#                       _loader.r79                                          #
#                                                                            #
#                                                                            #
##############################################################################

D:\Pasha\elf\googlecode\SieTextView\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 LoadConfigData(const char *fname) {
   \                     LoadConfigData:
   \   00000000   F0472DE9           PUSH     {R4-R10,LR}
      7            int f;
      8            unsigned int ul;
      9            char *buf;
     10            int result = 0;
     11            void *cfg;
     12          
     13            extern const CFG_HDR cfghdr0; //first var in CONFIG
     14            cfg = (void*) &cfghdr0;
     15          
     16            unsigned int len = (int)__segment_end("CONFIG_C")-(int)__segment_begin("CONFIG_C");
   \   00000004   E0609FE5           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
     17          
     18            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}
     19            if ((f = fopen(fname, A_ReadOnly + A_BIN, 0, &ul)) != -1) {
   \   00000028   C0909FE5           LDR      R9,??LoadConfigData_0+0x4  ;; cfghdr0
   \   0000002C   0D30A0E1           MOV      R3,SP
   \   00000030   0020A0E3           MOV      R2,#+0
   \   00000034   801CA0E3           MOV      R1,#+32768
   \   00000038   0400A0E1           MOV      R0,R4
   \   0000003C   0A0000EF           SWI      +10
   \   00000040   0080A0E1           MOV      R8,R0
   \   00000044   05A0E0E1           MVN      R10,R5
   \   00000048   0A0058E1           CMP      R8,R10
   \   0000004C   1000000A           BEQ      ??LoadConfigData_1
     20              if (fread(f, buf, len, &ul) == len) {
   \   00000050   0D30A0E1           MOV      R3,SP
   \   00000054   0620A0E1           MOV      R2,R6
   \   00000058   0710A0E1           MOV      R1,R7
   \   0000005C   0B0000EF           SWI      +11
   \   00000060   060050E1           CMP      R0,R6
   \   00000064   0700001A           BNE      ??LoadConfigData_2
     21                memcpy(cfg, buf, len);
   \   00000068   0620A0E1           MOV      R2,R6
   \   0000006C   0710A0E1           MOV      R1,R7
   \   00000070   0900A0E1           MOV      R0,R9
   \   00000074   1E0100EF           SWI      +286
     22                fclose(f, &ul);
   \                     ??LoadConfigData_3:
   \   00000078   0D10A0E1           MOV      R1,SP
   \   0000007C   0800A0E1           MOV      R0,R8
   \   00000080   0D0000EF           SWI      +13
   \   00000084   140000EA           B        ??LoadConfigData_4
     23              }
     24              else {
     25                fclose(f, &ul);
   \                     ??LoadConfigData_2:
   \   00000088   0D10A0E1           MOV      R1,SP
   \   0000008C   0800A0E1           MOV      R0,R8
   \   00000090   0D0000EF           SWI      +13
     26                goto L_SAVENEWCFG;
     27              }
     28            }
     29            else {
     30            L_SAVENEWCFG:
     31              if ((f = fopen(fname, A_ReadWrite + A_Create + A_Truncate, P_READ + P_WRITE, &ul)) != -1) {
   \                     ??LoadConfigData_1:
   \   00000094   0D30A0E1           MOV      R3,SP
   \   00000098   602FA0E3           MOV      R2,#+384
   \   0000009C   0210A0E3           MOV      R1,#+2
   \   000000A0   C01F81E3           ORR      R1,R1,#0x300
   \   000000A4   0400A0E1           MOV      R0,R4
   \   000000A8   0A0000EF           SWI      +10
   \   000000AC   0080A0E1           MOV      R8,R0
   \   000000B0   0A0058E1           CMP      R8,R10
   \   000000B4   0700000A           BEQ      ??LoadConfigData_5
     32                if (fwrite(f, cfg, len, &ul) != len) result = -1;
   \   000000B8   0D30A0E1           MOV      R3,SP
   \   000000BC   0620A0E1           MOV      R2,R6
   \   000000C0   0910A0E1           MOV      R1,R9
   \   000000C4   0C0000EF           SWI      +12
   \   000000C8   060050E1           CMP      R0,R6
   \   000000CC   E9FFFF0A           BEQ      ??LoadConfigData_3
   \   000000D0   0A50A0E1           MOV      R5,R10
     33                fclose(f,&ul);
   \   000000D4   E7FFFFEA           B        ??LoadConfigData_3
     34              }
     35              else
     36                result=-1;
   \                     ??LoadConfigData_5:
   \   000000D8   0A50A0E1           MOV      R5,R10
     37            }
     38            mfree(buf);
   \                     ??LoadConfigData_4:
   \   000000DC   0700A0E1           MOV      R0,R7
   \   000000E0   150000EF           SWI      +21
     39            return(result);
   \   000000E4   0500A0E1           MOV      R0,R5
   \   000000E8   F287BDE8           POP      {R1,R4-R10,PC}   ;; return
   \                     ??LoadConfigData_0:
   \   000000EC   ........           DC32     SFE(CONFIG_C) - SFB(CONFIG_C)
   \   000000F0   ........           DC32     cfghdr0
     40          }
     41          

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

   \                                 In segment CONFIG_C, align 1

   \                                 In segment DATA_C, align 4, align-sorted
   \                     `?<Constant "0:\\\\ZBin\\\\etc\\\\SieTxtVie...">`:
   \   00000000   303A5C5A4269       DC8 "0:\\ZBin\\etc\\SieTxtView.bcfg"
   \              6E5C6574635C
   \              536965547874
   \              566965772E62
   \              63666700    
   \   0000001C   343A5C5A4269       DC8 "4:\\ZBin\\etc\\SieTxtView.bcfg"
   \              6E5C6574635C
   \              536965547874
   \              566965772E62
   \              63666700    

   Maximum stack usage in bytes:

     Function       CSTACK
     --------       ------
     InitConfig         8
     LoadConfigData    36


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     LoadConfigData                  244
     InitConfig                       40
     ?<Constant "0:\\ZBin\\etc\\SieTxtVie...">
                                      56
      Others                           8

 
 292 bytes in segment CODE
  56 bytes in segment DATA_C
 
 284 bytes of CODE  memory (+ 8 bytes shared)
  56 bytes of CONST memory

Errors: none
Warnings: none
