Compiling difficulty with 18F425

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
20,668
I dug out an old 18F425 I decided to use for a project, I get a 'Link Step Failed' when compiling assembly program.
So I just used the Absolute template file and the INC file, just as it comes from the Template file directory.
Still failed.
MPlink.exe file is registered OK.
I searched the web already but the answers found so far do not relate to my file.
Using MPLAB-IDE 8.92.
Any ideas appreciated, otherwise I'll bite the bullet and toss it.
Max.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
20,668
The 'Program' is just the MPLAB template file for the 18F435
Does the same with a program added.
Max.

Code:
  Filename:  *
;  Date:  *
;  File Version:  *
;  *
;  Author:  *
;  Company:  *
;  *
;******************************************************************************
;  *
;  Files Required: P18F452.INC  *
;  *
;******************************************************************************

   LIST P=18F452     ;directive to define processor
   #include <P18F452.INC>   ;processor specific variable definitions

;******************************************************************************
;Configuration bits
;Microchip has changed the format for defining the configuration bits, please
;see the .inc file for futher details on notation.  Below are a few examples.

;  Oscillator Selection:
;  CONFIG   OSC = LP  ;LP
   config  OSC = HS  
     config  PWRT = OFF  
     config  BOR = OFF  
     config  BORV = 42  
     config  WDT = OFF  
     config  WDTPS = 128  
     config  CCP2MUX = OFF  
     config  STVR = OFF  
     config  LVP = OFF  
     config  DEBUG = OFF
     

; Start your code here    
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.

     CBLOCK   0x080
     WREG_TEMP   ;variable used for context saving
     STATUS_TEMP   ;variable used for context saving
     BSR_TEMP   ;variable used for context saving
     ENDC

     CBLOCK   0x000
     EXAMPLE     ;example of a variable in access RAM
     ENDC

;******************************************************************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here

     ORG   0xf00000

     DE   "Test Data",0,1,2,3,4,5

;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.

     ORG   0x0000

     goto   Main     ;go to start of main code

;******************************************************************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.

     ORG   0x0008

     bra   HighInt     ;go to high priority interrupt routine

;******************************************************************************
;Low priority interrupt vector and routine
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.

     ORG   0x0018

     movff   STATUS,STATUS_TEMP   ;save STATUS register
     movff   WREG,WREG_TEMP     ;save working register
     movff   BSR,BSR_TEMP     ;save BSR register

;   *** low priority interrupt code goes here ***


     movff   BSR_TEMP,BSR     ;restore BSR register
     movff   WREG_TEMP,WREG     ;restore working register
     movff   STATUS_TEMP,STATUS   ;restore STATUS register
     retfie

;******************************************************************************
;High priority interrupt routine
; The high priority interrupt code is placed here to avoid conflicting with
; the low priority interrupt vector.

HighInt:

;   *** high priority interrupt code goes here ***


     retfie   FAST

;******************************************************************************
;Start of main program
; The main program code is placed here.

Main:

;   *** main code goes here ***


;******************************************************************************
;End of program

     END
 

AlbertHall

Joined Jun 4, 2014
9,830
The template is for the 18F452 - you mention 18F435 and 18F425?

I created a new project and selected the simulator (no pickit 3 or PIC connected) and mpasm and it compiles without error including the link stage.
Using MPLABX V4.05, mpasm V5.76

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/Jim/Documents/MPLAB-X/Projects/junk2'
make -f nbproject/Makefile-default.mk dist/default/debug/junk2.debug.cof
make[2]: Entering directory 'C:/Users/Jim/Documents/MPLAB-X/Projects/junk2'
"C:\Program Files (x86)\Microchip\MPLABX\v4.05\mpasmx\mpasmx.exe" -d__DEBUG -d__MPLAB_DEBUGGER_SIMULATOR=1 -q -p18f452 -l"build/default/debug/Main.lst" -e"build/default/debug/Main.err" -o"build/default/debug/Main.o" "Main.asm"
"C:\Program Files (x86)\Microchip\MPLABX\v4.05\mpasmx\mplink.exe" -p18f452 -w -x -u_DEBUG -z__ICD2RAM=1 -m"dist/default/debug/junk2.debug.map" -z__MPLAB_BUILD=1 -z__MPLAB_DEBUG=1 -z__MPLAB_DEBUGGER_SIMULATOR=1 -odist/default/debug/junk2.debug.cof build/default/debug/Main.o
MPLINK 5.08, LINKER
Device Database Version 1.39
Copyright (c) 1998-2011 Microchip Technology Inc.
Errors : 0

make[2]: Leaving directory 'C:/Users/Jim/Documents/MPLAB-X/Projects/junk2'
make[1]: Leaving directory 'C:/Users/Jim/Documents/MPLAB-X/Projects/junk2'

BUILD SUCCESSFUL (total time: 9s)
 

LesJones

Joined Jan 8, 2017
2,638
Hi Max,
I have just assembled the code that you posted using MPASM (v5.55) without any problems. I just execute the file mpasmx.exe which on my computer is in this directory C:\Program Files (x86)\Microchip\MPLABX\mpasmx I find it quicker to assemble code this way than to wait for the MPLABX IDE to fire up. If you want to post the full code I will try to assemble it and I will upload the .exe file.

Les
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
20,668
The template is for the 18F452 - you mention 18F435 and 18F425?
I meant to type 18f452.

Hi Max,
I have just assembled the code that you posted using MPASM (v5.55) without any problems. I just execute the file mpasmx.exe which on my computer is in this directory C:\Program Files (x86)\Microchip\MPLABX\mpasmx I find it quicker to assemble code this way than to wait for the MPLABX IDE to fire up. If you want to post the full code I will try to assemble it and I will upload the .exe file.
Les
I am beginning to think it is the MPLAB-IDE ver.
Thanks for the offer but I will be playing around with version to do different tasks so I would be assembling and testing.
I have MPLABX I tried it when it came out but preferred the IDE.
The problem then was that in going from one to the other, the Pickit drivers had to be loaded in for the version being used.
Max.
 

LesJones

Joined Jan 8, 2017
2,638
Hi Max,
The version MPLABX on my PC is version 2.05 (I do have a more recent version on another disk with windows10 I could try if it would be any help.) I have just noticed that I said I could upload the .exe file when I should have said .hex file.

Les.
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
20,668
Can you post the output when you attempt to compile it.
OK, now I look closer I see the device not specified?
This is Template is no different from any of the other templates?
There are reports of it out there but I don't see one for this particular example.
MPLAB is configured for 18F452 and set for absolute compiling.
Max.

upload_2018-1-4_14-53-14.png
 

JohnInTX

Joined Jun 26, 2012
4,067
I just built it successfully, too. MPLAB 8.63 MPASMWIN 4.39, linker 4.38. Both absolute and relocatable modes.
I notice in the linker command line there is no /p18F452. Did you make a project and select the PIC?
----------------------------------------------------------------------
Debug build of project `M:\UP\JUNK\Test452.mcp' started.
Language tool versions: MPASMWIN.exe v5.39, mplink.exe v4.38, mplib.exe v4.38
Preprocessor symbol `__DEBUG' is defined.
Thu Jan 04 17:13:02 2018
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "M:\UP\JUNK\Test452.o".
Clean: Deleted file "M:\UP\JUNK\Test452.err".
Clean: Deleted file "M:\UP\JUNK\Test452.lst".
Clean: Deleted file "M:\UP\JUNK\Test452.cof".
Clean: Deleted file "M:\UP\JUNK\Test452.hex".
Clean: Deleted file "M:\UP\JUNK\Test452.map".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F452 "Test452.asm" /l"Test452.lst" /e"Test452.err" /o"Test452.o" /d__DEBUG=1
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe" /p18F452 "Test452.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /m"Test452.map" /w /o"Test452.cof"
MPLINK 4.38, Linker
Copyright (c) 1998-2010 Microchip Technology Inc.
Errors : 0

MP2HEX 4.38, COFF to HEX File Converter
Copyright (c) 1998-2010 Microchip Technology Inc.
Errors : 0

Loaded M:\UP\JUNK\Test452.cof.
----------------------------------------------------------------------
Debug build of project `M:\UP\JUNK\Test452.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.39, mplink.exe v4.38, mplib.exe v4.38
Preprocessor symbol `__DEBUG' is defined.
Thu Jan 04 17:13:03 2018
----------------------------------------------------------------------
BUILD SUCCEEDED
It looks like your MPLAB is not passing the PIC type in the linker command line (highlighted) Other than that, I got nothin'
Good luck.
 

JohnInTX

Joined Jun 26, 2012
4,067
That's because the /o specifies the output file Pxxx.cof. Changing just /o to /p says your PIC part number ends in .cof.

You might try adding the /p18F452 to the linker command line in Project->Build Options -> Project _MPLINK linker in the 2 bottom dialogs (only one should be active). Check Use Alternate Settings and add /p18F452 and see if that adds the PIC to the command line - the current settings should already be there in the alternate window. You could also try Restore Defaults.

EDIT: looking at the linked post, that is what he is doing. Note that he adds /p18F452 and preserves the rest, leaving the /m and /o params unchanged.

Note this is for 8.63
 

Thread Starter

MaxHeadRoom

Joined Jul 18, 2013
20,668
OK problem solved, I played around with the Project> Build Options >. Masm Linker as per the previous link with differing results.
I eventually went back and set it to Restore Defaults in Linker tab. (I was positive I had already done this?)
Now Good.
Thanks all
Max.
 
Top