Error Crossing page boundary

Nezs
2008-06-18
2013-03-12
  • Nezs
    Nezs
    2008-06-18

    Hi,

    I'm pretty new to C and PIC programming and this may sound a bit silly but i dont know how to link several .c files for organizing the code page and RAM banks. The manual for SDCC explains briefly but i dont really know how to do it. I tried searching for linking in the web but the results refers to linking object files, lkr, etc.

    Can someone help me or link me an example please?

    Thank you

     
    • rudolf
      rudolf
      2008-06-18

      Hi Nezs

      here is an example, how I do it to generate file2.hex:

      $ sdcc -mpic14 -p16f628  --opt-code-size -c file1.c
      $ sdcc -mpic14 -p16f628  --opt-code-size -c file2.c

      $ sdcc -L /usr/local/share/sdcc/lib/pic -mpic14 -p16f628 file2.c file1.o

      _
      header of file2.c:

      /* Define processor and include header file. */
      #define __16f628
      #include"pic/pic16f628.h"
      #define clock_speed  16000000

      /* Setup chip configuration */
      typedef unsigned int config;
      config at 0x2007 __CONFIG = _CP_OFF &
                                  _WDT_ON &
                                  _BODEN_OFF &
                                  _PWRTE_OFF &
                                  _ER_OSC_CLKOUT &
                                  _MCLRE_OFF &
                                  _LVP_OFF &
                                  _HS_OSC;

      ...

      _
      header of file1.c:
      #define __16f628
      #include"pic/pic16f628.h"
      ...

      good luck,
      rl

       
      • Nezs
        Nezs
        2008-06-19

        Hi rudolf,

        Thanks for the code sample. I really appreciate your help.
        I will try it out and hopefully, be able to solve any problems that i face :)
        Thanks again!