|
|
View previous topic :: View next topic |
Author |
Message |
ednspace
Joined: 08 Aug 2007 Posts: 10
|
DSPIC33FJ PCD Bootloader help and direction |
Posted: Fri Dec 01, 2017 6:51 pm |
|
|
I have spent enough time fighting with this and realize that I really need some help.
First I am using PCWHD IDE and PCD Version 5.075
Target is a DSPIC dsPIC33FJ128GP306A
Here is the goal.
I would like a standalone bootloader that I can program into the chip. I want it to live in the Boot Segment Access Area of the chip. According to the data sheet I have set the fuses like this in the example bootloader.c.
Eventually I would like to write protect this bootloader but for now I'll be happy if I can get everything in the right place. I am not using the push button and have basically commented out the loader section. For now I am just trying to see an RS32 response from the bootloader and then the main program.
Code: |
//The setup for 6 different chips, one from each of these chip families,
//is listed below.
#define DSPIC33FJ
//#define DSPIC30F
//#define PIC24FJ
//#define PIC24FJ_REV2
//#define PIC24HJ
//#define PIC24EP
#if defined(DSPIC33FJ)
#include <33FJ128GP306A.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES BSSSL //Boot Segment Code Protect Standard Security, Large Boot Segment
#FUSES RBS1024 //Boot RAM is 1024 bytes
#use delay(clock=22110000, internal) // works with baud
#use rs232(UART2, baud=115200, errors, stream=COM_PORT) // works at internal=40MHZ and xtal=22118400 and internal=2211000 w/o BRGH1OK)
#define PUSH_BUTTON PIN_B2
#elif defined(DSPIC30F)
#include <30F4012.h>
#fuses NOWDT
#use delay(crystal=20M)
#use rs232(BAUD=9600,UART1A,errors)
#define PUSH_BUTTON PIN_B1
#elif defined(PIC24FJ)
#include <24FJ128GA006.h>
#fuses NOWDT
#use delay(crystal=20MHz)
#use rs232(BAUD=9600,UART1,errors)
#define PUSH_BUTTON PIN_F6
#elif defined(PIC24FJ_REV2)
#include <24FJ256GA106.h>
#fuses NOWDT
#use delay(crystal=20MHz)
#pin_select U1TX = PIN_F3
#pin_select U1RX = PIN_F2
#use rs232(BAUD=9600,UART1,errors)
#define PUSH_BUTTON PIN_F6
#elif defined(PIC24HJ)
#include <24HJ128GP306.h>
#fuses NOWDT
#use delay(crystal=20MHz)
#use rs232(Baud=9600,UART1,errors)
#define PUSH_BUTTON PIN_F6
#elif defined(PIC24EP)
#include <24ep256gp206.h>
#fuses NOWDT
#use delay(crystal=20MHz)
#pin_select U1TX = PIN_A4
#pin_select U1RX = PIN_A9
#use rs232(Baud=9600,UART1,errors)
#define PUSH_BUTTON PIN_C3
#endif
#define _bootloader
//#define BOOTLOADER_MODE2X
#include <pcd_bootloader.h>
#include <loader_pcd.c>
#org APPLICATION_START
void application(void)
{
while(TRUE);
}
void main(void)
{
printf("\r\nBootLoader Version 1.0\r\n");
//! if(!input(PUSH_BUTTON))
//! {
//! delay_ms(140); // wait for PLL
//!
//! printf("\r\nBootloader Version 1.0\r\n");
//!
//! // Let the user know it is ready to accept a download
//! printf("\r\nWaiting for download...");
//!
//! // Load the program
//! load_program();
//! }
//!
application();
}
#int_default
void isr(void)
{
jump_to_isr(LOADER_END+5);
} |
I also include the standard the pcd_bootloader.h and flash it to the chip and it works. I can see output from the Serial Port etc... I really can't try to actually bootload until I replace the loader_pcd.c on the hardware I am using the RS232 is not standard protocol, using FTDI D2xx library but still I have working code for that later, for now on with the show.
So now I make a new build file for the payload application as a test.
Code: |
#define DSPIC33FJ
#if defined(DSPIC33FJ)
#include <33FJ128GP306A.h>
#Fuses NONE
#use delay(clock=22110000, internal) // works with baud
#use rs232(UART2, baud=115200, errors, stream=COM_PORT) // works at internal=40MHZ and xtal=22118400 and internal=2211000 w/o BRGH1OK)
#define PUSH_BUTTON PIN_B2
#endif
//#define BOOTLOADER_MODE2X
//This is a necessary include file. It reserves space so that the
//bootloader is not overwritten.
//#include <pcd_bootloader.h>
// START OF bootloader definition
// According to data sheet Boot Segment ends at 0x003FFF with the Fuse settings I selected
#define LOADER_END 0x003FFF
#build(reset=LOADER_END+2, interrupt=LOADER_END+6)
#org 0, LOADER_END {} // nothing will replace the bootloader memory space
// END OF bootloader definition
// Variable definitions, interrupt service routines, main, etc. below here
rom char version[] = "Application Version 1.0";
void main()
{
delay_ms(100);
printf("\r\n%s\r\n", version);
printf("You can put whatever code you want here.\r\n");
printf("So enjoy!\r\n");
while(TRUE)
{
}
}
|
Notice I have commented out the pcd_bootloader.h and just added my own build and org lines. Hopefully this is OK.
So, problems / questions. I can not seem to test this. My plan was to use the programmer erase and flash the bootloader and then flash the application on top of that, sort of merge them together as they would be if properly bootloaded. However the programmer PICKIT3 and MPLABX IPE don't seem to want to let that fly. Bootloader is fine but if I don't erase the part entirely the application fails to program. Ideally I can develop the main application somehow without having to actually bootload each time.
The other part of this is I do not understand the pcd_bootlader.h at all. Seems like I really could just build the bootloader normally since it lives right after the Reset/Interrupt Vector Space and then use the build and org commands for my main app.
Also do I need to define fuses in both the bootloader and the main app?
Also do I really need to be moving the interrupt vectors around if I am not using them for the bootload process?
Also would the bootload option for #Build be advisable in this situation?
To Summarize:
Ideally Bootloader lives in protected space from Reset Vector to 0x003FF.
Bootloader loads every time, looks for PC communication if does not get it, then times out and passes it over to main app.
Main App never knows bootloader exists.
It would be nice if there was some way to work on main app without having to bootload every time, not sure how to accomplish this.
Any help would be greatly appreciated,
its taking me a long while to get to this point and while I feel like I am close, I still feel very far away from the goal...
thanks
Eric
Last edited by ednspace on Wed Dec 13, 2017 10:11 am; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Dec 01, 2017 7:11 pm |
|
|
Quote: |
My plan was to use the programmer erase and flash the bootloader and
then flash the application on top of that, sort of merge them together as
they would be if properly bootloaded.
|
See Ttelmah's answer in this thread, about how to create a combined
Hex file of the bootloader and the application:
http://www.ccsinfo.com/forum/viewtopic.php?t=55676 |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Fri Dec 01, 2017 7:27 pm |
|
|
Thanks PCM programmer for that!!!
I will give it a go and see if I can get it working.
Any comments on the other parts of this mystery are more than welcome... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Sat Dec 02, 2017 1:05 pm |
|
|
The normal way to not have the bootloader wait, is to use a jumper. That is why it is there.
However you can do the same thing with the RS232.
Depending on the hardware used, if you design it so that you see 'break' (RS232 input low to the PIC), when the cable is disconnected, all the bootloader needs to do is check if the line is high. If it isn't jump straight to the main code. |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Thu Dec 14, 2017 3:21 pm |
|
|
Thanks to Ttelmah and PCM programmer for responding to my previous post.
I almost have everything working at this point.
I am programming the bootloader with the programmer as and bootloading the main app for now just to keep confusion down for now and to keep testing and working with my PC application.
The decision to go into bootloader mode is being made by an RS232 timeout. If the bootloader does not receive its bootloader character soon after a reboot then it jumps to the main app. This all works great. I have an FTDI running in D2XX library mode and one of its pins can turn the power supply on and off to the DSPIC so... I can reboot the DSPIC with my PC side bootloader application send the character and bing, into bootloader mode. My PC app also can send the main app very quickly now and its almost a treat to use over the programmer.
Only two more questions remain. How can I tell where the Interrupt vectors are being moved and if they are in the right place? Can I see this in the list file somehow or can I decode it from the HEX file? All my interrupts are working fine, I just want to know how to ease any doubt and convince myself that all is well. I think the line that moves the vectors is, jump_to_isr(LOADER_END+5); Is this correct for my part, 33FJ128GP306A?
I would also like to turn on the code config protection bits that make it so the bootloader can not be written over. I am setting fuses in the bootloader code and using #FUSES NONE in the main application.
The fuses would be something like this
#FUSES BSSSL //Boot Segment Code Protect Standard Security, Large Boot Segment
#FUSES RBS128 //Boot RAM is 128 bytes
My question is how can I tell how big this bootloader block is? I know its done by pages but I can not quite decipher it. Not sure how to correlate this with the datasheet but some help would be appreciated. I can decode the HEX file at this point but the overall addressing of the DSPIC is still a little daunting. I have to choose small, medium or large and I think they break on pages??? I also don't want to screw up the addressing already being done by the bootloader.h file or change it if I don't have to. I am using stock pcd example bootloader.h and its all working well, if the vectors are right that is...
The bootloader reports these variable settings when I print them out as a test.
LOADER_END = 07FF
APPLICATION_START = 0800
APPLICATION_END = 15BFF
Thanks for any more help,
Eric
PS I have convinced myself that there is no need to erase the entire program memory space before bootloading each time. If I bootload a large app and then bootload a small one remnants of the first older one remain in memory. I assume this will not cause a problem and so far has not but it worries me a little. Is this a safe approach ;)
Here is the bootloader as it stands now...
Code: | #include <33FJ128GP306A.h>
//Define Fuses Here Not in Main Application Program
#FUSES NOWDT //No Watch Dog Timer
//#FUSES BSSSL //Boot Segment Code Protect Standard Security, Large Boot Segment
//#FUSES RBS1024 //Boot RAM is 1024 bytes
#use delay(clock=22110000, internal) // works with baud
#use rs232(UART2, baud=115200, stream=COM_PORT, ERRORS) // works at internal=40MHZ and xtal=22118400 and internal=2211000 w/o BRGH1OK)
//Tells the compiler this is the bootloader
#define _bootloader
#include <pcd_bootloader.h>
#include <loader_pcd.c> //Custom Loader Routine for this DSPIC and D2XX
#org APPLICATION_START
void application(void)
{
while(TRUE);
}
int inchar = 0;
void main(void)
{
//Signal that we are in the bootloader
fprintf(COM_PORT, "B\r\n");
//Now wait a short time for command
int16 delay_ctr;
for (delay_ctr=0;delay_ctr<5000;delay_ctr++)
{
if (kbhit(COM_PORT))
{
//Now there _is_ a character so you can call getc
inchar = fgetc(COM_PORT);
}
else
delay_us(10);
}
//Check the character if you got one
if(inchar == 'U')
{
// Enter upload program mode
// Load the program
load_program();
//spin here forevers
while (1){}
}
else
{
//Run the application...
application();
}
}
#int_default
void isr(void)
{
jump_to_isr(LOADER_END+5);
} |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Fri Dec 15, 2017 1:48 am |
|
|
Select 'symbolic' in the build options, and compile the bootloader.
Then just look at the start of the assembler listing.
You'll find the table of vectors and where they all point.
You'll find that all the vectors, have been 're-targetted'. Assuming the #build is at 'LOADER_END+1', four locations above the start of the build range.
The 'jump to ISR' function is much overloaded. The original version did 'what it said', and was a simple long jump. Then with the PIC 18's, it was modified and generated two jumps. putting one at the location for high priority interrupts, and the second at the location for standard interrupts. On the PIC24/30/33, it instead loads the entire interrupt vector table, with the specified offset. |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Fri Dec 15, 2017 7:49 am |
|
|
I am sorry.
I should have included the #BUILD line for the included header file.
Code: | #build (reset=APPLICATION_START,interrupt=APPLICATION_ISR_START) |
Code: | #define APPLICATION_START 0 |
Code: | #define APPLICATION_ISR_START (LOADER_END + 5) |
I have not changed anything in the include file that came with the PCD example.
I am going to to see if I can select 'symbolic' in the compiler options. I am using the IDE. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Fri Dec 15, 2017 8:31 am |
|
|
Options
Project
Output Files
List file
Tick SFR Names, Symbols, Interpret
You'll find the listing file is quite nicely documented once you re-compile. |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Fri Dec 15, 2017 8:42 am |
|
|
Alright just saw the suggestion above...
I guess you posted while I was typing ;)
let me try what you suggest for compiler options...
(Removed this text to avoid confusion for future reader)
Last edited by ednspace on Fri Dec 15, 2017 9:27 am; edited 2 times in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Fri Dec 15, 2017 8:52 am |
|
|
With the naming/interpret options ticked, you get:
Code: |
00006: DATA 08,08,00 : Trap OSCFAIL at 000808
00008: DATA 0C,08,00 : Trap ADDRERR at 00080C
0000A: DATA 10,08,00 : Trap STACKERR at 000810
0000C: DATA 14,08,00 : Trap MATHERR at 000814
0000E: DATA 18,08,00 : Trap DMAERR at 000818
00010: DATA 1C,08,00 : Trap CRYPT_PROGRAM_DONE at 00081C
00012: DATA 20,08,00 : Trap CRYPT_PROGRAM_DONE at 000820
00014: DATA 24,08,00 : Int0 EXT0 at 000824
00016: DATA 28,08,00 : Int1 IC1 at 000828
00018: DATA 2C,08,00 : Int2 OC1 at 00082C
0001A: DATA 30,08,00 : Int3 TIMER1 at 000830
0001C: DATA 34,08,00 : Int4 DMA0 at 000834
0001E: DATA 38,08,00 : Int5 IC2 at 000838
00020: DATA 3C,08,00 : Int6 OC2 at 00083C
00022: DATA 40,08,00 : Int7 TIMER2 at 000840
00024: DATA 44,08,00 : Int8 TIMER3 at 000844
00026: DATA 48,08,00 : Int9 SPI1E at 000848
00028: DATA 4C,08,00 : Int10 SPI1 at 00084C
0002A: DATA 50,08,00 : Int11 RDA at 000850
0002C: DATA 54,08,00 : Int12 TBE at 000854
0002E: DATA 58,08,00 : Int13 ADC1 at 000858
00030: DATA 5C,08,00 : Int14 DMA1 at 00085C
00032: DATA 60,08,00 : Int15 CRYPT_PROGRAM_DONE at 000860
00034: DATA 64,08,00 : Int16 SI2C at 000864
00036: DATA 68,08,00 : Int17 MI2C at 000868
00038: DATA 6C,08,00 : Int18 CRYPT_PROGRAM_DONE at 00086C
0003A: DATA 70,08,00 : Int19 CNI at 000870
0003C: DATA 74,08,00 : Int20 EXT1 at 000874
0003E: DATA 78,08,00 : Int21 CRYPT_PROGRAM_DONE at 000878
00040: DATA 7C,08,00 : Int22 IC7 at 00087C
00042: DATA 80,08,00 : Int23 IC8 at 000880
00044: DATA 84,08,00 : Int24 DMA2 at 000884
00046: DATA 88,08,00 : Int25 OC3 at 000888
00048: DATA 8C,08,00 : Int26 OC4 at 00088C
0004A: DATA 90,08,00 : Int27 TIMER4 at 000890
0004C: DATA 94,08,00 : Int28 TIMER5 at 000894
0004E: DATA 98,08,00 : Int29 EXT2 at 000898
00050: DATA 9C,08,00 : Int30 RDA2 at 00089C
00052: DATA A0,08,00 : Int31 TBE2 at 0008A0
00054: DATA A4,08,00 : Int32 SPI2E at 0008A4
00056: DATA A8,08,00 : Int33 SPI2 at 0008A8
00058: DATA AC,08,00 : Int34 CRYPT_PROGRAM_DONE at 0008AC
0005A: DATA B0,08,00 : Int35 CRYPT_PROGRAM_DONE at 0008B0
0005C: DATA B4,08,00 : Int36 DMA3 at 0008B4
0005E: DATA B8,08,00 : Int37 IC3 at 0008B8
00060: DATA BC,08,00 : Int38 IC4 at 0008BC
00062: DATA C0,08,00 : Int39 IC5 at 0008C0
00064: DATA C4,08,00 : Int40 IC6 at 0008C4
00066: DATA C8,08,00 : Int41 OC5 at 0008C8
00068: DATA CC,08,00 : Int42 OC6 at 0008CC
0006A: DATA D0,08,00 : Int43 OC7 at 0008D0
0006C: DATA D4,08,00 : Int44 OC8 at 0008D4
0006E: DATA D8,08,00 : Int45 CRYPT_PROGRAM_DONE at 0008D8
00070: DATA DC,08,00 : Int46 DMA4 at 0008DC
00072: DATA E0,08,00 : Int47 TIMER6 at 0008E0
00074: DATA E4,08,00 : Int48 TIMER7 at 0008E4
00076: DATA E8,08,00 : Int49 SI2C2 at 0008E8
00078: DATA EC,08,00 : Int50 MI2C2 at 0008EC
0007A: DATA F0,08,00 : Int51 TIMER8 at 0008F0
0007C: DATA F4,08,00 : Int52 TIMER9 at 0008F4
0007E: DATA F8,08,00 : Int53 EXT3 at 0008F8
00080: DATA FC,08,00 : Int54 EXT4 at 0008FC
00082: DATA 00,09,00 : Int55 CRYPT_PROGRAM_DONE at 000900
00084: DATA 04,09,00 : Int56 CRYPT_PROGRAM_DONE at 000904
00086: DATA 08,09,00 : Int57 CRYPT_PROGRAM_DONE at 000908
00088: DATA 0C,09,00 : Int58 CRYPT_PROGRAM_DONE at 00090C
0008A: DATA 10,09,00 : Int59 CRYPT_PROGRAM_DONE at 000910
0008C: DATA 14,09,00 : Int60 CRYPT_PROGRAM_DONE at 000914
0008E: DATA 18,09,00 : Int61 DMA5 at 000918
00090: DATA 1C,09,00 : Int62 CRYPT_PROGRAM_DONE at 00091C
00092: DATA 20,09,00 : Int63 CRYPT_PROGRAM_DONE at 000920
00094: DATA 24,09,00 : Int64 CRYPT_PROGRAM_DONE at 000924
00096: DATA 28,09,00 : Int65 UART1E at 000928
00098: DATA 2C,09,00 : Int66 UART2E at 00092C
0009A: DATA 30,09,00 : Int67 CRYPT_PROGRAM_DONE at 000930
0009C: DATA 34,09,00 : Int68 DMA6 at 000934
0009E: DATA 38,09,00 : Int69 DMA7 at 000938
000A0: DATA 3C,09,00 : Int70 CRYPT_PROGRAM_DONE at 00093C
000A2: DATA 40,09,00 : Int71 CRYPT_PROGRAM_DONE at 000940
000A4: DATA 44,09,00 : Int72 CRYPT_PROGRAM_DONE at 000944
000A6: DATA 48,09,00 : Int73 CRYPT_PROGRAM_DONE at 000948
000A8: DATA 4C,09,00 : Int74 CRYPT_PROGRAM_DONE at 00094C
000AA: DATA 50,09,00 : Int75 CRYPT_PROGRAM_DONE at 000950
000AC: DATA 54,09,00 : Int76 CRYPT_PROGRAM_DONE at 000954
000AE: DATA 58,09,00 : Int77 CRYPT_PROGRAM_DONE at 000958
000B0: DATA 5C,09,00 : Int78 CRYPT_PROGRAM_DONE at 00095C
000B2: DATA 60,09,00 : Int79 CRYPT_PROGRAM_DONE at 000960
000B4: DATA 64,09,00 : Int80 CRYPT_PROGRAM_DONE at 000964
000B6: DATA 68,09,00 : Int81 CRYPT_PROGRAM_DONE at 000968
000B8: DATA 6C,09,00 : Int82 CRYPT_PROGRAM_DONE at 00096C
000BA: DATA 70,09,00 : Int83 CRYPT_PROGRAM_DONE at 000970
000BC: DATA 74,09,00 : Int84 CRYPT_PROGRAM_DONE at 000974
000BE: DATA 78,09,00 : Int85 CRYPT_PROGRAM_DONE at 000978
000C0: DATA 7C,09,00 : Int86 CRYPT_PROGRAM_DONE at 00097C
000C2: DATA 80,09,00 : Int87 CRYPT_PROGRAM_DONE at 000980
000C4: DATA 84,09,00 : Int88 CRYPT_PROGRAM_DONE at 000984
000C6: DATA 88,09,00 : Int89 CRYPT_PROGRAM_DONE at 000988
000C8: DATA 8C,09,00 : Int90 CRYPT_PROGRAM_DONE at 00098C
000CA: DATA 90,09,00 : Int91 CRYPT_PROGRAM_DONE at 000990
000CC: DATA 94,09,00 : Int92 CRYPT_PROGRAM_DONE at 000994
000CE: DATA 98,09,00 : Int93 CRYPT_PROGRAM_DONE at 000998
000D0: DATA 9C,09,00 : Int94 CRYPT_PROGRAM_DONE at 00099C
000D2: DATA A0,09,00 : Int95 CRYPT_PROGRAM_DONE at 0009A0
000D4: DATA A4,09,00 : Int96 CRYPT_PROGRAM_DONE at 0009A4
000D6: DATA A8,09,00 : Int97 CRYPT_PROGRAM_DONE at 0009A8
000D8: DATA AC,09,00 : Int98 CRYPT_PROGRAM_DONE at 0009AC
000DA: DATA B0,09,00 : Int99 CRYPT_PROGRAM_DONE at 0009B0
000DC: DATA B4,09,00 : Int100 CRYPT_PROGRAM_DONE at 0009B4
000DE: DATA B8,09,00 : Int101 CRYPT_PROGRAM_DONE at 0009B8
000E0: DATA BC,09,00 : Int102 CRYPT_PROGRAM_DONE at 0009BC
000E2: DATA C0,09,00 : Int103 CRYPT_PROGRAM_DONE at 0009C0
000E4: DATA C4,09,00 : Int104 CRYPT_PROGRAM_DONE at 0009C4
000E6: DATA C8,09,00 : Int105 CRYPT_PROGRAM_DONE at 0009C8
000E8: DATA CC,09,00 : Int106 CRYPT_PROGRAM_DONE at 0009CC
000EA: DATA D0,09,00 : Int107 CRYPT_PROGRAM_DONE at 0009D0
000EC: DATA D4,09,00 : Int108 CRYPT_PROGRAM_DONE at 0009D4
000EE: DATA D8,09,00 : Int109 CRYPT_PROGRAM_DONE at 0009D8
000F0: DATA DC,09,00 : Int110 CRYPT_PROGRAM_DONE at 0009DC
000F2: DATA E0,09,00 : Int111 CRYPT_PROGRAM_DONE at 0009E0
000F4: DATA E4,09,00 : Int112 CRYPT_PROGRAM_DONE at 0009E4
000F6: DATA E8,09,00 : Int113 CRYPT_PROGRAM_DONE at 0009E8
000F8: DATA EC,09,00 : Int114 CRYPT_PROGRAM_DONE at 0009EC
000FA: DATA F0,09,00 : Int115 CRYPT_PROGRAM_DONE at 0009F0
000FC: DATA F4,09,00 : Int116 CRYPT_PROGRAM_DONE at 0009F4
000FE: DATA F8,09,00 : Int117 CRYPT_PROGRAM_DONE at 0009F8
|
Telling you what they all do. |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Fri Dec 15, 2017 9:24 am |
|
|
AWESOME!!!
I see it now. Thanks! Thats a cool trick.
So is this telling me where they are being moved like.
00006 is the OSCFAIL ISR and its getting moved to 000808?
My main app list file is starting at...
Code: | 00800: GOTO 1EDE :
*
00830: GOTO BDA :
*
00840: GOTO C30 :
*
0089C: GOTO C80 :
008A0: GOTO D3C : |
and the first few lines show...
Code: | 00A0A: MOV W5,[W15++] : Push W5 to TOS
00A0C: MOV #C,W5 : W5 = C
00A0E: REPEAT #3 : Repeat next instruction (3 + 1) times
00A10: MOV [W5++],[W15++] : Push [W5++] to TOS
00A12: MOV #0,W9 : W9 = 0
00A14: BTSC.B 43.0 : Skip if SR.DC = 0
00A16: MOV #1,W9 : W9 = 1
00A18: MOV W9,[W15++] : Push W9 to TOS |
again I do not see any of the Interrupt Vectors being moved in the main list file which I am sure is correct.
I still wonder how to tell if I have overlap and if main is really able to see the vector space correctly?
When I read the device with the programmer after bootloading I can see my main app starting at 000800 and I can see the GOTOs from the list file like 1EDE they are in the right spot. For the life of me I do not see the ISRs unless they are FFFFFs and just in between. Shouldn't they show up at 000808.
It seems like there is some overlap like 000830 has a goto defined but is also the remapped location for the interrupt Timer1. Or is this just the way it shows up if I am using timer 1?
Thanks so much for your help, it would be nice to really feel like I understand this. |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Fri Dec 15, 2017 11:27 am |
|
|
Ok I can see the interrupt vectors being mapped in now at the top of program memory when I look at the Memory View from the programmer. They are starting at 00002 and have the remapped values from the list file. Hopefully I am good on vectors but still not quite positive
I am still trying to figure out code config, but it looks like according to the data sheet and http://ww1.microchip.com/downloads/en/DeviceDoc/70199B.pdf
For standard protection small size looks like the bootloader segment is defined as:
Standard Small 0x000200 0x0007FE
This seems to mesh very well with the way my bootloader is set up. It seems to be starting at 0000200 and the main code starts 000800.
Seems like all I have to do to protect it is turn on these fuses...
Code: | #FUSES WRTB //Boot block write protected
#FUSES BSSSS //Boot Segment Code Protect Standard Security, Small Boot Segment
#FUSES NORBS //No Boot RAM defined |
We shall see...
Thanks again for all the help |
|
|
ednspace
Joined: 08 Aug 2007 Posts: 10
|
|
Posted: Fri Dec 15, 2017 12:46 pm |
|
|
Well those fuse settings appear to work!!!
I can not read the bootloader area after programming, just get zeros for that section.
Bootloading still works and after bootloading and reading with the programmer I can see the main code that I bootloaded and the boot bootloader segment is still read as zeroes.
The zero section matches my bootloader size EXACTLY!
So, I think I am home free on the code config protection front.
If anyone still feels like humoring me with more info on the Reset Vectors I am all ears.
Or if you spot anything else I may be doing wrong from the above please chime in.
Thanks again all for all your time...
Eric |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|