Vai al contenuto
PLC Forum


Pic Error Nel Linker - '.udata_data.o' can not fit the section


Il Novizio

Messaggi consigliati

Ciao a tutti. Ci risiamo con un altro problema.

Uso MPLAB IDE con compilatore MCC18. device pic18f452. Ma il problema penso sia comune anche ad altri compilatori.

Il messaggio di errore è il seguente:

//questi sono di poca importanza----------------------------------------------

Executing: "C:\mcc18\bin\mcc18.exe" -p=18F452 "data.c" -fo="data.o" /i"C:\Programmi\MPLAB IDE\Tesi\v 0.2" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-

Executing: "C:\mcc18\bin\mplink.exe" /l"C:\mcc18\lib" /k"C:\mcc18\lkr" "C:\mcc18\lkr\18f452-bootloader.lkr" "C:\Programmi\MPLAB IDE\Tesi\v 0.2\data.o" /o"datalogger v0.2.cof"

//eccolo qui--------------------------------------------------

MPLINK 3.70.02, Linker

Copyright © 2004 Microchip Technology Inc.

Error - section '.udata_data.o' can not fit the section. Section '.udata_data.o' length=0x00000230

Errors : 1

Bene, me ne vado sul forum microchip e trovo un altro tizio che aveva riscontrato proprio questo error.

A quanto ho capito il problema è dovuto al fatto che io dichiaro nel mio programma un buffer da 512 posizioni: char sectorbuff[512]; (per la cronaca il buffer da cui scrivo o leggo nel sector di una Compactflash)

e siccome la RAM del pic18f452 in totale è di 1532 bytes, ma è divisa in banchi da 256 bytes l'uno, il linker non sa dove ficcare sto buffer.

Infatti se provo ad abbassare il numero di bytes nel buffer a un duecentinaio :D, l'error se ne va.

Al tizio che aveva lo stesso problema mio sul forum microchip rispondono in 2.

1° risposta------------------

You have to fit a section in your linker big enough to contains your structure (nel mio caso non una structure ma un buffer).... Then You have to declare the structure in this section using the pragma command...

2° risposta------------------

The basic problem is that you're out of SRAM: that's all the linker messages are saying.

This might not mean that you've actually run out: it migth be just that you're using memory in such a way that the compiler tries to make some of your variables cross the boundary of a 256 byte SRAM page. The answer is either:

(a) To do what Franck (ossia la 1° risposta) said, and align your variables carefully on specific pages

(B) Tinker with the linker script to make bigger SRAM sections

You need to look carefully at the SRAM memory map your program is using, to work out where the problem is.

-------------------------------

Ok. Vi allego anche quello che c'è scritto nel linker:"p18f452.lkr" per quanto riguarda le page della ram.

ACCESSBANK NAME=accessram START=0x0 END=0x7F

DATABANK NAME=gpr0 START=0x80 END=0xFF

DATABANK NAME=gpr1 START=0x100 END=0x1FF

DATABANK NAME=gpr2 START=0x200 END=0x2FF

DATABANK NAME=gpr3 START=0x300 END=0x3FF

DATABANK NAME=gpr4 START=0x400 END=0x4FF

DATABANK NAME=gpr5 START=0x500 END=0x5FF

ACCESSBANK NAME=accesssfr START=0xF80 END=0xFFF PROTECTED

Bene, e ora la domanda.

Siccome sono un minchia :lol: alle prima armi, c'è qualcuno che mi spiega con paroline semplici quello che i due gentili signori hanno consigliato di fare al mio collega con lo stesso problema.

Vi ringrazio come sempre tutti, e mi scuso anche del fatto che questo msg è ancora più lungo dei precedenti

Link al commento
Condividi su altri siti


Forse sono stato un po' precipitoso nello scrivere sto msg, o forse no.

Ci sta che abbia risolto così:

nel linker ho scritto:

ACCESSBANK NAME=accessram START=0x0 END=0x7F

DATABANK NAME=gpr0 START=0x80 END=0xFF

DATABANK NAME=gpr1 START=0x100 END=0x2FF <------

DATABANK NAME=gpr2 START=0x300 END=0x300 <------

DATABANK NAME=gpr3 START=0x301 END=0x3FF

DATABANK NAME=gpr4 START=0x400 END=0x4FF

DATABANK NAME=gpr5 START=0x500 END=0x5FF

ACCESSBANK NAME=accesssfr START=0xF80 END=0xFFF PROTECTED

Ho fatto diventare databank gpr1 di 512 bytes, a spese di gpr2.

Poi nel main ho dichiarato così il buffer:

#pragma udata buffer_section=0x100 <---parte dove inizia gpr1

char sectorbuff[512];

#pragma udata

In questo modo non mi da più error nel linker e dice: BUILD SUCCEEDED: Thu Oct 21 21:51:09 2004

Alè :D .

Ok. Ma siccome rimango un minchia :lol: alle prime armi, preferisco lasciare il msg con la domanda iniziale solo un po' cambiata:

Ho interpretato bene i consigli dei due tizi che rispondevano prima sul forum microchip, o ho fatto una gran caxxata.? :D

Grazie ancora e see you.

Link al commento
Condividi su altri siti

Hai interpretato correttamente quello che ha detto il primo tizio. Cosi facendo hai forzato al linker di mettere il tuo buffer in quella posizione. e gli hai creato spazio. Al linker non piace che uno stesso oggetto sia aperto in pagine diverse. E' scritto da qualche parte nella user guide del compilatore.

Ciao!

Link al commento
Condividi su altri siti

Crea un account o accedi per commentare

Devi essere un utente per poter lasciare un commento

Crea un account

Registrati per un nuovo account nella nostra comunità. è facile!

Registra un nuovo account

Accedi

Hai già un account? Accedi qui.

Accedi ora
×
×
  • Crea nuovo/a...