在使用协议栈的时候,编译程序总是报这个错,今天决定写一篇这个错误记录:
第一个错误:
Error[e16]: Segment ISTACK (size: 0xc0 align: 0) is too long for segment definition. At least 0x9 more bytes needed. The problem occurred while processing the segment placement command
版本原因,只需要 Project -> Options -> General Option -> Target,在Target标签中找到“Number of virtual”,原来默认为16,修改为8
第二个错误
Error[e46]: Undefined external "?V1" referred in AF
该错误是老版本代码在新版本的IAR上运行出现的,只需要替换掉原来的ZStack-CC2530-2.5.1aProjectszstackZMainTI2530DB下的chipcon_cstartup.s51文件即可
鉴于很多文章介绍都是在CSDN上下载,其实在官网上也可以下载,然后按照下面步骤来即可
百度网盘下载
链接:https://pan.baidu.com/s/1zOm1BOK56JDwoHMC6ZOFSw
提取码:82qe
首先替换原文件,然后将下列代码(在下载的文件当中也有)插入到该文件末尾,记得删除掉原文件末尾的END
/*******************************************************************************
*
* Workaround for missing ?V1,?V2,... when linking. This is normally caused
* by using an older version of cstartup (pre 8.30) in your project.
*
* Add this file to your project.
*
* Copyright 2013 IAR Systems. All rights reserved.
*
******************************************************************************/
;----------------------------------------------------------------;
; 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