Forum: Mikrocontroller und Digitale Elektronik Lernpaket PIC Programm wird in den Bootloaderbersich geladen


von reila (Gast)


Lesenswert?

Hallo,

habe ein Problem beim Lernpaket PIC Microcontroller. Der Hex-File wird 
immer in den Bootloader-Bereich geladen. Wahrscheinlich würde der 
überschrieben, wenn ich "write device" anklicken würde. Wie kann man die 
Absolutadresse zuweisen. Beim Compilieren von Beispielen von der CD wird 
der Hax-File auf 400h geladen, wie es sein sollte. Habe den Beispiel- 
Sourcecode schon kopiert und übersetzt und das Problem zeigt sich 
ebenso.

Hat jemand eine Idee?

Gruß reila

von John B. (johnbauer)


Lesenswert?

Hallo Reila,
ich kenne das Lernpaket PIC Microcontroller nicht.
Aber die AN1310 von Microchip sollte Dir weiterhelfen.
http://ww1.microchip.com/downloads/en/AppNotes/01310a.pdf

Beispiel 3:
1
// Prevent application code from being written into FLASH memory space needed for
2
// the Bootloader firmware at addresses 0 through 3FFh.
3
4
#pragma romdata BootloaderProgramMemorySpace = 0x6 
5
const rom char bootloaderProgramMemorySpace[0x400 - 0x6]; 
6
7
// The routine _startup() is defined in the C18 startup code (usually c018i.c) and 
8
// is usually the first code to be called by a GOTO at the normal reset vector of 0.
9
10
extern void _startup(void); 
11
12
// Since the bootloader isn't going to write the normal reset vector at 0, we have 
13
// to generate our own remapped reset vector at the address specified in the 
14
// bootloader firmware.
15
16
#pragma code AppVector = 0x400 
17
void AppVector(void) 
18
{ 
19
    _asm GOTO _startup _endasm 
20
} 
21
22
// For PIC18 devices the high priority interrupt vector is normally positioned at 
23
// address 0008h, but the bootloader resides there. Therefore, the bootloader's 
24
// interrupt vector code is set up to branch to our code at 0408h.
25
26
#pragma code AppHighIntVector = 0x408
27
void AppHighIntVector(void)
28
{
29
    _asm GOTO high_isr _endasm                                   // branch to the high_isr() 
30
                                                                 // function to handle priority
31
                                                                 // interrupts.
32
} 
33
#pragma code AppLowIntVector = 0x418
34
void low_vector(void)
35
{ 
36
    _asm GOTO low_isr _endasm                                    // branch to the low_isr() 
37
                                                                 // function to handle low
38
                                                                 // priority interrupts.
39
40
} 
41
#pragma code                                                     // return to the default 
42
                                                                 // code section

Gruß
John

von reila (Gast)


Lesenswert?

Hallo johnbauer,

besten Dank für die Antwort. Problem gelöst.
Danke nochmal.

Gruß reila

von Andi (Gast)


Lesenswert?

Hallo "reila" ich habe das selbe Problem

""Hallo,

habe ein Problem beim Lernpaket PIC Microcontroller. Der Hex-File wird
immer in den Bootloader-Bereich geladen. Wahrscheinlich würde der
überschrieben, wenn ich "write device" anklicken würde. Wie kann man die
Absolutadresse zuweisen. Beim Compilieren von Beispielen von der CD wird
der Hax-File auf 400h geladen, wie es sein sollte. Habe den Beispiel-
Sourcecode schon kopiert und übersetzt und das Problem zeigt sich
ebenso.

Hat jemand eine Idee?

Gruß reila""

...komme aber nicht weiter...kannst du mir vllt. sagen wie du es gemacht 
hast am besten so einfach wie möglich bin nicht wirklich fit in dem 
Thema!

Ich weiß einfach nicht wie ich der Hex-File einen Speicherraum oberhalb 
von 400h zuweisen kann so das dem Bootloader dabei nix passiert???

Gruß Andi

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.