Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

tabs and different linker files

Status
Not open for further replies.

justwantin

New Member
I'm very new to programming PIC's and this list. I have been reading about programming PIC's but with so much info on the net I may have missed something.

First off, do tabs abnd carriage returns matter in an .asm file? I have noticed that different editors handle tabs and such differently, e.g. notepad will add a carriage return to the file but most linux editors do not. I have been having trouble assembling a tutorial script and have noticed changes in line and contents when opening in different editors.

Secondly I have a recently purchased PICKit 2 and have installed MPLab-8.33 from a download. Using the turn_on_led.asm from the tutorial I am getting very different results between MPLab and Pikdev a linux based ide

MPlab only gives me the option of using a linker file 12f509_g.lkr, while Pikdev users a file named 12f509.lkr. I get failed builds in MPLab but do not in Pikdev. I also get "out of date notices for my object file among others.

Could this be something attributable to older code on newer software, perhaps something else? I have gonne over the asm more than once and can't find anything different fom the Gooligum tutorial. I'll post error messages and my code below:

TIA

Code:
Debug build of project `C:\Projects\Lesson-1\turn-on-led.mcp' started. 
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined. Thu Aug 27 19:18:34 2009
---------------------------------------------------------------------- 
Make: The target "C:\Projects\Lesson-1\turn-on-led-01.o" is out of date. Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F509 "turn-on-led-01.asm" /l"turn-on-led-01.lst" /e"turn-on-led-01.err" /o"turn-on-led-01.o" /d__DEBUG=1 
Make: The target "C:\Projects\Lesson-1\turn-on-led.cof" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\
mplink.exe" "..\..\Program Files\Microchip\
MPASM Suite\LKR\12f509_g.lkr" "turn-on-led-01.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"turn-on-led.cof" /M"turn-on-led.map" /W 
MPLINK 4.33, Linker 
Copyright (c) 2009 Microchip Technology Inc. 
Error - section '.config_0FFF_TURN-ON-LED-01.O' can not fit the absolute section. Section '.config_0FFF_TURN-ON-LED-01.O' start=0x00000fff, length=0x00000002 
Errors    : 1  Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\Projects\Lesson-1\turn-on-led.mcp' failed.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined. 
Thu Aug 27 19:18:36  2009
----------------------------------------------------------------------
BUILD FAILED

I have removed comments in the asm for brevity:
Code:
	list		p=12F509           ; list directive to define processor
	#include 	<p12F509.inc>      ; processor specific variable definitions

	__CONFIG	_MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC 


;**********************************************************************
RESET	CODE    0x3FF	            ; processor reset vector
		res		1					; holds movlw with factory RC cal value 

MAIN    CODE    0x000              	; effective reset vector 
        movwf   OSCCAL            	; update OSCAL (register) with factory cal value 

;***** Initialisation
start
		movlw	b'111101'				; configure GP1 (only) as an output
    	tris	GPIO	
		movlw	b'000010'				; set GP1 high
		movwf	GPIO

		goto	$		
        
		END
 
Out of date just means you didnt save the project before building.

How will you see the LED flash without a delay in between?

Can you link the original code please?
 
Just start a new project and insert the above code. Don't add a linker script and when asked select relocatable code and it should assemble correctly.

Mike.
 
The original code is from a pdf'd tutorial here: https://www.gooligum.com.au/tutorials/baseline/PIC_Base_A_2.pdf

All this asm/tutorial is supposed to do is light an LED until power is turned off, the next tutorial lesson will be to flash the LED.

I spent an hour plus going over the asm this am but I have been known to miss the blazingly obvious before. One more thing which may or may not matter; I am running MPLab on on a virtual XP system with a Linux system as the host.

I created a new project with no linker saved project again for good measure then tried to assemble but it again failed with the following error message

Code:
Make: The target "C:\Projects\try-2\turn-on-led-02.o" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F509 "turn-on-led-02.asm" /l"turn-on-led-02.lst" /e"turn-on-led-02.err" /o"turn-on-led-02.o" /d__DEBUG=1 
Make: The target "C:\Projects\try-2\try-2.cof" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p12F509 "turn-on-led-02.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"try-2.cof" /M"try-2.map" /W
MPLINK 4.33, Linker
Copyright (c) 2009 Microchip Technology Inc.
Error - section '.config_0FFF_TURN-ON-LED-02.O' can not fit the absolute section. Section '.config_0FFF_TURN-ON-LED-02.O' start=0x00000fff, length=0x00000002 Errors    : 1  Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\Projects\try-2\try-2.mcp' failed.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined.
Thu Aug 27 23:02:52 2009
----------------------------------------------------------------------
BUILD FAILED
 
It assembles fine for me. All I'm doing is starting a new project, add a new asm file, copying the above into it and pressing F10. At some point it asks absolute/relocatable and I answer relocatable.

Mike.

I even setup the same paths as you have (MPLAB can be funny with some filenames/path lengths) and this is the output,
Debug build of project `C:\Projects\try-2\Try-2.mcp' started.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined.
Fri Aug 28 18:52:15 2009
----------------------------------------------------------------------
Make: The target "C:\Projects\try-2\turn-on-led-02.o" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p12F509 "turn-on-led-02.asm" /l"turn-on-led-02.lst" /e"turn-on-led-02.err" /o"turn-on-led-02.o" /d__DEBUG=1
Make: The target "C:\Projects\try-2\Try-2.cof" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p12F509 "turn-on-led-02.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"Try-2.cof" /M"Try-2.map" /W
MPLINK 4.33, Linker
Copyright (c) 2009 Microchip Technology Inc.
Errors : 0

MP2HEX 4.33, COFF to HEX File Converter
Copyright (c) 2009 Microchip Technology Inc.
Errors : 0

Loaded C:\Projects\try-2\Try-2.cof.
----------------------------------------------------------------------
Debug build of project `C:\Projects\try-2\Try-2.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined.
Fri Aug 28 18:52:20 2009
----------------------------------------------------------------------
BUILD SUCCEEDED
 
I missinformed you guys, I had downloaded/installed MPLab-8.36 (not 8.33) and that was what I was working on. I uninstalled it and installed 8.33 which I had lying around.

I have now successfully assembled from that code. I don't know what the problem was which annoys me but I had previously assembled from the source files provided in the PICKit2 lessons using 8.33 so I figured I'd give that a go. Probably should have tried the lesson source on 8.36 but I'm not going to reinstall to find out.

Two questions:
1) Why bother having tutorials say to add the linker file if it not required, and 2) in my first post I asked if tabs mattered past good looking code when writing source, e.g. two tabs then command, then one tab and parameter?

Thanks to those who replied above
 
The assembler treats tabs and spaces as the same (in programming lingo they're called "white space"). Use whichever you like/gives the appearance you want.
 
Thanks, over the past few weeks I've googled so much on PIC programming it all became a bit of a blur. Somewhere it seemed I saw I saw something about the need to format a certain way but I never saw it mentioned anywhere else. I've played with C and use bash scripting quite a bit so white space is a term I'm familiar with.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top