IAR编译zigbee出现问题Undefined external V1 referred in AF

升级IAR 之后,打开旧工程,编译的时候会出现两个错误:

Error[e46]: Undefined external "?V1" referred in AF ( C:\Texas Instruments\Z-Stack Lighting 1.0.2\Projects\zstack\ZLL\SampleApp\CC253x\RouterEB-Pro\
Obj\AF.r51 )

解决问题如下:
原来这个是IAR版本的问题引起的,参考这个 http://supp.iar.com/Support/?Note=98110
按照参考里面说的解决方法,将workaround.s51 文件加到工程里(我是加到了C:\Texas Instruments\Z-Stack Lighting 1.0.2\Projects\zstack\ZMain\TI2530DB目录下,注意要在工程里该目录右击“add file … ”),然后再次rebuild后,原来的问题没有了,但是出现了第二个问题,

“Error[e16]: Segment ISTACK (size: 0xc0 align: 0) is too long for segment definition. At least 0xe more bytes needed. The problem occurred while processing the segment placement command
"-Z(IDATA)ISTACK+_IDATA_STACK_SIZE#08-_IDATA0_END", where at the moment of placement the available memory ranges were "IDATA:4e-ff" ”

于是又查到 http://e2e.ti.com/support/low_power_rf/f/538/p/303921/1061753.aspx
根据以上列出的这个帖子里面的 Luis Johnson (就是贴出了一大个图的那个)给出的解决方法,将numbers of virtual registers 由16 改为8个,再次rebuild,就OK了,没有报错。

workaround.s51文件内容如下:

;----------------------------------------------------------------;
; Virtual registers                                              ;
; =================                                              ;
; Below is some segment needed for the IAR ICC C/EC++ compiler   ;
;                                                                ;
; BREG  : A segment for 8 bit registers for use by the compiler. ;
;         ?B0 is the first register.                             ;
; VREG  : Segment that holds up to 32 virtual registers for      ;
;         use by the compiler. ?V0 is the first register.        ;
; PSP   : Segment containing the PDATA stack pointer (?PSP)      ;
; XSP   : Segment containing the XDATA stack pointer (?XSP)      ;
;                                                                ;
;----------------------------------------------------------------;
;----------------------------------------------------------------;

        PROGRAM VIRTUAL_REGISTERS
        PUBLIC  ?B0
        PUBLIC  ?V0
        PUBLIC  ?V1
        PUBLIC  ?V2
        PUBLIC  ?V3
        PUBLIC  ?V4
        PUBLIC  ?V5
        PUBLIC  ?V6
        PUBLIC  ?V7
        PUBLIC  ?V8
        PUBLIC  ?V9
        PUBLIC  ?V10
        PUBLIC  ?V11
        PUBLIC  ?V12
        PUBLIC  ?V13
        PUBLIC  ?V14
        PUBLIC  ?V15
        PUBLIC  ?V16
        PUBLIC  ?V17
        PUBLIC  ?V18
        PUBLIC  ?V19
        PUBLIC  ?V20
        PUBLIC  ?V21
        PUBLIC  ?V22
        PUBLIC  ?V23
        PUBLIC  ?V24
        PUBLIC  ?V25
        PUBLIC  ?V26
        PUBLIC  ?V27
        PUBLIC  ?V28
        PUBLIC  ?V29
        PUBLIC  ?V30
        PUBLIC  ?V31
        PUBLIC  ?PSP
        PUBLIC  ?XSP
        RSEG    BREG:BIT:NOROOT
?B0:
        DS      8

        RSEG    VREG:DATA:NOROOT
?V0:
        DS      1
?V1:
        DS      1
?V2:
        DS      1
?V3:
        DS      1
?V4:
        DS      1
?V5:
        DS      1
?V6:
        DS      1
?V7:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V7
?V8:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V8
?V9:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V9
?V10:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V10
?V11:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V11
?V12:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V12
?V13:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V13
?V14:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V14
?V15:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V15
?V16:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V16
?V17:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V17
?V18:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V18
?V19:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V19
?V20:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V20
?V21:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V21
?V22:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V22
?V23:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V23
?V24:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V24
?V25:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V25
?V26:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V26
?V27:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V27
?V28:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V28
?V29:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V29
?V30:
        DS      1

        RSEG    VREG:DATA:NOROOT
        REQUIRE ?V30
?V31:
        DS      1

        RSEG    PSP:DATA:NOROOT
        EXTERN  ?RESET_PSP
        REQUIRE ?RESET_PSP
?PSP:
        DS      1

        RSEG    XSP:DATA:NOROOT
        EXTERN  ?RESET_XSP
        REQUIRE ?RESET_XSP
?XSP:
        DS      2

        ENDMOD ; VIRTUAL_REGISTERS

        END

第二个问题如下:

Error[e16]: Segment ISTACK (size: 0xc0 align: 0) is too long for segment definition. At least 0xe more bytes needed. The problem occurred while processing the segment placement command

"-Z(IDATA)ISTACK+_IDATA_STACK_SIZE#08-_IDATA_END", where at the moment of placement the available memory ranges were "IDATA:4e-ff"

Reserved ranges relevant to this placement:

IDATA:8-1f VREG

IDATA:21-40 VREG

IDATA:41-42 XSP

IDATA:43-43 DATA_I

IDATA:44-4b DATA_Z

IDATA:4c-4d IDATA_Z

IDATA:4e-ff ISTACK

BIT:0-7 BREG

BIT:80-97 SFR_AN

BIT:a0-af SFR_AN

BIT:b8-c7 SFR_AN

Error while running Linker

Total number of errors: 1

Total number of warnings: 0

解决方法:

把下图中的Number of Virtual改成8即可