#1960 sfr16 type code can't be assembled - mcs51

closed-fixed
5
2013-05-25
2012-03-04
Joe
No

Build 3.1.3 #7396 but fails on older builds too.

See attached test case.

The sfr16 type generates assembly code that fails.

; bug_sfr16.c:26: TMR2RL = 0x1234; // 16b Broken
mov _TMR2RL,#0x34 << ERROR
mov (_TMR2RL >> 8),#0x12
; bug_sfr16.c:29: TMR2RLL = counts; // 8b OK, truncated // Init reload values
mov _TMR2RLL,#0x00

$ /cygdrive/c/Tools/sdcc/bin/sdcc --debug -DSDCC -V -I./INC "bug_sfr16.c"
removing bug_sfr16.rel
bug_sfr16.asm:954: Error: <d> direct page addressing error
+ C:\Tools\sdcc\bin\sdcpp.exe -nostdinc -Wall -DSDCC -I./INC -obj-ext=.rel -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=3_1_3 -D__SDCC_REVISION=7396 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Tools\sdcc\bin\..\include\mcs51" -isystem "C:\Tools\sdcc\bin\..\include" "bug_sfr16.c"
+ C:\Tools\sdcc\bin\sdas8051.exe -plosgffwc "bug_sfr16.rel" "bug_sfr16.asm"
+ C:\Tools\sdcc\bin\sdas8051.exe -plosgffwc "bug_sfr16.rel" "bug_sfr16.asm" returned errorcode 2

Discussion

  • Joe

    Joe - 2012-03-04
     
  • Joe

    Joe - 2012-03-04
    • summary: sfr16 type code can't be assembled --> sfr16 type code can't be assembled - mcs51
     
  • Joe

    Joe - 2012-03-04

    Original Code (also in attached)

    #include <C8051F340.h> // SDCC SFR declarations
    //__sfr16 __at (0xCBCA) TMR2RL ;

    void main (void)
    {
    int counts;
    counts = 0;

    // TMR2RL is sfr16 from header definition
    //
    TMR2RL = 0x1234; // 16b Broken
    //TMR2RL = counts; // 16b Broken
    //TMR2RL = 0x0002; // 16b Broken // Init reload values
    TMR2RLL = counts; // 8b OK, truncated // Init reload values
    //TMR2 = 0xffff; // Set to reload immediately
    }

     
  • Maarten Brock

    Maarten Brock - 2012-03-09
    • assigned_to: nobody --> maartenbrock
     
  • Maarten Brock

    Maarten Brock - 2012-03-18

    Fixed in SDCC 3.1.3 #7461

     
  • Maarten Brock

    Maarten Brock - 2012-03-18
    • labels: 355282 --> mcs51(8051) target
    • milestone: --> fixed
    • status: open --> open-fixed
     
  • Maarten Brock

    Maarten Brock - 2012-03-18
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.