|
|
View previous topic :: View next topic |
Author |
Message |
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
|
|
Posted: Thu Apr 26, 2018 1:20 am |
|
|
OK.
A basic test with your compiler, shows where the fault is.
The application code must always start on a page boundary, and the code in the bootloader needs to fit in the space allocated for it.
Add this in front of your load of pcd_bootloader.h, both in the bootloader and main code:
Code: |
#define LOADER_PAGES 22
#include "pcd_bootloader.h"
|
Your bootloader is just too large to fit in the space being allocated for it by the default settings. Result, the end of the bootloader is being overwritten when you load the application. |
|
|
canero
Joined: 22 Apr 2018 Posts: 13
|
|
Posted: Thu Apr 26, 2018 3:19 pm |
|
|
Ttelmah wrote: | OK.
A basic test with your compiler, shows where the fault is.
The application code must always start on a page boundary, and the code in the bootloader needs to fit in the space allocated for it.
Add this in front of your load of pcd_bootloader.h, both in the bootloader and main code:
Code: |
#define LOADER_PAGES 22
#include "pcd_bootloader.h"
|
Your bootloader is just too large to fit in the space being allocated for it by the default settings. Result, the end of the bootloader is being overwritten when you load the application. |
Hello Ttelmah;
I tried your kind suggestion and changed the page number to 22,25 and 28 but again it has the exact same behaviour. Sometimes when I introduce a serial interrupt after my second application load, like entering "a" string from the serial window, the application freezes (before any interrupt occurs) and I have to reset the cpu. _________________ Regards;
Caner. |
|
|
canero
Joined: 22 Apr 2018 Posts: 13
|
|
Posted: Sat Apr 28, 2018 2:59 am |
|
|
Hello;
I have worked on this matter a little more. First I changed the Loader Size to 4FF and thought it was working but i was wrong, its still the same.
I took the symbol map of the bootloader program and application. I realized that the ISR sits on 144 on the bootloader. Shouldnt it be on just 4? Why its shifted by 140? Maybe I have lack of knowledge here but could that be the mistake?
Bootloader Rom Allocation
Code: |
ROM Allocation:
000100 @const774.call
00011E @const782.call
000144 isr
000162 @delay_ms1
000176 @GETCH_BIU_1
000184 atoi_b16
0001DA @NVR_WR
000202 @WRITE_PROGRAM_MEMORY
000284 real_load_program
00045C load_program
000462 MAIN
000462 @cinit1
00047C @cinit2
000580 application
|
Application ROM Allocation
Code: |
ROM Allocation:
00067C @const768.call
000696 @const769.call
0006AE @GETCH_BIU_1
0006BC RDA_isr
0006EC @delay_ms1
000700 @PRINTFU16_115200_5757_5758
0007B2 MAIN
0007B2 @cinit1
0007F0 @cinit2
|
_________________ Regards;
Caner. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Sat Apr 28, 2018 4:54 am |
|
|
Ok, first I don't use that PIC but a couple of comments..
..so generally speaking ...
1) a bootloader will use the 'real' PIC ISR locations(vectors) as it's the '1st' or 'master' program in the PIC. Your 'real ' program or application ( the one that is downloaded) will be redirected to use a 2nd set of ISR or vectors. I'm probably not explaining it right, but the bootloader uses the PIC's original 'map of vectors' so the application code needs to be redirected to it's 'map of vectors'.
2) It should be easy to see how large the bootloader program is. While I haven't used one in 2-3 decades, normally you reserve up to the next complete page. Say the bootloader is 2 and 1/2 pages long, then you need to reserve 3 pages, so your 'application' prgram would start in the first byte of the 4th page. You could look at the listing of the bootloader, or maybe comments in the bootloader or maybe there's a CCS function (?) to see how long the bootloader is.
3) Be sure to check the programmer setup.Again, I don't use a bootloader, but SW like MPLAB can be made to erase memory or bypass it when burning the PIC,so it's best to check the 'options'. |
|
|
|
|
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
|