Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #382545

Re: OT: MPLAB build dies (linker prob)

From "P E Schoen" <paul@pstech-inc.com>
Newsgroups sci.electronics.design
Subject Re: OT: MPLAB build dies (linker prob)
Date 2015-10-24 01:25 -0400
Organization A noiseless patient Spider
Message-ID <n0f4k2$fdj$1@dont-email.me> (permalink)
References <yhDWx.79926$pF6.30543@fx06.iad>

Show all headers | View raw


"Robert Baer"  wrote in message news:yhDWx.79926$pF6.30543@fx06.iad...

>   Here is part of the code:
         ORG     0x0B00
tab3:
         MOVLW   High(tab3_data)
         ADDWF   timhi,W
         MOVWF   PCLATH
         MOVLW   Low(tab3_data)
         ADDWF   timlo,W
         BTFSC   STATUS,C
         INCF    PCLATH,F
         MOVWF   PCL     ; computed GOTO into data
; ------------------
tab3_data:          ;; at 0x0B08
         FILL    0x34F6, 0x0F07 - $ + 1
; ----------------------------------------------
         ORG     0x1000  ; PAGE 0-4095 allowed by assembler/linker
tab4:
         MOVLW   High(tab4_data)
         ADDWF   timhi,W
         MOVWF   PCLATH
         MOVLW   Low(tab4_data)
         ADDWF   timlo,W
         BTFSC   STATUS,C
         INCF    PCLATH,F
         MOVWF   PCL     ; computed GOTO into data
; ------------------
tab4_data:          ;; at 0x1008
         FILL    0x34F5, 0x1407 - $ + 1
; ----------------------------------------------
         ORG     0x1500
tab5:
         MOVLW   High(tab5_data)
         ADDWF   timhi,W
         MOVWF   PCLATH
         MOVLW   Low(tab5_data)
         ADDWF   timlo,W
         BTFSC   STATUS,C
         INCF    PCLATH,F
         MOVWF   PCL     ; computed GOTO into data
; ------------------
tab5_data:          ;; at 0x1508
         FILL    0x34F5, 0x1907 - $ + 1
; ----------------------------------------------
; BALANCE DEFAULT 0x3FFF
        END
**
>   The assembled code is OK, see NO errors.
>   The only clue beyond the fact that the build barfs, is the *.map file:
> MPLINK 4.39, Linker
> Linker Error Map File - Created Fri Oct 23 20:25:02 2015

> *Warning* - This is only a partial map file due to a link time error.
>     Only sections which were allocated prior to the error are shown below.

CODEPAGES:
  Memory  Start   End     Section  Address  Size(Bytes)
-------  ------  ------  -------  -------  ---------
    page  0x0000  0x0fff  .org_0   0x0000     0x0000
                          .org_1   0x0000     0x0008
                          .org_2   0x0010     0x0056
                          .org_3   0x0100     0x0810
                          .org_4   0x0600     0x0810
                          .org_5   0x0b00     0x0812
** END COPY

>   Therefore, there is a severe page range problem that needs fixing.
>   How?
>   (thanks in advance)

I think you are misusing the FILL directive. Here is what the documentation 
says:

4.33 fill – SPECIFY PROGRAM MEMORY FILL VALUE
4.33.1 Syntax
[label] fill expr,count
4.33.2 Description
Generates count occurrences of the program word or byte (PIC18 devices), 
expr. If
bounded by parentheses, expr can be an assembler instruction.
4.33.3 Usage
This directive is used in the following types of code: absolute or 
relocatable. For
information on types of code, see Section 1.6 “Assembler Operation”.
This directive is often used to force known data into unused program memory. 
This
helps ensure that if code ever branches to an unused area at run time, a 
fail-safe
condition occurs. For example, it is not uncommon to see this used with the 
watchdog
timer (WDT) on a PIC16 device. Unused program memory would be filled with 
goto or
branch instructions to prevent execution of the clrwdt instruction in code, 
which
would cause the device to reset. See the device data sheet for more 
information on the
WDT.
4.33.4 See Also
data dw org
4.33.5 Simple Examples
Example 1: PIC10/12/16 MCU’s
fill 0x1009, 5 ; fill with a constant
fill (GOTO RESET_VECTOR), NEXT_BLOCK-$

See:
http://ww1.microchip.com/downloads/en/DeviceDoc/33014J.pdf

I only use assembler for really small programs, or for special cases where I 
need to absolutely control the code location and implementation. It's really 
much easier to use C, and there are some low-cost compilers you can use.

Paul 

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-23 20:54 -0700
  Re: OT: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-24 01:25 -0400
    Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-24 11:43 -0700
      Re: OT: MPLAB build dies (linker prob) Martin Riddle <martin_ridd@verizon.net> - 2015-10-24 15:19 -0400
    Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-26 00:27 -0800
  Re: OT: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-24 01:50 -0400
    Re: OT: MPLAB build dies (linker prob) Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2015-10-24 11:07 +0300
    Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-24 12:22 -0700
      Re: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-24 17:14 -0400
        Re: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-26 00:30 -0800
      Re: OT: MPLAB build dies (linker prob) M Philbrook <jamie_ka1lpa@charter.net> - 2015-10-24 21:35 -0400
        Re: OT: MPLAB build dies (linker prob) Robert Baer <robertbaer@localnet.com> - 2015-10-26 00:34 -0800
          Re: OT: MPLAB build dies (linker prob) Martin Brown <|||newspam|||@nezumi.demon.co.uk> - 2015-10-26 12:22 +0000
            Re: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-26 17:06 -0400
          Re: OT: MPLAB build dies (linker prob) M Philbrook <jamie_ka1lpa@charter.net> - 2015-10-26 20:31 -0500
            Re: MPLAB build dies (linker prob) "P E Schoen" <paul@pstech-inc.com> - 2015-10-26 21:15 -0400
              Re: MPLAB build dies (linker prob) M Philbrook <jamie_ka1lpa@charter.net> - 2015-10-26 21:35 -0500
  Re: OT: MPLAB build dies (linker prob) rickman <gnuarm@gmail.com> - 2015-10-27 03:07 -0400

csiph-web