搜索
bottom↓
回复: 11

iccavr 老问题 'text' area size too large (>64K bytes). 三年了都没解

[复制链接]

出0入0汤圆

发表于 2011-9-6 11:19:16 | 显示全部楼层 |阅读模式
几年前发过类似的帖子http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=3322784
这个问题 相信大家在编M128的大程序的时候肯定遇到过,一般人的解决办法就是包括我 是精简程序或换芯片,现在实在忍无可忍 行还是不行希望大侠能给个答案 希望本贴能成为终结帖

@错误:!E main.s(50051): 'text' area size too large (>64K bytes). Please move some code to another file

官方解释:在 ICC 的未注_册版本中,往往存在单个.c 文件允许编译代码的最大限制。这就 是著名的64K 代码限制。按照系统的提示,将一个.c 文件中的部分代码转移到别的.c 文件 中,有时候能够解决问题。 解决方法: 解决方法:购买正版 ICC。或者尝试将一个.c 文件中的部分代码转移到另外一个.c 文件

本人说明:text 其实就是子程序占用的空间 不包括常量表的空间,首先这句话就矛盾,说程序空间大于64K字节,这不是废话 我用的是atmega128当然要大于64K  即使程序空间只能小于64K成立 事实上我程序空间是在75K字节的时候报错,并不是在64K的时候报错,转移代码到另外文件,不知道转移过去有什么好处,逻辑上讲不通 单片机的HEX文件只有一个,flash也只有一个,程序指针也只有一个。 哪怕一千个文件 到最后还是汇集到一同一个文件。事实上分割的方法确实不行  官方也说了 是有时候可以 如果哪位试验成功 求分文件的方法。还有据说勾上长跳转就能解决问题,不管你信不信反正我是勾了但是没用

芯片:atmega128
编译:iccavr 7.22 professional 破_解版 (注 此版本是没有所谓的长跳转的勾,就是说软件是默认长跳转)
症状1:如果使用iccavr 6.3 并打上长跳转的勾 flash到76%就报错 使用iccavr 7.22 大概到78%就报错
症状2:只要删除任何一句语句 哪怕是 _nop();问题都能解决,删再多的const数组常量,问题不能解决,且在正常情况下增加const常量个数flah可以到99%    不报错,说明iccavr 程序flash和常量falsh是分开的

症状3:按照官方的做法 将源代码分开放到几个C文件中,3年前就试验了。不管是分成几个,不管分成.c .h 还是extern 都以失败告终,有个规律只要.map文件中的text大于某个值 就会报错,你不管怎么分 归根结底 都是占用text的空间
症状4:按照常理 常量也是存在flash中 但是如果常量过大 比如const char u[600000] 报错
!E main.s(16928): 'lit' area size too large(>64K bytes) 只是说常量区过大 并没说是flash过大


以下是编译通过的map文件(程序中加一行_nop就编译不通过 RAM使用约 2035/4096=49%  )

NOTE: AVR Code addresses are word addresses
All other addresses (including ones in FLASH) are byte addresses

Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                        func_lit   008C   010E =    270. bytes (rel,con,rom)

       Addr  Global Symbol
      -----  --------------------------------
       008C  __func_lit_start
       019A  __func_lit_end

Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                             lit   019A   6A5C =  27228. bytes (rel,con,rom)

       Addr  Global Symbol
      -----  --------------------------------
       019A  __lit_start
       019A  _STR1
       06AE  _SHUXIN
       0DCE  _ZhongLie
       0E76  _ERROR
       13A3  _TEXT_INDEX
       1579  _TEXT_YaGan
       15E5  _TEXT_CeLia
       1728  _TEXT_CGQSY
       1802  _TEXT_GyCSS
       187F  _TEXT_TuiWe
       18F2  _TEXT_GUIDE
       194B  _TEXT_BTiao
       1A0C  _TEXT_SYSTM
       1B45  _TEXT_FileG
       1C7E  _ZIMU
       1CB3  _FuHao
       1CBF  _CY
       1D30  _jingwei
       1D62  _Tuiwei
       1D94  _ZhuanMian
       1DC6  _HangBai
       1DF8  _TingLiuSJ
       1E11  _HangMianCongFu
       1E2A  _PaoGuangBuChang
       1E43  _Liju_test
       1E5C  _T_table
       1EA4  _Speed_table
       20A4  _Speed_table2
       260C  _GB_16
       6456  _ASC_MSK
       6A88  __ctype
       6BF6  __lit_end

Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                           idata   6BF6   04E2 =   1250. bytes (rel,con,rom)

       Addr  Global Symbol
      -----  --------------------------------
       6BF6  __idata_start
       70D8  __idata_end

Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                            text   70D8   12572 =  75122. bytes (rel,con,rom)   //问题就是出在这 程序大于75.122K就报错

       Addr  Global Symbol
      -----  --------------------------------
       386C  __start
       386C  __text_start
       388E  _exit
       388F  _War
       38B8  _IO_Init
       38E0  _DelayMs
       38F5  _DelayUs
       3927  _delay_nus
       3935  _delay_nms
       394B  _Work_Time
       39F7  _KEY
       3AC3  _GUI_shuxing
       3C49  _sensor
       3C82  __StackOverflowed
       3C9F  _offset1
       3CC8  _ad2temp
       3D16  _adcvalue
       3D24  _timer_init
       3D3B  _SYS_setting
       3DB3  _C2B
       3DCE  _SAVE_ASK
       3E01  _TS
       3E1E  _MsgBox
       3EF9  _KEY_INPUT_KEY
       408E  _srkl
       414D  _IIC_Init
       4152  _IIC_Start
       4164  _IIC_Stop
       4175  _IIC_WriteByte
       419D  _IIC_ReadByte
       41CD  __24CXXX_init
       41CE  _E_W
       41E9  _E_R
       420B  _E_Ws
       42C0  _E_WWs
       43C1  _E_Rs
       447C  _LCD_henmang
       4491  _Write_Cmad
       44CF  _Write_Data
       4517  _LCD_INT
       4528  _LCD_CLR
       4584  _LCD_FULL
       45BD  _TianCong
       45FE  _dprintf
       485A  _Read_Data
       48AB  _putpixel
       48EE  _LCD_FANBAI
       499A  _LCD_CURCOR
       49FC  _TIMER0_OVR_interrupt
       4A12  _MeiCiDuoShao
       4A46  _FOUS_SET_right
       4A73  _FOUS_SET
       4ABB  _BuChangShiJian_key
       4AF3  _main_key
       6C0C  _Main_RealTime
       6D9E  _Main_Real_display
       6F3F  _Pre_key
       70E3  _WeiYiKongZhi
       73F5  _liju_tongxun
       7484  _PER_Process
       74F3  _YaGanCelLiang
       7A3D  _NEXT
       7AF4  _Hang_Next
       7BE6  _TIMER1_COMPA_interrupt
       7E81  _Moto_B
       80BF  _TIMER3_COMPA_interrupt
       83CB  _Motor_Pause
       84F8  _Motor_reset
       8757  _Slow_Stop
       877A  _Goto
       8966  _BaiDongGuiLing
       89C6  _Moto_test
       8B9E  _Mian_Total
       8BB7  _Hang_To_index
       8C0A  _EEprom_Hang_write
       8EE8  _EEPROM_ESC
       8F59  _eep_write
       9030  _CopyToBottomBall
       9090  _File_Copy
       912D  _eep_read
       91D6  _const2string
       923C  _C2S
       9265  _EEP_IC_R
       9306  _EEP_IC_W
       934B  _PAR_Renew
       9435  _Write_Dot_EEPROM
       944D  _Read_NAME
       9467  _NAME_LEN
       947F  _GUI_DisPlay
       9539  _MOTO_LCD_POS_SHOW
       96E7  _MOTO_LCD_POS_SHOW2
       9838  _GUI_3_7_PassWord
       9894  _GUI_0_1_GongZuoWenJian
       98C9  _GUI_0_2_FangSiBu
       993B  _GUI_1_1_SheBeiTiaoShi
       996A  _GUI_1_2_QiDongSheBie
       9A5E  _GUI_1_3_GongYiCanShu
       9BA9  _GUI_2_1_ShuRuCuanGanQi
       9BB0  _GUI_2_2_BuChangShiJian
       9D0F  _GUI_2_3_AnQuanYaGan
       9D4B  _GUI_2_4_CanPinLeiJi
       9D70  _GUI_2_5_SheZhiCaiDan
       9DC3  _GUI_2_7_QiuXinSheZhi
       9E16  _GUI_2_6_KongZou
       9E67  _GUI_3_1_ZhenZaiGongZuo
       9E78  _GUI_3_2_BuChangSheZhi
       9EA2  _GUI_3_4_PaoGuangLiJu
       9EAA  _GUI_3_5_CongFuHangMian
       9EB2  _GUI_3_6_KongZou_Next
       9ECE  _GUI_4_3_PaoGuangZhuanJiaoPianYi
       9ED6  _GUI_4_4_PaoGuangBaiJiaoPianYi
       9EDE  _GUI_5_3_JinWeiCeLiang
       A02E  _GUI_5_7_JinWeiCeLiang2
       A655  _GUI_5_5_HangBaiJiaoDu
       A8E6  _GUI_6_0_WenJianGuanLi
       A915  _GUI_6_2_WenJianLiuLan
       AA5A  _GUI_7_0_File_Rename
       AE15  _GUI_7_1_TEXT_SHOW
       B028  _JiHe_display
       B100  _main
       B88D  __print
       BCFA  _strcpy
       BD03  _strlen
       BD0F  push_arg4
       BD11  push_arg2
       BD14  asr32
       BD20  mod16s
       BD24  div16s
       BD3E  mod16u
       BD40  div16u
       BD41  xdiv16u
       BD5A  div32u
       BD5C  mod32u
       BD60  div32s
       BD62  mod32s
       BD8E  long_div_prolog
       BDA1  long_div_epilog
       BDB1  tst_R16_R19
       BDB6  tst_R24_R27
       BDBB  neg_R24_R27
       BDC4  mod8u
       BDC6  div8u
       BDC7  xdiv8u
       BDDC  elpm32
       BDF0  empy16s
       BE00  empy32s
       BE00  empy32u
       BE34  pop_xgset003C
       BE39  pop_xgset30FC
       BE42  pop_xgsetF0FC
       BE4D  push_xgsetF0FC
       BE4F  push_xgset30FC
       BE51  push_xgset00FC
       BE53  push_xgset003C
       BE58  push_xgset300C
       BE5D  pop_xgset300C
       BE62  push_xgsetF000
       BE67  pop_xgsetF000
       BE6C  push_xgsetF00C
       BE73  pop_xgsetF00C
       BE7A  push_xgset303C
       BE81  pop_xgset303C
       BE88  push_xgsetF03C
       BE91  pop_xgsetF03C
       BE9A  xicallx
       BEA3  neg32
       BEAC  long_prolog
       BEBA  long_epilog
       BEC5  tstzero1
       BECB  tstzero2
       BED1  lsl32
       BEDD  lsl8
       BEE3  lsr32
       BEEF  lsr8
       BEF5  asgncblkx
       BF0E  _EEPROMread
       BF15  _EEPROMwrite
       BF24  _EEPROMReadBytes
       BF3F  _EEPROMWriteBytes
       BF5A  __HWStackBottom
       BF5F  __StackCheck
       BF75  fpsub
       BF77  fpadd
       BF78  fpadd_alt
       BFDF  fpadd1
       BFE9  fpsub1
       BFF3  fpsub2
       BFFE  fpint
       C030  uint2fp
       C032  int2fp
       C03B  ulong2fp
       C03D  long2fp
       C054  fpdiv1
       C05D  fpdiv2
       C067  fpdiv1x
       C073  fpdiv2x
       C0EE  unpacks
       C0F6  tstR16_R19
       C0FE  unpacku
       C117  normalize_and_pack
       C14C  pack
       C15C  saveFPRegs
       C16B  restoreFPRegs
       C17A  fpmule
       C1CD  fpmule1
       C1D7  fpmule2
       C1E2  fpcmp
       C1EF  fpcmp1
       C1FA  fpcmp2
       C206  _cstrcpy
       C210  _cstrlen
       C21D  _atoi
       C263  _itoa
       C2CE  _ltoa
       C386  _ultoa
       C3ED  _utoa
       C42D  _ftoa
       C5BC  _isdigit
       C5C6  _islower
       C5D0  _isspace
       C5DA  _toupper
       C5ED  __sdepi
       C5F7  _sprintf
       C63B  __FormatFP_1
       CB25  __text_end

Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                            data   0100   04E2 =   1250. bytes (rel,con,ram)

       Addr  Global Symbol
      -----  --------------------------------
       0100  _T_WenJianHao
       0100  __data_start
       0101  _COPY_FILE
       0102  _step
       0104  _AUTO_DATA
       0106  _last_add
       0107  _WORK_MODE
       0108  _GUI_POINT
       0109  _GUI_renew
       010A  _GUI_JiaoDian
       010B  _LCD_cln_enb
       010C  _NOW_HANG
       010D  _NOW_MIAN
       010E  _key_up_stop_flg
       010F  _pas
       0118  _JiaLiangHang
       0119  _liju_once
       011A  _XinPianHao
       011B  _ST_EEPROM_menu
       05E2  __data_end

Area                               Addr   Size   Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                             bss   05E2   0311 =    785. bytes (rel,con,ram)

       Addr  Global Symbol
      -----  --------------------------------
       05E2  __bss_start
       05F0  _HardAddr
       05F1  _IIC_State
       05F2  _No
       05F4  _C
       0610  _B
       062C  _A
       0648  _fb
       066B  _SAVE_OLD
       0853  _book
       0854  _IO_DanCi
       0855  _YaGan_AnGuo
       0856  _ManShengShuDuING
       0857  _B_Enable
       0858  _set_NianTie_flg
       0859  _set_hang_flg
       085A  _set_Ask_YaobuYao
       085B  _set_Ask_time
       085C  _set_Ask_flg
       085D  _set_QIU_flg
       085E  _set_change_flg
       085F  _set_flg
       0860  _real_offset
       0861  _mian_cf
       0862  _hang_cf
       0863  _EEPROM_POINT
       0865  _GUI_hang_renew
       0866  _once
       0867  _int1
       0868  _int0
       0869  _FB_Cln_old
       086A  _JingWei_Temp
       086C  _BUF
       0886  _char_buff
       08A0  _t
       08A2  _T_DaoXuChuMoKaiQi
       08A3  _T_LianDongBi
       08A5  _T_YaGan_JBBC_SHBC
       08A7  _T_ManShengBuShu2
       08A9  _T_ManShengBuShu
       08AB  _T_ManShengSPEED
       08AD  _T_XiaBanQiuShibuShi
       08AE  _T_DangQianGongXu
       08AF  _T_OLD_HangBai
       08B1  _T_LiJuPaoGuang
       08B2  _T_ShuangZouLianDong_pos
       08B4  _T_ShuangZouLianDong
       08B5  _T_ShengJiangSuDu
       08B7  _T_TuiWei
       08B9  _OLD_JingWei
       08BB  _T_JingWei
       08BD  _T_MIAN_ManShengWeiZhi
       08C1  _T_YaGan_JBBC_SHBC_QXBC
       08C5  _k
       08C6  _yy
       08C8  _kkk
       08F3  __bss_end

Area                               Start  End    Decimal Bytes (Attributes)
--------------------------------   ----   ----   ------- ----- ------------
                          vector   0000   006C =    108. bytes (abs,ovr,rom)

Files Linked      [ module(s) ]

C:\iccv7avr\lib\crtatmega.o        [ crtatmega.s ]
main.o        [ main.c ]
<library>        [ _printf.s, strcpy.s, strlen.s, asave.s, asr32.s, div16s.s, div16u.s, div32.s, div8u.s, elpm32.s, emul16s.s ]
[ emul32.s, gpop2.s, gpop4.s, gpop5.s, gpush.s, gpushx.s, gpushy.s, gpushz.s, gpusha.s, gpushb.s, icallx.s ]
[ lneg.s, longutil.s, lsl32.s, lsl8.s, lsr32.s, lsr8.s, pmstructx.s, eepromr.s, eepromw.s, eepromrbytes.s ]
[ eepromwbytes.s, hwstack.s, stackcheck.s, fpadd.s, fpadd1.s, fpsub1.s, fpsub2.s, fpint.s, int2fp.s ]
[ fpdiv_new.s, fputil.s, fpmule.s, fpmule1.s, fpmule2.s, fpcmp.s, fpcmp1.s, fpcmp2.s, cstrcpy.s, cstrlen.s ]
[ atoi.s, itoa.s, ltoa.s, ultoa.s, utoa.s, ftoa.s, isdigit.s, islower.s, isspace.s, ctype.s, toupper.s ]
[ sprintf.s, formatfp1.s ]

User Global Definitions

ram_end = 0x10ff
hwstk_size = 0x28

User Base Address Definitions

func_lit = 0x8c
data = 0x100
eeprom:0.4096

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

发表于 2011-9-6 15:39:05 | 显示全部楼层
用破_解版的吧

出0入0汤圆

 楼主| 发表于 2011-9-9 09:04:29 | 显示全部楼层
我用是 iccavr 7.22 professional 破_解版  不知道算不算破_解版 还是是收费版跟破_解版是不一样的

出0入0汤圆

发表于 2011-9-18 21:00:01 | 显示全部楼层
那该如何是好啊?我正好遇到这个问题啊?

出0入0汤圆

发表于 2011-9-20 15:49:32 | 显示全部楼层
3年都没解决!!!!!!!!!!!!!

看来我运气也不太好哇!!!!!

不过我和你的情况不太一样,我用winavr,常数组大于64k,多的部分,读出错。

编译倒没问题!

64k,这两天翻了好多网页论坛,没什么收获!

关注中!!!

注:我的问题,和你的可能并不相同!但是比较相近!至少和64k有关!

出0入0汤圆

 楼主| 发表于 2011-9-28 22:43:52 | 显示全部楼层
等待高手..

出0入0汤圆

 楼主| 发表于 2011-9-29 09:13:03 | 显示全部楼层
回复【4楼】doublerace
-----------------------------------------------------------------------

atmega128中 指针地址是16位的 words可以访问128K的flash 而常量指针 是16位的字节 只能访问 64K 以下的flash 换句话说是不能 申请连续的 大于64k 的的常量 访问地址大于64K 的 常量 必须要换指令了 具体我也没用过

官方原文档:
Accessing Memory Outside of the 64K Range
With 16-bit pointers, the AVR can normally access 64K bytes of data memory, 64K words of program memory used for functions and 64K bytes of program memory for constant data. The latter requires a clarification: since code must be aligned on a word boundary, the AVR uses word addresses to access code (e.g., for a function call). This allows a function call to reach the full 128K byte / 64K word of the Mega128 flash memory space with a 16-bit word address. However, constant data in the flash memory uses byte addresses, so the AVR normally can only access constant data in the lower 64K bytes of the flash memory using the LPM instruction.

To get around these limitations, the AVR uses the RAMPZ IO register to allow greater-than-64K access to flash memory. The XMega has four such IO registers: RAMPX, RAMPY, RAMPZ, and RAMPD, to allow greater-than-64K access to both data and flash memory.

Currently we do not support automatic changing of the RAMP? IO registers to preserve the simplicity of using 16-bit pointers. Allowing a mix of 16- and 24/32-bit pointers would increase the code size significantly, and it is more efficient if you manage the paging yourselves using the following rules and library functions.

Non-XMega: Managing the RAMPZ Register
The non-XMega AVR uses the RAMPZ to access constant data above the 64K-byte boundary (using the elpm instruction) and does not define the other RAMP? registers. Therefore it is easiest if you just change RAMPZ as needed when accessing a constant item. With careful managment (see Managing Constant Data), you can set and reset RAMPZ as needed.

The rest of this manual section is for XMega only, as the topics do not apply to non-XMega parts.

XMega: Managing the RAMP? Registers
The XMega uses all four RAMP? registers for accessing data memory, and RAMPZ is also used for accessing constant data above 64K bytes. We recommend that generally to leave the RAMP? registers at their values initialized in the Startup File, which is zero in all cases except for RAMPZ. RAMPZ is set to zero unless you are building a bootloader project that is located above the 64K-byte boundary, in which case, it is set to 1, 2, or 3 depending on the location of the bootloader. These defaults work well most of the time as most data and constant data reside in their respective lower 64K-byte areas.

Since changing RAMPZ affects data SRAM access via the Z pointer registers, if you need to modify RAMPZ, then you should save the previous value and restore it when you are done. We provide a set of library functions for accessing extended flash locations that preserves the value of RAMPZ; see Greater Than 64K Access Functions for details.

With the other RAMP registers, you can just safely use a register and set it to zero afterward. This ensures that RAMP registers have the default values except in the cases where you need to modify them.

出0入0汤圆

发表于 2011-9-29 09:59:09 | 显示全部楼层
mark

出0入0汤圆

发表于 2011-12-21 13:55:02 | 显示全部楼层
应该是单个文件不能超过128K。

出0入0汤圆

发表于 2012-5-15 13:40:06 | 显示全部楼层
请问有解了么?崩溃了

出0入0汤圆

发表于 2013-10-12 20:37:33 | 显示全部楼层
现在要编写XMEGA的程序了,刚刚写了一段很小的XMEGA128A1简单程序,通过,正常。
关注楼主所说的问题...

出0入0汤圆

发表于 2014-1-3 21:17:05 | 显示全部楼层
有解决了吗
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-23 22:21

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表