syntax error: token -> '=' ; - PIC...

2010-11-13
2013-03-12
  • André Barone

    André Barone - 2010-11-13

    Hey there,

    I am trying to compile the following source code:

    #define __18f4520
    #include"pic18f4520.h"
    /* Setup chip configuration */
    typedef unsigned int config;
    config at __CONFIG1H = _OSC_HS_1H;
    #define b1 0x02 /* pin 1 on PORTB */
    #define B_OUTPUTS 0xFD /* value used to setup TRISB */
    void main(void) {
     /* PORTB.1 is an output pin */
     TRISB = B_OUTPUTS;
     while(1) { /* Loop forever */
     /* toggle bit 1 */
     PORTB = (PORTB ^ b1);
     }
    }
    

    with :

    sdcc --debug -mpic16 -p18f4520 -L/usr/share/sdcc/lib/pic16/bin -I/usr/share/sdcc/include/pic16  main.c
    

    Then, i get this message: main.c:21: syntax error: token -> '=' ; column 20

    Line 21 is config at __CONFIG1H = _OSC_HS_1H;

    I found other token erros on the forum, but none related to this attribution operator.

    by the way,
    my SDCC version is SDCC : avr/pic16/pic14/xa51 2.8.0 #5117 (Jun  2 2008) (UNIX)  on a Debian 5 (lenny).

    Thanks in advance,

    André B.

     
  • Mark Richardson

    Mark Richardson - 2011-05-04

    Try this instead…
    <code>
    static __code char __at(__CONFIG1H) conf1H =_OSC_HS_1H;
    </code>

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks