Hello, I recently started using the sdcc-gputils combo for pic18 (-mpic16) devices. Here is my problem:
I assign some data from __code memory to a pointer variable but it ends up being a __data pointer I think.


the c-code:
#include "data.h"

static uchar *sourceData;
sourceData = (uchar *) &config_desc;    // also tried this without '&'

data.c
__code unsigned char config_desc[] = {
 ...
};

data.h
extern __code unsigned char *config_desc;

translates to:
;    .line    93; usb/ep0.c    sourceData = (uchar *) &config_desc;
    MOVLW    HIGH(_config_desc)
    BANKSEL    (_sourceData + 1)
    MOVWF    (_sourceData + 1), B
    MOVLW    LOW(_config_desc)
    BANKSEL    _sourceData
    MOVWF    _sourceData, B
    MOVLW    0x80
    BANKSEL    (_sourceData + 2)
    MOVWF    (_sourceData + 2), B

(after linking):
0001f4:  0e00  movlw    0            ; MOVLW        HIGH(_config_desc)
0001f6:  0104  movlb    0x4            ; BANKSEL    (_sourceData + 1)
0001f8:  6fac  movwf    0xac, 0x1    ; MOVWF        (_sourceData + 1), B
0001fa:  0e34  movlw    0x34        ; MOVLW        LOW(_config_desc)
0001fc:  0104  movlb    0x4            ; BANKSEL    _sourceData
0001fe:  6fab  movwf    0xab, 0x1    ; MOVWF        _sourceData, B
000200:  0e80  movlw    0x80        ; MOVLW        0x80                <-- shouldn't this read 0x00   ??????????????
000202:  0104  movlb    0x4            ; BANKSEL    (_sourceData + 2)
000204:  6fad  movwf    0xad, 0x1    ; MOVWF        (_sourceData + 2), B

Regards, Jan
  

GRATIS! Movie-FLAT mit über 300 Videos.    
Jetzt freischalten unter http://movieflat.web.de
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to