TODOPIC
Microcontroladores PIC => Todo en microcontroladores PIC => Mensaje iniciado por: tori en 26 de Febrero de 2010, 07:22:02
-
Hola a todos,
Tengo un problemilla al compilar un proyecto con el MPLAB IDE v8.20a. Os cuento un poco: estoy unsando el PIC16F873 y segun voy aumentando el código hay un momento que me salta este error y no se cómo solucionarlo. Creia que era porque me había quedado sin especio en la Program Memory pero al comprobarlo con el compilador parece que no. ¿Alguien me puede decir como solucionarlo? Os copio el mensaje que muestra el compilador. Gracias.
MPLINK 4.30.01, Linker
Copyright (c) 2009 Microchip Technology Inc.
Error - section '.org_3' can not fit the absolute section. Section '.org_3' start=0x00000800, length=0x00000e1c
Errors : 1
Link step failed.
-
Bienvenido tori al foro.
Por lo que dice el error, no es por exceder la cantidad de memoria del PIC, sino que estás paginando mal el programa.
Lo que te está diciendo el error es que la seccción org_3 comienza en 0x800 hasta 0xe1c
Al parecer has indicado mal el comienzo de org 3
-
Lo primero gracias por contestar.
Ahora haber si me aclaro. Según tú, el error es debido a la páginación. Voy a explicar un poko como he estructurado el programa para haber si alguien tiene una solución. Si no estoy mal informado , la Program Memory del PIC16F873 está dividida en 2 páginas. La primera, PAGE 0, va desde 005h hasta 07FFh, y la segunda, PAGE 1, desde la 0800h hasta la 0FFFh. Entonces, gran parte del programa lo tengo ubicado en la PAGE 0, pero todo no me entra, por lo que ciertas subrutinas las he decidido hubicar en la PAGE 1 para tenerlas localizadas y no tener problemas cuando el programa cambie de una página a otra. El problema empieza a surgir cuando el código crece y se empieza a acercar al final de la PAGE 1. Por eso pensaba que el problema venia por la extensión del código, aunque realmente no falla cuando llega a 0FFFh si no antes. De hecho, si compilo el mismo programa diciendole al compilador que es un PIC16F876A, que tiene 4 páginas en vez de 2, el problema parece desaparecer. ¿Alguna sugerencia? Gracias
-
Me guié por lo que decía el error.
Ya descargué el datasheet.
La verdad que se me viene solo una idea en la mente, que hallas elegido mal el dispositivo al crear el proyecto, pero este no es el problema.
Tendrás que esperar que otro usuario te pueda ayudar porque a mi no se me ocurre que puede ser.
-
Gracias de todas formas Leon Pic. Si consigo solucionarlo lo pondré por aquí por si alguien más tiene este problema.
-
Tori,
Con que tipo de proyecto estas trabajando? Absoluto o relocalizable? Y la otra cosa que te consulto es si estas trabajando con un debugger (como el PICkit 2 o similar) porque estos te consumen un poco de memoria flash (más específicamente las ultimas 100h).
Gustavo
-
Hola, yo tuve un problema similar utilizando el PIC16F877A. Cuando ensamblaba mi programa con la versión 8.2 del MPLAB IDE no me aparecía ningún error, sin embargo al cambiar a la versión 8.43 me apareció un error similar "Error - section '.org_2' can not fit the absolute section. Section '.org_2' start=0x00000004, length=0x00000198", en el código declaraba el inicio de la memoria RAM como org 0x020 y posteriormente declaraba el inicio del código como org 0x000, como muestro
list p=16f877a
include "p16f877a.inc"
LIST
; Asignaciones de datos en RAM
org 0x020
msd res 1
lsd res 1
char res 1
-------
-------
; *******************************
; * INICIO DEL PROGRAMA *
; *******************************
org 000h
nop
goto inicio
org 0x004
goto inicio
El problema se solucionó al declarar como datos el área de RAM con la instrucción idata, quedando así
; Asignaciones de datos en RAM
idata 0x020
msd res 1
lsd res 1
char res 1
El problema era que tomaba el 0x020 como inicio de código, no como inicio de datos y al volver a tomar, más abajo, como origen 0x00 pues a partir de la dirección 0x020 encimaba los códigos. dando el Linker el error antes mencionado. el error se quitó al poner la directiva idata
Espero te sirva esta solución que a mi me funcionó.
-
Q tal amigos estoy pasando un programa del pic16f688 al pic 16f628 pero estoy podrido con este error " Error - section '.org_3' can not fit the absolute section. Section '.org_3' start=0x00000004, length=0x00001978 " ya me estoy comensando a desesperar alguien me podria ayudar por fabor el programa es este :
list p=16f628 ; list directive to define processor
#include <P16F628.inc> ; processor specific variable definitions
;__CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT & _DATA_CP_OFF & _LVP_OFF & _MCLRE_ON
__CONFIG _CP_OFF & _CP_OFF & _BODEN_ON & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT & _MCLRE_ON
errorlevel -302
org 0x020
; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
; ***** EEPROM DATA
; EEPROM used to hold static code version information.
; ORG 0x2100 ; data EEPROM address
; de " LED Cube V1.0.2 "
; de " animations 13-04-2009 "
; de " picprojects.org.uk "
; de " (c) 2009 Pete Griffiths "
;***** PROGRAM CONSTANTS
; Timer0 Prescaler 1:8
Ctimer0 equ .8 ; timer0 reload value 2mS (refresh 100Hz)
;Ctimer0 equ .132 ; timer0 reload value 1mS (refresh 200Hz)
; 5 layers x 2mS = 10mS -> 100Hz refresh
; Changing the refresh will affect the hold and second timers in the lc5x5_inth.inc code
;***** VARIABLE DEFINITIONS
cblock 0x20
buffer.draw:.25 ; Drawing buffer
; Drawing buffer and display buffer must start at the same address
; in banks 0/1 as program functions expect them to be offset by 128 bytes
cp.regbase:.4 ; command processor General purpose registers
holdtime ; hold time (GPReg 4) - 30
vox.x ; X axis voxel pointer register (GPReg 5)
vox.y ; Y axis voxel pointer register (GPReg 6)
vox.z ; Z axis voxel pointer register (GPReg 7)
voxel.count ; Used by SET/CLR/INV ALL drawing functions
rotate ; temp variable used to rotate cube in the x-axis
addr.stack.pointer ; instruction pointer stack -35
user.stack.pointer ; current stack pointer address
stack.data.temp ; temp variable holding value to put on stack
instruction ; copy of command last fetched
inst.data ; command data byte
randomH ; Random number hi byte
randomL ; Random number lo byte
mult.mult2 ; Multiplier to scale random number for use
mult.resHi ; Multiplier to scale random number for use
mult.resLo ; Multiplier to scale random number for use
math.op1 ; math operation variable
savex ; Temp save of X,Y,Z registers when draw functions
savey ; use them but they need to be left unchanged on
savez ; function exit
lastone
endc
cblock 0xA0
buffer.disp:.25 ; must be offset from buffer.draw by 128 bytes
addr.stack:.16 ; instruction pointer return address stack
user.stack:.33 ; user software stack
; user stack is 30 levels deep but the Drawing Processor also
; makes use of this stack for temporary storage during
endc ; instruction exectuion so 3 extra bytes are reserved
cblock 0x70
w_temp ; variable used for interrupt context saving (also used in startup code)
status_temp ; variable used for interrupt context saving (also used in startup code)
pclath_temp ; variable used for interrupt context saving
fsr_temp ; variable used for interrupt context saving
flag.bit ; Variable used to hold flag bits
voxel.func ; Variable used to hold voxel mode operations
shift.register ; Temp variable used to shift drawing buffer data to hardware shift registers
layer.select ; Variable holds current layer output drive
shift.count ; Bits shifted counter
hold.timer ; display update hold timer in 10mS intervals
tick ; Count of 10mS periods in 1S
seconds ; Seconds countdown timer
inst.ptr.Lo ; drawing processor instruction pointer Lo byte
inst.ptr.Hi ; drawing processor instruction pointer Hi byte
char.ptr.Lo ; character data address pointer Lo byte
char.ptr.Hi ; character data address pointer Hi byte
endc
; Flag bits
Fcopy.buffer equ 0 ; Set when draw.buffer ready to be transfered to disp.buffer
Fhold.tout equ 1 ; Set when hold delay has completed
Fzero equ 3 ; Flag is set to indicate a value is 0 (zero)
Fcarry EQU 4 ; Flag is set to if add resulted in carry or subtract resulted in borrow
; Voxel function flag bits
Fvoxel.clr equ 0 ; voxel operations will Clear voxels
Fvoxel.set equ 1 ; voxel operations will Set voxels
Fvoxel.inv equ 2 ; voxel operations will Invert voxels
Fcharyz equ 3 ; Character draws in Y plane if set, Z plane if clear
; Port bits on PORTA
controlPort equ PORTA
bit.clk equ 0 ; shift register clock _/
bit.sin equ 1 ; shift register serial in
bit.latch equ 2 ; shift register latch \_
bit.switch equ 4 ; switch / SYNCEXT instruction input
bit.statusLED equ 5 ; status LED (not used in this code release)
; Port bits on PORTB
layerPort equ PORTB
bit.layer1 equ 0 ; LED cube layer drive (Y-axis 0)
bit.layer2 equ 1 ; LED cube layer drive (Y-axis 1)
bit.layer3 equ 2 ; LED cube layer drive (Y-axis 2)
bit.layer4 equ 3 ; LED cube layer drive (Y-axis 3)
bit.layer5 equ 4 ; LED cube layer drive (Y-axis 4)
;**********************************************************************
ORG 0x000 ; reset vector
nop
clrf PCLATH ;
goto reset.init ; go to initialisation code
org 0x004 ; set PC to interrupt vector
#include lc555_inthPCBC.inc ; interrupt handler code (must live here)
#include lc555_draw.inc ; draw functions
#include lc555_dp.inc ; Drawing Processor
#include lc555_chardata.inc ; Character drawing data
#include lc555_reset.inc ; PIC reset initialisation code.
#include lc555_macros.inc ; Display processor instruction definitions
radix dec
program.base.addr ; Drawing Processor user program starts here
; put drawing processor program include files here
#include CubeProgram.inc ; Drawing Processor program include file
;
;#include CubeProgramD.inc ; Drawing Processor program include file
;------------------------------------------------------------------------
END ; directive 'end of program'
helllllllllllppppppppppppppppppppppppppppppppppppppp :-/ :oops: