AN1157 serial bootloader for PIC24

12 Anni 3 Mesi fa #1 da raffaellocos
AN1157 serial bootloader for PIC24 è stato creato da raffaellocos
Salve a tutti

avete già trattato il serial bootloader per il PIC24F, quindi credo che mi possiate aiutare.

Ho scaricato la documentazione dell’AN1157 e ho seguito i seguenti passi, ma come potete immaginare senza buoni risultati.

Il micro che sto usando è un PIC24FJ64GB106.

1. Ho modificato il linker del bootloader
/*
** Linker script for PIC24FJ64GB106
*/

OUTPUT_ARCH("24FJ64GB106")
CRT0_STARTUP(crt0_standard.o)
CRT1_STARTUP(crt1_standard.o)

OPTIONAL(-lpPIC24Fxxx)

/*
** Memory Regions
*/
MEMORY
{
data (a!xr) : ORIGIN = 0x800, LENGTH = 0x4000
reset : ORIGIN = 0x0, LENGTH = 0x4
ivt : ORIGIN = 0x4, LENGTH = 0xFC
aivt : ORIGIN = 0x104, LENGTH = 0xFC
program (xr) : ORIGIN = 0x400, LENGTH = 0x800 /*start & length of BL*/
config4 : ORIGIN = 0xABF8, LENGTH = 0x2
config3 : ORIGIN = 0xABFA, LENGTH = 0x2
config2 : ORIGIN = 0xABFC, LENGTH = 0x2
config1 : ORIGIN = 0xABFE, LENGTH = 0x2
}

__CONFIG3 = 0xABFA;
__CONFIG2 = 0xABFC;
__CONFIG1 = 0xABFE;

__NO_HANDLES = 1; /* Suppress handles on this device */

__IVT_BASE = 0x4;
__AIVT_BASE = 0x104;
__DATA_BASE = 0x800;
__CODE_BASE = 0x400; /* starting location of bootloader */

2. ho modificato il file config nel bootloader adattandolo al micro che sto usando

3. ho modificato il linker dell’applicativo
/*
** Linker script outline for PIC24F bootloader user application for PIC24FJ64GB106
*/

OUTPUT_ARCH("24FJ64GB106")
CRT0_STARTUP(crt0_standard.o)
CRT1_STARTUP(crt1_standard.o)

OPTIONAL(-lpPIC24Fxxx)

/*
** Memory Regions
*/
MEMORY
{
data (a!xr) : ORIGIN = 0x800, LENGTH = 0x4000
reset : ORIGIN = 0x0, LENGTH = 0x4
ivt : ORIGIN = 0x4, LENGTH = 0xFC
aivt : ORIGIN = 0x104, LENGTH = 0xFC

/*Starting location and length of user program */
program (xr) : ORIGIN = 0xC00, LENGTH = 0x9FFD
config4 : ORIGIN = 0xABF8, LENGTH = 0x2
config3 : ORIGIN = 0xABFA, LENGTH = 0x2
config2 : ORIGIN = 0xABFC, LENGTH = 0x2
config1 : ORIGIN = 0xABFE, LENGTH = 0x2
/*
** Section for storing user app reset vector and BL time out value. This
** section must be defined to allow use of the two location at address
** 0x100 (the bootloader's default setting).
** This is not needed if these values are placed in addresses in
** the "program" section.
*/
BLreset : ORIGIN = 0x100, LENGTH = 0x4
}


__CONFIG3 = 0xABFA;
__CONFIG2 = 0xABFC;
__CONFIG1 = 0xABFE;

__NO_HANDLES = 1; /* Suppress handles on this device */

__IVT_BASE = 0x4;
__AIVT_BASE = 0x104;
__DATA_BASE = 0x800;
__CODE_BASE = 0xC00; /* starting location of user application */

/*
** ==================== Section Map ======================
*/
SECTIONS
{
/*
** ========== Program Memory ==========
*/


/*
** Reset Instruction
*/
.reset :
{
SHORT(ABSOLUTE(__reset));
SHORT(0x04);
SHORT((ABSOLUTE(__reset) >> 16) & 0x7F);
SHORT(0);
} >reset


/*
** Interrupt Vector Tables
**
** The primary and alternate tables are loaded
** here, between sections .reset and .text.
** Vector table source code appears below.
*/

/*
** Outputs the BLreset section into the hex file at the area specified in
** memory map above. This is where the bootloader, by default, stores its
** user reset and entry mode timer. This is not needed if these values
** are placed in addresses in the "program" section.
*/
.BLreset :
{
*(.BLreset);
} >BLreset


4. Ho compilato il file e lo ho esportato con indirizzo di partenza 0xc00

5.Ho programmato il micro con il bootloader. Il programma P24QP riconosce il target, programmo il micro
con l’applicativo, ma non parte (dovrei vedere un led lampeggiare).
I miei dubbi sono:

1. Ho effettuato tutti i passi o devo rimappare in qualche modo anche la ISR ?( nel progetto di esempio viene effettuato un remapping della isr via goto, ma se nono ho capito male è un errore)

2. Gli indirizzi di remapping nei linker sono esatti??
Ho trovato delle incongruenze nei file gld degli esempi.
Nel linker file dell’applicativo l’indirizzo di partenza è
program (xr) : ORIGIN = 0xC00, LENGTH = 0x9FFD
program (xr) : ORIGIN = 0x14C0, LENGTH = 0x96E8




Grazie

Raffaello

Si prega Accedi o Crea un account a partecipare alla conversazione.

  • raffaellocos
  • New Member
  • New Member
Di più
Moderatori: Mauro LaurentiMatteo Garia

Registrati al sito

Accedi a tutte le risorse e articoli non visibili pubblicamente, puoi registrarti con pochi passi.

Registrati al sito LaurTec.

Login