• AVR Freaks

AnsweredHot!PIC32MK1024GPE1024 Bootloader

Author
ZackZack13
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2019/06/21 08:41:33
  • Location: 0
  • Status: offline
2019/06/24 03:19:50 (permalink)
0

PIC32MK1024GPE1024 Bootloader

Hello, I'm trying to use the USART bootloader for PIC32MK1024GPE1024.
 
I have used MPLAB X IDE v5.15 and Harmony v2.06 to generate the linker scripts (see attachments).
 
For the bootloader I have just created a new project. In the MPLAB Harmony Configurator I have checked "Use Bootloader Library" and "Build a Bootloader" and added the corresponding Pins and Drivers.
 
To create a simple application I took the blinky_leds project from the harmony peripheral ports examples. Here, I have checked "Use Bootloader Library" and "Build an Application Linker Script" in addition to the setup of the example.
 
In this simple setup the firmware upload with the unified bootloader works and the application seems to run.
 
As a second step I have added Debug output to the application. I have checked "Use Console System Service?" and "Use Debug System Service?" and the corresponding Pins and Drivers. Note that the USART Driver is implemented as dynamic and runs in "Interrupt Mode".
Now the application is not working anymore.
 
The real application (which is already deloped) also doesn't run. I have tested some settings and to me it seems that the interrupts seem to be the problem in the application but I have no clue what to do to get the application working.
 
 
I have noticed that the linker scripts both have the "OUTPUT_ARCH(pic32mx)" in it. I have selected the PIC32MK1024GPE1024 in harmony. I am not very firm withlinkerscripts, but the PIC32MK seems to have anonther memory mapping as the PIC32MX. Is it possible that the interrupt vector table is not written to the correct memory area or something?
 
I have found this thread https://www.microchip.com/forums/FindPost/1029115 but it is from 2017 so I don't know if microchip has changed the linker files somehow. I can't figure it out. And again without any interrupts in the application it seems to run.
 
 
Could somebody please help me?
Thanks in advance and best regards!
#1
ZackZack13
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2019/06/21 08:41:33
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/25 03:30:26 (permalink)
0
Hi,
 
in my prior post I forgot to tell you that the Configuration Bits in system_init.c are always consistent between bootloader and application so this can't be the source of error.
 
Notice that blinky_leds project uses a timer callback of the SYS_TMR Framework. I'm not quite sure if there is somewhere an interrupt behind. So perhaps not all interrupts lead to errors.
 
I hope someone has a clue where the problem is.
#2
NKurzman
A Guy on the Net
  • Total Posts : 17506
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/25 08:30:01 (permalink) ☼ Best Answerby ZackZack13 2019/06/25 08:32:45
0
So you Created a Bootloader then added app_mx.ld to your application and selected "use response file to link?
 
You read the instructions for the Bootloader Example in the Harmony Documentation?
#3
ZackZack13
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2019/06/21 08:41:33
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/25 09:22:41 (permalink)
0
Hi NKurzman,
 
thanks for your reply.
 
 
I have two projects.
In the bootloader project harmony has automatically created the btl_mx.ld (because I have selected "Build a Bootloader" in Harmony Framework Configuration).
In the application project harmony has automatically created app_mx.ld (because I have selected "Build an Application Linker Script" in Harmony Framework Configuration).
The linkerfiles are both automatically added to the projects by harmony.
"use response file to link" was not selected. But trying this out did not help. As stated before a simple application project is working, but when I'm trying to use interrupts the application stucks.
 
Excluding the linker script from the application project and programming and running it standalone (without bootloader) works.
 
I have read the "Bootloader Library Help" v2.06 downloaded from the microchip website (https://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en586863). The generation of the linker scrips is done like decribed on page 10f. I did not change these scripts because i have interpreted "Considerations While Moving the Appliocation Image" on page 11 as if changed should only be done if you want to place the application to a desired flash region or if you add features to the bootloader. I think the adresses are automatically aligned to the boundaries by harmony, arent they?
 
On page 14 the sizing of the different bootloader types on the device families is outlined. There is no information for the PIC32MK (which I am using). Is it possible that the bootloader doesn't work properly on PIC32MK?
 
 
Best regards
 
#4
NKurzman
A Guy on the Net
  • Total Posts : 17506
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/25 09:35:18 (permalink)
0
So you are saying you can Bootload an application that does not have interrupts?
 
I would not Be surprised if the Linker script (or scripts) are bad.  They were bad for the PIC32MX530F128.
You can try a cross Post to the Harmony Forum.  
Put in a Support Ticket.
Or you can try to fix the Linker script yourself.
 
In earlier version of Harmony 1.0X they did have a similar Issue with Interrupts.
#5
ZackZack
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/06/21 07:56:16
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/26 03:37:36 (permalink)
0
NKurzman
So you are saying you can Bootload an application that does not have interrupts?

 
Yes, thats correct. And for me that is the strange thing with my problem. I has something to do with the interrupts of the application.
 
NKurzman
I would not Be surprised if the Linker script (or scripts) are bad.  They were bad for the PIC32MX530F128.
You can try a cross Post to the Harmony Forum.  
Put in a Support Ticket.
Or you can try to fix the Linker script yourself.
 
In earlier version of Harmony 1.0X they did have a similar Issue with Interrupts.



Well, I was afraid it could be something like this.
I'm not very familiar with linker scripts. Maybe you or someone else in the Forum can help me a little bit. I assume that there are two interrupt vector tables (one for the bootloader, one for the application) and linker scripts point to them, correct? Any hint where I have to look for?
 
 
P.S.: Sorry for posting with different accounts. This is the correct one.
#6
ZackZack13
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2019/06/21 08:41:33
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/27 02:57:07 (permalink)
0
Hi Folks,
 
I have now found a forum post with linker scripts made by EseDeveloper:
https://www.microchip.com/forums/FindPost/1037707
 
These linker scripts work for me.
Maybe the microchip staff can post some "official" scripts and update the generation in harmony, anyway.
 
 
Thank you.
#7
NKurzman
A Guy on the Net
  • Total Posts : 17506
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: PIC32MK1024GPE1024 Bootloader 2019/06/27 08:19:02 (permalink)
0
Microchip has not gotten the Bootloader scripts correct for Many Years.  Sad to see it has not gotten better.
#8
Jump to:
© 2019 APG vNext Commercial Version 4.5