Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

Pierin PIc18 e interrupt vector

Raccolta di codici sorgenti

Moderatore: Foto UtentePaolino

0
voti

[21] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto Utentericello9 » 16 set 2013, 22:34

Ad ogni modo se fai un riassunto sull'uso di questi due vettori, si può vedere se un ottimizzazione è possibile...

Questo è un esempio del font 8x5.h:
Codice: Seleziona tutto
#ifndef STANDARD_FONT
#define STANDARD_FONT
#else
#error Multiple standard font defined!
#endif

#define FONT_WIDTH   5
#define FONT_START   32
#define FONT_END   127
// every char is defined from left to right
// every column is defined from MSB (bottom) to LSB (top)
#pragma idata OurVectSec
volatile char ASCII2[765] = {        //numeri di caratteri reali 680
0x00, 0x00, 0x00, 0x00, 0x00, // 20 [SPACE]
0x00, 0x00, 0x5f, 0x00, 0x00, // 21 !
0x00, 0x07, 0x00, 0x07, 0x00, // 22 "
0x14, 0x7f, 0x14, 0x7f, 0x14, // 23 #
0x24, 0x2a, 0x7f, 0x2a, 0x12, // 24 $
0x23, 0x13, 0x08, 0x64, 0x62, // 25 %
0x36, 0x49, 0x55, 0x22, 0x50, // 26 &
0x00, 0x05, 0x03, 0x00, 0x00, // 27 '
0x00, 0x1c, 0x22, 0x41, 0x00, // 28 (
0x00, 0x41, 0x22, 0x1c, 0x00, // 29 )
0x14, 0x08, 0x3e, 0x08, 0x14, // 2a *
0x08, 0x08, 0x3e, 0x08, 0x08, // 2b +
0x00, 0x50, 0x30, 0x00, 0x00, // 2c ,
0x08, 0x08, 0x08, 0x08, 0x08, // 2d -
0x00, 0x60, 0x60, 0x00, 0x00, // 2e .
0x20, 0x10, 0x08, 0x04, 0x02, // 2f /
0x3e, 0x51, 0x49, 0x45, 0x3e, // 30 0
0x00, 0x42, 0x7f, 0x40, 0x00, // 31 1
0x42, 0x61, 0x51, 0x49, 0x46, // 32 2
0x21, 0x41, 0x45, 0x4b, 0x31, // 33 3
0x18, 0x14, 0x12, 0x7f, 0x10, // 34 4
0x27, 0x45, 0x45, 0x45, 0x39, // 35 5
0x3c, 0x4a, 0x49, 0x49, 0x30, // 36 6
0x01, 0x71, 0x09, 0x05, 0x03, // 37 7
0x36, 0x49, 0x49, 0x49, 0x36, // 38 8
0x06, 0x49, 0x49, 0x29, 0x1e, // 39 9
0x00, 0x36, 0x36, 0x00, 0x00, // 3a :
0x00, 0x56, 0x36, 0x00, 0x00, // 3b ;
0x08, 0x14, 0x22, 0x41, 0x00, // 3c <
0x14, 0x14, 0x14, 0x14, 0x14, // 3d =
0x00, 0x41, 0x22, 0x14, 0x08, // 3e >
0x02, 0x01, 0x51, 0x09, 0x06, // 3f ?
0x32, 0x49, 0x79, 0x41, 0x3e, // 40 @
0x7e, 0x11, 0x11, 0x11, 0x7e, // 41 A
0x7f, 0x49, 0x49, 0x49, 0x36, // 42 B
0x3e, 0x41, 0x41, 0x41, 0x22, // 43 C
0x7f, 0x41, 0x41, 0x22, 0x1c, // 44 D
0x7f, 0x49, 0x49, 0x49, 0x41, // 45 E
0x7f, 0x09, 0x09, 0x09, 0x01, // 46 F
0x3e, 0x41, 0x49, 0x49, 0x7a, // 47 G
0x7f, 0x08, 0x08, 0x08, 0x7f, // 48 H
0x00, 0x41, 0x7f, 0x41, 0x00, // 49 I
0x20, 0x40, 0x41, 0x3f, 0x01, // 4a J
0x7f, 0x08, 0x14, 0x22, 0x41, // 4b K
0x7f, 0x40, 0x40, 0x40, 0x40, // 4c L
0x7f, 0x02, 0x0c, 0x02, 0x7f, // 4d M
0x7f, 0x04, 0x08, 0x10, 0x7f, // 4e N
0x3e, 0x41, 0x41, 0x41, 0x3e, // 4f O
0x7f, 0x09, 0x09, 0x09, 0x06, // 50 P
0x3e, 0x41, 0x51, 0x21, 0x5e, // 51 Q
0x7f, 0x09, 0x19, 0x29, 0x46, // 52 R
0x46, 0x49, 0x49, 0x49, 0x31, // 53 S
0x01, 0x01, 0x7f, 0x01, 0x01, // 54 T
0x3f, 0x40, 0x40, 0x40, 0x3f, // 55 U
0x1f, 0x20, 0x40, 0x20, 0x1f, // 56 V
0x3f, 0x40, 0x38, 0x40, 0x3f, // 57 W
0x63, 0x14, 0x08, 0x14, 0x63, // 58 X
0x07, 0x08, 0x70, 0x08, 0x07, // 59 Y
0x61, 0x51, 0x49, 0x45, 0x43, // 5a Z
0x00, 0x7f, 0x41, 0x41, 0x00, // 5b [
0x06, 0x09, 0x09, 0x06, 0x00, // 5c [DEGREE]
0x00, 0x41, 0x41, 0x7f, 0x00, // 5d ]
0x04, 0x02, 0x01, 0x02, 0x04, // 5e ^
0x40, 0x40, 0x40, 0x40, 0x40, // 5f _
0x00, 0x01, 0x02, 0x04, 0x00, // 60 `
0x20, 0x54, 0x54, 0x54, 0x78, // 61 a
0x7f, 0x48, 0x44, 0x44, 0x38, // 62 b
0x38, 0x44, 0x44, 0x44, 0x20, // 63 c
0x38, 0x44, 0x44, 0x48, 0x7f, // 64 d
0x38, 0x54, 0x54, 0x54, 0x18, // 65 e
0x08, 0x7e, 0x09, 0x01, 0x02, // 66 f
0x0c, 0x52, 0x52, 0x52, 0x3e, // 67 g
0x7f, 0x08, 0x04, 0x04, 0x78, // 68 h
0x00, 0x44, 0x7d, 0x40, 0x00, // 69 i
0x20, 0x40, 0x44, 0x3d, 0x00, // 6a j
0x7f, 0x10, 0x28, 0x44, 0x00, // 6b k
0x00, 0x41, 0x7f, 0x40, 0x00, // 6c l
0x7c, 0x04, 0x18, 0x04, 0x78, // 6d m
0x7c, 0x08, 0x04, 0x04, 0x78, // 6e n
0x38, 0x44, 0x44, 0x44, 0x38, // 6f o
0x7c, 0x14, 0x14, 0x14, 0x08, // 70 p
0x08, 0x14, 0x14, 0x18, 0x7c, // 71 q
0x7c, 0x08, 0x04, 0x04, 0x08, // 72 r
0x48, 0x54, 0x54, 0x54, 0x20, // 73 s
0x04, 0x3f, 0x44, 0x40, 0x20, // 74 t
0x3c, 0x40, 0x40, 0x20, 0x7c, // 75 u
0x1c, 0x20, 0x40, 0x20, 0x1c, // 76 v
0x3c, 0x40, 0x30, 0x40, 0x3c, // 77 w
0x44, 0x28, 0x10, 0x28, 0x44, // 78 x
0x0c, 0x50, 0x50, 0x50, 0x3c, // 79 y
0x44, 0x64, 0x54, 0x4c, 0x44, // 7a z
0x00, 0x08, 0x36, 0x41, 0x00, // 7b {
0x00, 0x00, 0x7f, 0x00, 0x00, // 7c |
0x00, 0x41, 0x36, 0x08, 0x00, // 7d }
0x08, 0x1C, 0x2A, 0x08, 0x08, // 7e [LEFT ARROW]
0x08, 0x08, 0x2A, 0x1C, 0x08,  // 7f [RIGHT ARROW]
0x7f, 0x08, 0x08, 0x08, 0x7f, // 48 H
0x00, 0x41, 0x7f, 0x41, 0x00, // 49 I
0x20, 0x40, 0x41, 0x3f, 0x01, // 4a J
0x7f, 0x08, 0x14, 0x22, 0x41, // 4b K
0x7f, 0x40, 0x40, 0x40, 0x40, // 4c L
0x7f, 0x02, 0x0c, 0x02, 0x7f, // 4d M
0x7f, 0x04, 0x08, 0x10, 0x7f, // 4e N
0x3e, 0x41, 0x41, 0x41, 0x3e, // 4f O
0x7f, 0x09, 0x09, 0x09, 0x06, // 50 P
0x3e, 0x41, 0x51, 0x21, 0x5e, // 51 Q
0x7f, 0x09, 0x19, 0x29, 0x46, // 52 R
0x46, 0x49, 0x49, 0x49, 0x31, // 53 S
0x01, 0x01, 0x7f, 0x01, 0x01, // 54 T
0x3f, 0x40, 0x40, 0x40, 0x3f, // 55 U
0x1f, 0x20, 0x40, 0x20, 0x1f, // 56 V
0x3f, 0x40, 0x38, 0x40, 0x3f, // 57 W
0x63, 0x14, 0x08, 0x14, 0x63, // 58 X
0x07, 0x08, 0x70, 0x08, 0x07, // 59 Y
0x61, 0x51, 0x49, 0x45, 0x43, // 5a Z
0x00, 0x7f, 0x41, 0x41, 0x00, // 5b [
0x06, 0x09, 0x09, 0x06, 0x00, // 5c [DEGREE]
0x00, 0x41, 0x41, 0x7f, 0x00, // 5d ]
0x04, 0x02, 0x01, 0x02, 0x04, // 5e ^
0x40, 0x40, 0x40, 0x40, 0x40, // 5f _
0x00, 0x01, 0x02, 0x04, 0x00, // 60 `
0x20, 0x54, 0x54, 0x54, 0x78, // 61 a
0x7f, 0x48, 0x44, 0x44, 0x38, // 62 b
0x38, 0x44, 0x44, 0x44, 0x20, // 63 c
0x38, 0x44, 0x44, 0x48, 0x7f, // 64 d
0x38, 0x54, 0x54, 0x54, 0x18, // 65 e
0x08, 0x7e, 0x09, 0x01, 0x02, // 66 f
0x0c, 0x52, 0x52, 0x52, 0x3e, // 67 g
0x7f, 0x08, 0x04, 0x04, 0x78, // 68 h
0x00, 0x44, 0x7d, 0x40, 0x00, // 69 i
0x20, 0x40, 0x44, 0x3d, 0x00, // 6a j
0x7f, 0x10, 0x28, 0x44, 0x00, // 6b k
0x00, 0x41, 0x7f, 0x40, 0x00, // 6c l
0x7c, 0x04, 0x18, 0x04, 0x78, // 6d m
0x7c, 0x08, 0x04, 0x04, 0x78, // 6e n
};
#pragma idata


E questa è la funzione principale che identifica il caratte:
Codice: Seleziona tutto
// print a char from char FONT_START
void oled_putch(unsigned char c)
   {
    char i;
   #if defined USE_BIG_FONT
   // use oled_putbigch if big font selected
   if (oled_font==FONT_BIG)
      {
      oled_putbigch(c);
      }
   else
      {
   #endif
      unsigned int u; // char index in the array
      // ascii chars out of limits becomes '?'
      if ((c<FONT_START) || (c>FONT_END))
           
         {
         c='?';
         }
      u=c-FONT_START;
      u*=FONT_WIDTH;
             
      for (i=0; i<FONT_WIDTH; i++)
         {
         if (oled_inverted)
            {
            _oled_send(~(ASCII2[u+i]), OLED_DATA);
            }
         else
            {
            _oled_send(ASCII2[u+i], OLED_DATA);
            }
         }
             
      // adding a 0-page to the right if font is 5 pixel, since
      // I've not included a space in this font
      #if FONT_WIDTH==5
         _oled_send(0xFF*oled_inverted, OLED_DATA);
         curX++;
      #endif
      curX+=FONT_WIDTH;
      if (curX>(DISPLAY_WIDTH-1))
         {
         curX=curX-DISPLAY_WIDTH;
         curY++;
         if (curY>(DISPLAY_HEIGHT-1))
            {
            curY=0;
            }
         }
      #if defined USE_BIG_FONT
      } // standard font
      #endif
   }

Da quello che capisco quando utilizzo la funzione oled_putch(unsigned char c), esegue queste operazioni:
u=c-FONT_START; dove "c" è l'equivalente valore decimale del carattere da stampare,
Codice: Seleziona tutto
for (i=0; i<FONT_WIDTH; i++)
         {
         if (oled_inverted)
            {
            _oled_send(~(ASCII2[u+i]), OLED_DATA);
            }
         else
            {
            _oled_send(ASCII2[u+i], OLED_DATA);
            }
         }

poi invia 5 bites presi dall'arrary ASCII2 con l'utilizzo di un puntatore di valore pari a u+i.
é corretta la mia interpretazione?

Hanno bisogno di coesistere?

Direi di si, visto che devo usare entrambi i font contemporaneamente.

Possono essere serializzati (il loro contenuto può essere creato/letto/esaminato byte per byte)?
Se no, possono essere spezzati in sotto-vettori riutilizzabili?

Penso di si, anche se non riesco a comprendere al 100% il funzionamento della libreria.

Hai progetti sulla RAM restante?

Vorrei integrare il display oled su un vecchio progetto di un antifurto con gps e modulo gsm, quindi dovrei provare ad unire i software e vedere se la memoria ram è sufficente.

Io ho usato con piacere QUESTA RAM SPI
Costa pochissimo ed hai 32KB a disposizione e la puoi far funzionare alla massima velocità visto che accetta un clock di 20 MHz.

Ho visto che microchip fornisce delle librerie gia pronte per l'uso di questa ram spi.
Quello che non capisco e se, una volta istallata, diventa un tutt'uno con la ram interna del PIC o la gestione è più similare ad una eprom esterna?
Nel mio esempio dovrei dichiarare una array di 500 bytes, come faccio a gestirlo con la RAM esterna?

Grazie
Marcello
Avatar utente
Foto Utentericello9
195 1 3 7
Stabilizzato
Stabilizzato
 
Messaggi: 360
Iscritto il: 16 mar 2009, 0:13

0
voti

[22] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteShockwaver » 16 set 2013, 23:27

Compatibilmente con una giornata infernale domani proverò a dare un'occhiata alle librerie che hai postato. Per oggi sono fuso..
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

0
voti

[23] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteShockwaver » 17 set 2013, 10:08

No, direi che non c'è tanto spazio per l'ottimizzazione su questi 2 vettori (a meno di cambiare radicalmente le routine e fare un lavoro obrobrioso con le #define per i singoli caratteri).

La soluzione, nel caso in cui la ram non ti basti, rimane quella proposta da Foto UtenteTardoFreak.

Con un bus PMP e il giusto compilatore, ci sono delle tecniche per allocare e leggere le variabili su memoria esterna come fosse un'estensione della RAM interna del microcontrollore. Negli altri casi, sì, devi gestirla come si fa di consueto per i bus I2C o SPI.

Ti posto un link ad una AN della microchip che fa al caso tuo.
Using C18/HI-TECH C Compiler to Interface Serial SRAM Devices to PIC16F/PIC18F Microcontrollers

O_/
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

1
voti

[24] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto Utentec1b8 » 17 set 2013, 10:23

Scusate, la mia potrebbe essere una cavolata, ma quando penso a font penso a dati "statici", quindi perché non salvarli in FLASH anzichè in RAM?
Non so se le librerie te lo consentano, ma mi sembra la soluzione più logica per dati che non cambiano nel tempo...
Fabio
Avatar utente
Foto Utentec1b8
3.595 3 8 13
G.Master EY
G.Master EY
 
Messaggi: 1770
Iscritto il: 15 gen 2009, 15:23

0
voti

[25] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteShockwaver » 17 set 2013, 10:25

Altro che cavolata! :lol:
Con un
Codice: Seleziona tutto
const
salvi capre e cavoli :lol:
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

0
voti

[26] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteTardoFreak » 17 set 2013, 10:27

Non esattamente, ma
Codice: Seleziona tutto
const rom

Il C18 è un po' diverso.
Tra l' altro deve essere preceduta dalla direttiva #pragma code che lo istruisce ad allocare la costante in FLASH.
"La follia sta nel fare sempre la stessa cosa aspettandosi risultati diversi".
"Parla soltanto quando sei sicuro che quello che dirai è più bello del silenzio".
Rispondere è cortesia, ma lasciare l'ultima parola ai cretini è arte.
Avatar utente
Foto UtenteTardoFreak
73,9k 8 12 13
-EY Legend-
-EY Legend-
 
Messaggi: 15754
Iscritto il: 16 dic 2009, 11:10
Località: Torino - 3° pianeta del Sistema Solare

0
voti

[27] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteShockwaver » 17 set 2013, 10:32

Io userei la
Codice: Seleziona tutto
#pragma romdata
;-)
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

0
voti

[28] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteTardoFreak » 17 set 2013, 10:34

Anche, che io sappia cambia solo il segmento ma non sono molto ferrato con il C18.
Quindi sarebbe meglio verificare.
"La follia sta nel fare sempre la stessa cosa aspettandosi risultati diversi".
"Parla soltanto quando sei sicuro che quello che dirai è più bello del silenzio".
Rispondere è cortesia, ma lasciare l'ultima parola ai cretini è arte.
Avatar utente
Foto UtenteTardoFreak
73,9k 8 12 13
-EY Legend-
-EY Legend-
 
Messaggi: 15754
Iscritto il: 16 dic 2009, 11:10
Località: Torino - 3° pianeta del Sistema Solare

0
voti

[29] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteShockwaver » 17 set 2013, 10:43

Sinceramente ho dovuto controllare perché non ci avevo mai sbattuto il naso, ma da quello che appare sulla ide, solo la
Codice: Seleziona tutto
#pragma romdata mySect=[myAddress]
piazza la variabile all'indirizzo specificato.

#pragma code risulta essere solo per il codice, la posizione in flash della variabile qui la decide il linker.

Ora vediamo di fare una cosa simpatica con il linker script..
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

0
voti

[30] Re: Pierin PIc18 e interrupt vector

Messaggioda Foto UtenteShockwaver » 17 set 2013, 11:46

Ok, qui c'è il linker script:
Codice: Seleziona tutto
    // File: 18f47j53_g.lkr
    // Generic linker script for the PIC18F47J53 processor

    #DEFINE _CODEEND _DEBUGCODESTART - 1
    #DEFINE _CEND _CODEEND + _DEBUGCODELEN
    #DEFINE _DATAEND _DEBUGDATASTART - 1
    #DEFINE _DEND _DATAEND + _DEBUGDATALEN

    LIBPATH .

    #IFDEF _CRUNTIME
      #IFDEF _EXTENDEDMODE
        FILES c018i_e.o
        FILES clib_e.lib
        FILES p18f47j53_e.lib

      #ELSE
        FILES c018i.o
        FILES clib.lib
        FILES p18f47j53.lib
      #FI

    #FI

    #IFDEF _DEBUGCODESTART
      CODEPAGE   NAME=bootloader START=0x0              END=0xFFF           PROTECTED
      CODEPAGE   NAME=vectors    START=0x1000           END=0x1029          PROTECTED
      CODEPAGE   NAME=page       START=0x102A           END=_CODEEND-0x500            //Riservo 0x500 bytes di allocazione per i due vettori
      CODEPAGE   NAME=ROMvars    START=_CODEEND-0x499   END=_CODEEND        PROTECTED //... e li colloco protected prima della memoria per il debug
      CODEPAGE   NAME=debug      START=_DEBUGCODESTART  END=_CEND        PROTECTED
    #ELSE
      CODEPAGE   NAME=bootloader START=0x0            END=0xFFF          PROTECTED
      CODEPAGE   NAME=vectors    START=0x1000         END=0x1029         PROTECTED
      CODEPAGE   NAME=page       START=0x102A         END=0x1FAF7
      CODEPAGE   NAME=ROMvars    START=0x1FAF8        END=0x1FFF7        PROTECTED    //Come sopra, ma qui non ho il debug, più lineare.
    #FI

    CODEPAGE   NAME=config     START=0x1FFF8           END=0x1FFFF        PROTECTED
    CODEPAGE   NAME=devid      START=0x3FFFFE          END=0x3FFFFF       PROTECTED

    #IFDEF _EXTENDEDMODE
      DATABANK   NAME=gpre       START=0x0               END=0x5F
    #ELSE
      ACCESSBANK NAME=accessram  START=0x0               END=0x5F
    #FI

    DATABANK   NAME=gpr0       START=0x60              END=0xFF
    DATABANK   NAME=gpr1       START=0x100             END=0x1FF
    DATABANK   NAME=gpr2       START=0x200             END=0x2FF
    DATABANK   NAME=OurmVectSec      START=0x300             END=0x4FF   PROTECTED
    //DATABANK   NAME=gpr4       START=0x400             END=0x4FF
    DATABANK   NAME=gpr5       START=0x500             END=0x5FF
    DATABANK   NAME=gpr6       START=0x600             END=0x6FF
    DATABANK   NAME=OurVectSec       START=0x700       END=0x7FF    PROTECTED
    //DATABANK   NAME=gpr7       START=0x700           END=0x7FF
    //DATABANK   NAME=gpr8       START=0x800           END=0x8FF
    //DATABANK   NAME=gpr9       START=0x900             END=0x9FF
    DATABANK   NAME=gpr10      START=0xA00             END=0xAFF
    DATABANK   NAME=gpr11      START=0xB00             END=0xBFF

    #IFDEF _DEBUGDATASTART
      DATABANK   NAME=gpr12      START=0xC00             END=_DATAEND
      DATABANK   NAME=dbgspr     START=_DEBUGDATASTART   END=_DEND           PROTECTED
    #ELSE //no debug
      DATABANK   NAME=gpr12      START=0xC00             END=0xCFF
    #FI

    DATABANK   NAME=gpr13      START=0xD00             END=0xDFF
    DATABANK   NAME=gpr14      START=0xE00             END=0xEAF
    DATABANK   NAME=sfr14      START=0xEB0             END=0xEFF          PROTECTED
    DATABANK   NAME=sfr15      START=0xF00             END=0xF5F          PROTECTED
    ACCESSBANK NAME=accesssfr  START=0xF60             END=0xFFF          PROTECTED

    SECTION    NAME=USB_VARS        RAM=gpr10
    SECTION    NAME=OurVectSec      RAM=OurVectSec
    SECTION    NAME=OurmVectSec     RAM=OurmVectSec

    SECTION    NAME=MyROM           ROM=ROMvars //Per comodità mi definisco una sezione stavolta che punta alla memoria ROM

    #IFDEF _CRUNTIME
      SECTION    NAME=CONFIG     ROM=config
      #IFDEF _DEBUGDATASTART
        STACK SIZE=0x100 RAM=gpr11
      #ELSE
        STACK SIZE=0x100 RAM=gpr12
      #FI
    #FI

Le righe con i commenti in ita sono le aggiunte.

Per l'indirizzamento delle variabili in quello spazio, riporto un esempio:
Codice: Seleziona tutto
#pragma romdata MyROM
    const rom char Font1[700];
    const rom char Font2[500];
#pragma romdata

o, equivalentemente (tanto il linker tiene traccia di ciò che ha già impegnato)
Codice: Seleziona tutto
#pragma romdata MyROM
    const rom char Font1[700];
#pragma romdata
.
.
.
.
#pragma romdata MyROM
    const rom char Font2[500];
#pragma romdata
Anyone who has never made a mistake has never tried anything new
Two things are infinite: universe and human stupidity, and I'm not sure about the former
You did not really understand something unless you can explain it to your grandmother
A. Einstein
Avatar utente
Foto UtenteShockwaver
770 1 5 11
Expert
Expert
 
Messaggi: 859
Iscritto il: 3 mar 2010, 18:56

PrecedenteProssimo

Torna a Firmware e programmazione

Chi c’è in linea

Visitano il forum: Nessuno e 17 ospiti