/////////////////////////////////////////////////////////////////////////////// // / // IAR C/C++ Compiler V8.10.3.40338/W32 for 8051 28/Feb/2016 00:40:01 / // Copyright 2004-2011 IAR Systems AB. / // / // Core = plain / // Code model = near / // Data model = small / // Calling convention = idata reentrant / // Constant location = data / // Dptr setup = 1,16 / // Source file = E:\IAR_8051\Basti_test\main.c / // Command line = E:\IAR_8051\Basti_test\main.c -lC / // E:\IAR_8051\Basti_test\Debug\List\ -lA / // E:\IAR_8051\Basti_test\Debug\List\ -o / // E:\IAR_8051\Basti_test\Debug\Obj\ -e --no_unroll / // --no_inline --no_tbaa --debug --core=plain / // --dptr=16,1 --data_model=small --code_model=near / // --calling_convention=idata_reentrant / // --place_constants=data --nr_virtual_regs 8 -Om / // List file = E:\IAR_8051\Basti_test\Debug\List\main.s51 / // / // / /////////////////////////////////////////////////////////////////////////////// NAME main RTMODEL "__SystemLibrary", "CLib" RTMODEL "__calling_convention", "idata_reentrant" RTMODEL "__code_model", "near" RTMODEL "__core", "plain" RTMODEL "__data_model", "small" RTMODEL "__dptr_size", "16" RTMODEL "__extended_stack", "disabled" RTMODEL "__location_for_constants", "data" RTMODEL "__number_of_dptrs", "1" RTMODEL "__rt_version", "1" RSEG DOVERLAY:DATA:NOROOT(0) RSEG IOVERLAY:IDATA:NOROOT(0) RSEG ISTACK:IDATA:NOROOT(0) RSEG PSTACK:XDATA:NOROOT(0) RSEG XSTACK:XDATA:NOROOT(0) EXTERN ?V0 FUNCTION WriteAttrCB,0203H ARGFRAME ISTACK, 12, STACK ARGFRAME PSTACK, 0, STACK ARGFRAME XSTACK, 0, STACK ARGFRAME IOVERLAY, 0, STATIC ARGFRAME DOVERLAY, 0, STATIC LOCFRAME ISTACK, 3, STACK PUBLIC main FUNCTION main,021a03H ARGFRAME ISTACK, 0, STACK LOCFRAME ISTACK, 12, STACK CFI Names cfiNames0 CFI StackFrame CFA_SP SP IDATA CFI StackFrame CFA_PSP16 PSP16 XDATA CFI StackFrame CFA_XSP16 XSP16 XDATA CFI StaticOverlayFrame CFA_IOVERLAY IOVERLAY CFI StaticOverlayFrame CFA_DOVERLAY DOVERLAY CFI Resource `PSW.CY`:1, `B.BR0`:1, `B.BR1`:1, `B.BR2`:1, `B.BR3`:1 CFI Resource `B.BR4`:1, `B.BR5`:1, `B.BR6`:1, `B.BR7`:1, `VB.BR8`:1 CFI Resource `VB.BR9`:1, `VB.BR10`:1, `VB.BR11`:1, `VB.BR12`:1 CFI Resource `VB.BR13`:1, `VB.BR14`:1, `VB.BR15`:1, VB:8, B:8, A:8 CFI Resource PSW:8, DPL0:8, DPH0:8, R0:8, R1:8, R2:8, R3:8, R4:8, R5:8 CFI Resource R6:8, R7:8, V0:8, V1:8, V2:8, V3:8, V4:8, V5:8, V6:8, V7:8 CFI Resource SP:8, PSPH:8, PSPL:8, PSP16:16, XSPH:8, XSPL:8, XSP16:16 CFI VirtualResource ?RET:16, ?RET_HIGH:8, ?RET_LOW:8 CFI ResourceParts PSP16 PSPH, PSPL CFI ResourceParts XSP16 XSPH, XSPL CFI ResourceParts ?RET ?RET_HIGH, ?RET_LOW CFI EndNames cfiNames0 CFI Common cfiCommon0 Using cfiNames0 CFI CodeAlign 1 CFI DataAlign -1 CFI ReturnAddress ?RET CODE CFI CFA_DOVERLAY Used CFI CFA_IOVERLAY Used CFI CFA_SP SP+-2 CFI CFA_PSP16 PSP16+0 CFI CFA_XSP16 XSP16+0 CFI `PSW.CY` SameValue CFI `B.BR0` SameValue CFI `B.BR1` SameValue CFI `B.BR2` SameValue CFI `B.BR3` SameValue CFI `B.BR4` SameValue CFI `B.BR5` SameValue CFI `B.BR6` SameValue CFI `B.BR7` SameValue CFI `VB.BR8` SameValue CFI `VB.BR9` SameValue CFI `VB.BR10` SameValue CFI `VB.BR11` SameValue CFI `VB.BR12` SameValue CFI `VB.BR13` SameValue CFI `VB.BR14` SameValue CFI `VB.BR15` SameValue CFI VB SameValue CFI B Undefined CFI A Undefined CFI PSW SameValue CFI DPL0 Undefined CFI DPH0 Undefined CFI R0 Undefined CFI R1 Undefined CFI R2 Undefined CFI R3 Undefined CFI R4 Undefined CFI R5 Undefined CFI R6 SameValue CFI R7 SameValue CFI V0 SameValue CFI V1 SameValue CFI V2 SameValue CFI V3 SameValue CFI V4 SameValue CFI V5 SameValue CFI V6 SameValue CFI V7 SameValue CFI PSPH Undefined CFI PSPL Undefined CFI XSPH Undefined CFI XSPL Undefined CFI ?RET Concat CFI ?RET_HIGH Frame(CFA_SP, 2) CFI ?RET_LOW Frame(CFA_SP, 1) CFI EndCommon cfiCommon0 // E:\IAR_8051\Basti_test\main.c // 1 typedef signed char int8; //!< Signed 8 bit integer // 2 typedef unsigned char uint8; //!< Unsigned 8 bit integer // 3 // 4 typedef signed short int16; //!< Signed 16 bit integer // 5 typedef unsigned short uint16; //!< Unsigned 16 bit integer // 6 // 7 typedef signed long int32; //!< Signed 32 bit integer // 8 typedef unsigned long uint32; //!< Unsigned 32 bit integer // 9 // 10 typedef unsigned char bool; //!< Boolean data type // 11 // 12 typedef uint8 halDataAlign_t; //!< Used for byte alignment // 13 // 14 typedef uint8 bStatus_t; // 15 // 16 /** // 17 * GATT Attribute Type format. // 18 */ // 19 typedef struct // 20 { // 21 uint8 len; //!< Length of UUID // 22 const uint8 *uuid; //!< Pointer to UUID // 23 } gattAttrType_t; // 24 // 25 /** // 26 * GATT Attribute format. // 27 */ // 28 typedef struct attAttribute_t // 29 { // 30 gattAttrType_t type; //!< Attribute type (2 or 16 octet UUIDs) // 31 uint8 permissions; //!< Attribute permissions // 32 uint16 handle; //!< Attribute handle - assigned internally by attribute server // 33 uint8* const pValue; //!< Attribute value - encoding of the octet array is defined in // 34 //!< the applicable profile. The maximum length of an attribute // 35 //!< value shall be 512 octets. // 36 } gattAttribute_t; // 37 RSEG NEAR_CODE:CODE:NOROOT(0) // 38 static bStatus_t WriteAttrCB( uint16 connHandle, gattAttribute_t *pAttr, WriteAttrCB: CFI Block cfiBlock0 Using cfiCommon0 CFI Function WriteAttrCB CODE // 39 uint8 *pValue, uint8 len, uint16 offset, // 40 uint8 method ) // 41 { MOV A,R6 CFI R6 A PUSH A CFI R6 Frame(CFA_SP, 3) CFI CFA_SP SP+-3 MOV A,R7 CFI R7 A PUSH A CFI R7 Frame(CFA_SP, 4) CFI CFA_SP SP+-4 PUSH ?V0 + 0 CFI V0 Frame(CFA_SP, 5) CFI CFA_SP SP+-5 ; Saved register size: 3 ; Auto size: 0 MOV A,R1 MOV R6,A MOV A,SP ADD A,#-0x6 MOV R0,A MOV A,@R0 MOV R2,A INC R0 MOV A,@R0 MOV R3,A // 42 bStatus_t status = 0x00; MOV R7,#0x0 // 43 uint8 notifyApp = 0xFF; MOV ?V0 + 0,#-0x1 // 44 // 45 // 46 if ( ( (pAttr->permissions) & 0x20 ) ) MOV A,#0x2 ADD A,R6 MOV R0,A MOV A,@R0 MOV C,0xE0 /* A */.5 JNC ??WriteAttrCB_0 // 47 { // 48 return ( 0x08 ); MOV R1,#0x8 SJMP ??WriteAttrCB_1 // 49 } // 50 // 51 if ( pAttr->type.len == 2 ) ??WriteAttrCB_0: DEC R0 DEC R0 MOV A,@R0 XRL A,#0x2 JNZ ??WriteAttrCB_2 // 52 { // 53 // 54 uint16 uuid = ((uint16)(((pAttr->type . uuid[0]) & 0x00FF) + (((pAttr->type . uuid[1]) & 0x00FF) << 8))); // 55 // 56 // 57 if (offset!=0) MOV A,R2 ORL A,R3 JZ ??WriteAttrCB_3 // 58 { // 59 return 0x0b; MOV R1,#0xb SJMP ??WriteAttrCB_1 // 60 } // 61 switch ( uuid ) ??WriteAttrCB_3: INC R1 INC R0 MOV A,@R0 MOV R0,A MOV A,@R0 MOV R2,A MOV A,R1 MOV R0,A MOV A,@R0 INC A MOV R0,A MOV A,@R0 MOV R1,A MOV A,R2 MOV R0,A MOV A,#-0xc XRL A,R0 JNZ ??WriteAttrCB_4 MOV A,#-0x1 XRL A,R1 ??WriteAttrCB_4: JNZ ??WriteAttrCB_5 // 62 { // 63 case 0xFFF4: // 64 if ( len != 1 ) MOV A,#0x1 XRL A,R5 JZ ??WriteAttrCB_6 // 65 { // 66 status = 0x0d; MOV R7,#0xd SJMP ??WriteAttrCB_7 // 67 } // 68 else // 69 { // 70 uint8 tx_value = *(uint8*)pValue; // 71 if( tx_value <= 0x02 ) { ??WriteAttrCB_6: MOV A,R4 MOV R0,A MOV A,@R0 CLR C SUBB A,#0x3 JNC ??WriteAttrCB_8 // 72 notifyApp = 3; MOV ?V0 + 0,#0x3 SJMP ??WriteAttrCB_7 // 73 } // 74 else // 75 { // 76 status = 0x80; ??WriteAttrCB_8: MOV R7,#-0x80 SJMP ??WriteAttrCB_7 // 77 } // 78 } // 79 break; // 80 // 81 default: // 82 status = 0x0a; ??WriteAttrCB_5: MOV R7,#0xa // 83 break; SJMP ??WriteAttrCB_7 // 84 } // 85 } // 86 else // 87 { // 88 // 89 status = 0x01; ??WriteAttrCB_2: INC R7 // 90 } // 91 // 92 if ( (notifyApp != 0xFF )) ??WriteAttrCB_7: MOV A,#-0x1 XRL A,?V0 + 0 JZ ??WriteAttrCB_9 // 93 { // 94 return 1; MOV R1,#0x1 SJMP ??WriteAttrCB_1 // 95 } // 96 return ( status ); ??WriteAttrCB_9: MOV A,R7 MOV R1,A ??WriteAttrCB_1: POP ?V0 + 0 CFI V0 SameValue CFI CFA_SP SP+-4 POP A CFI R7 A CFI CFA_SP SP+-3 MOV R7,A CFI R7 SameValue POP A CFI R6 A CFI CFA_SP SP+-2 MOV R6,A CFI R6 SameValue RET CFI EndBlock cfiBlock0 // 97 } // 98 RSEG NEAR_CODE:CODE:NOROOT(0) // 99 int main(void) main: CFI Block cfiBlock1 Using cfiCommon0 CFI Function main CODE // 100 { FUNCALL main, WriteAttrCB LOCFRAME ISTACK, 12, STACK LOCFRAME PSTACK, 0, STACK LOCFRAME XSTACK, 0, STACK LOCFRAME IOVERLAY, 0, STATIC LOCFRAME DOVERLAY, 0, STATIC ARGFRAME ISTACK, 12, STACK ARGFRAME PSTACK, 0, STACK ARGFRAME XSTACK, 0, STACK ARGFRAME IOVERLAY, 0, STATIC ARGFRAME DOVERLAY, 0, STATIC ; Auto size: 9 MOV A,SP ADD A,#0x9 MOV SP,A CFI CFA_SP SP+-11 // 101 uint16 uuid = 0xFFF1; ADD A,#-0x2 MOV R0,A MOV @R0,#-0xf INC R0 MOV @R0,#-0x1 // 102 volatile gattAttribute_t att; // 103 att.type.len = 2; ADD A,#-0x6 MOV R0,A MOV @R0,#0x2 // 104 att.type.uuid = (const uint8*)&uuid; ADD A,#0x6 INC R0 MOV @R0,A // 105 att.permissions = 0; INC R0 MOV @R0,#0x0 // 106 att.handle = 0; INC R0 MOV @R0,#0x0 INC R0 MOV @R0,#0x0 // 107 // 108 volatile uint8 value = 2; MOV R0,SP MOV @R0,#0x2 // 109 uint8 len = 1; // 110 uint16 offset = 0; // 111 uint8 method = 0; // 112 // 113 // 114 value ++; INC @R0 // 115 // 116 while(1) { // 117 WriteAttrCB( 0, (gattAttribute_t*)&att, (uint8*)&value, len, offset, method ); ??main_0: ; Setup parameters for call to function WriteAttrCB CLR A PUSH A CFI CFA_SP SP+-12 PUSH A CFI CFA_SP SP+-13 PUSH A CFI CFA_SP SP+-14 MOV R5,#0x1 MOV A,SP ADD A,#-0x3 MOV R4,A ADD A,#-0x8 MOV R1,A MOV R2,#0x0 MOV R3,#0x0 LCALL WriteAttrCB DEC SP CFI CFA_SP SP+-13 DEC SP CFI CFA_SP SP+-12 DEC SP CFI CFA_SP SP+-11 // 118 uuid++; MOV A,SP ADD A,#-0x2 MOV R0,A MOV A,@R0 ADD A,#0x1 MOV @R0,A INC R0 MOV A,@R0 ADDC A,#0x0 MOV @R0,A SJMP ??main_0 CFI EndBlock cfiBlock1 // 119 } // 120 // 121 return 0; // 122 } END // // 213 bytes in segment NEAR_CODE // // 213 bytes of CODE memory // //Errors: none //Warnings: 2