On 2010-7-17 13:36, 谢继雷 wrote:
> On 2010-7-17 13:27, 谢继雷 wrote:
>> Check out the code:
>> svn://svn.bodz.net/usnap/miadev/trunk (user/passwd = miadev)
>>
>> 1. cd arch/cos51; make
>> 2. cd test/cos51; make debugunit_m.bin
>>
>> See the output:
>>
>> > $ sdcc -c --std-c99 -I../../arch --model-medium -o
>> debugunit_m.rel debugunit.c
>> > $ sdcc --model-medium --iram-size 0x100 --code-size 0x2000
>> --xram-size 0x200 debugunit_m.rel ../../lib/cos51medium.lib
>> >
>> > ?ASlink-Warning-Byte PCR relocation error
>> file module area offset
>>
>>
>> What's PCR relocation?
> I've renamed debug to sysmon, and debugunit to sysmontest. The
> commands should be:
>
> make -C arch/cos51
> make -C test/cos51 sysmontest_m.bin
>
After tried to reduce some functions' size, the link error is gone.
This is caused by code too far to generate ACALL/AJMP instruction.
This is the memory map when the function is just reduced to pass the link:
(When link failed, the .map file isn't generated.)
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
CSEG 0079 0ACB = 2763. bytes
(REL,CON,CODE)
Value Global Global Defined In Module
----- --------------------------------- ------------------------
0C: 0079 _main
0C: 0086 _testCase
0C: 00BE _putchar
0C: 00C8 _getchar
0C: 00FA _sunitSerialProc
0C: 01B8 __assert
0C: 01FE _vmstop
0C: 0205 _die
0C: 020B _printf_small
0C: 03CD _getsfr_tab <-- large function (0x200 bytes)
0C: 05CD _getsfr (AJMP into _getsfr_tab)
0C: 05FB _setsfr_tab <-- (0x200 bytes, reduced to 0x1C0 bytes)
0C: 07BB _setsfr (AJMP into _setsfr_tab) (0x38 bytes)
(Following are sdcc lib functions)
0C: 07F3 _puts <-- _setsfr: 0x7BB .. 0x7F2
0C: 0846 __ultoa
0C: 0929 __ltoa
0C: 09AB __gptrget
0C: 09C7 __modulong
0C: 0A8B __divulong
0C: 0B27 __sdcc_external_startup
0C: 0B2B __gptrput
Here setsfr() calls to setsfr_tab(), when setsfr_tab() is 0x200 bytes,
_setsfr() covers 0x7BB .. 0x830 which cross the page size 0x800 (2kb).
So, I need to arrange these functions to start in a separate page (or
segment) to change the form of
0C: 03CD _getsfr_tab <-- large function (0x200 bytes)
0C: 05CD _getsfr
0C: 05FB _setsfr_tab <-- large function (0x200 bytes)
0C: 07FB _setsfr
0C: 0833 (end)
into:
0C: 0000 _getsfr_tab <-- large function (0x200 bytes)
0C: 0200 _setsfr_tab <-- large function (0x200 bytes)
0C: 0400 _getsfr
0C: 042e _setsfr
0C: 0466 (end)
So as to utilize AJMP/ACALL, but how can I do this in SDCC?
Thanks,
Lenik
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user