对C51而言,生成的HEX文件是有体积约束的,假如ROM过大,那么就要用到分页技能将HEX分红几个文件
具体做法简略点来说,如下:
===================================================================
1.找到L51_BANK.A51文件加到工程中
2.找到STARTUP.A51文件最终 EXTRN CODE (?B_SWITCH0) CALL ?B_SWITCH0 ; init bank mechanism to code bank 0 本来是注释掉的,康复有用
3.剩余的便是设置了,看下图
=================================================
更烦琐的做法见第二个参阅链接
======================================
再贴一个组成脚本:
在KEIL的OPTION的USER页下,最终一栏:RUN AFTER BUILD中加入编译完成后要调用的动作: Merge256K_4M.bat
然后看这个bat的代码:
del hexsparrow.H00
del hexsparrow.H01
del hexsparrow.H02
del hexsparrow.H03
del hexsparrow.H04
del hexsparrow.H05
del hexsparrow.H06
del hexsparrow.H07
del hexsparrow.H08先删去本来的分页文件
@echo off
copy outputsparrow.H00 hexsparrow.H00
copy outputsparrow.H01 hexsparrow.H01
copy outputsparrow.H02 hexsparrow.H02
copy outputsparrow.H03 hexsparrow.H03
copy outputsparrow.H04 hexsparrow.H04
copy outputsparrow.H05 hexsparrow.H05
copy outputsparrow.H06 hexsparrow.H06
copy outputsparrow.H07 hexsparrow.H07将新的分页文件复制到指定地址
HEX2BIN /Q /L524288 hexsparrow.H00 hexRTD2668.BIN
HEX2BIN /Q /O65536 /M hexsparrow.H01 hexRTD2668.BIN
HEX2BIN /Q /O131072 /M hexsparrow.H02 hexRTD2668.BIN
HEX2BIN /Q /O196608 /M hexsparrow.H03 hexRTD2668.BIN
HEX2BIN /Q /O262144 /M hexsparrow.H04 hexRTD2668.BIN
HEX2BIN /Q /O327680 /M hexsparrow.H05 hexRTD2668.BIN
HEX2BIN /Q /O393216 /M hexsparrow.H06 hexRTD2668.BIN
HEX2BIN /Q /O458752 /M hexsparrow.H07 hexRTD2668.BIN
用HEX2BIN将HEX分页组成一个BIN文件