Dear Raphael and Vaclav,

I tried this:
__code unsigned short __at(_CONFIG1) config1Reg = (_FCMEN_OFF & _IESO_OFF & 
_BOREN_ON & _CPD_ON & _CP_ON & _MCLRE_OFF & _PWRTE_ON & _WDTE_OFF & _FOSC_HS);
__code unsigned short __at(_CONFIG2) config2Reg = (_LVP_ON & _BORV_25 & 
_STVREN_ON & _PLLEN_ON & _WRT_ALL);

And it generated this output in asm file:
ID_test_0       code    0x8007
_config1Reg
        retlw 0x02    ;My comment: this instruction placed at 0x8007
        retlw 0xce    ;My comment: this instruction placed at 0x8008
ID_test_1       code    0x8008
_config2Reg
        retlw 0xfc    ;My comment: this instruction placed at 0x8008
        retlw 0xfb    ;My comment: this instruction placed at 0x8009

As I know, this is totally bad.
The compiler tried to place some executable code at 0x8007 and 0x8008, 
especially retlw instructions.
This should be a good practice to place a 8 bit constant into a 14 bit location 
somewhere in a program sapce but it is not usable to define config values. 
0x8007 and 8008 are special area, outside of normal code area. The config 
constants should place into this place directly not indirectly by retlw thing.

Other problem is the overlap between them:
The second half of the config1Reg and the first half of config2Reg overlaps.
It is the reason why linker complains some addresses used twice.

I also tried to hack the assembly file.

gpasm has special keyword to specify config values.
I tried to include these lines into generated asm file:
        __config _CONFIG1, _FCMEN_OFF & _IESO_OFF & _BOREN_ON & _CPD_ON & 
_CP_ON & _MCLRE_OFF & _PWRTE_ON & _WDTE_OFF & _FOSC_HS
        __config _CONFIG2, _LVP_ON & _BORV_27 & _STVREN_ON & _PLLEN_ON & 
_WRT_ALL

This resulted a hex file containing proper values in config locations.

I think, sdcc should has special keyword or pragma to generate this special 
__config line into asm.
I cannot find info related how to do this in sdcc docu.

Tamas


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to