• AVR Freaks

AnsweredHot![SOLVED]UART Bootloader and Application Help needed

Page: 12 > Showing page 1 of 2
Author
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
2019/07/14 23:24:48 (permalink)
0

[SOLVED]UART Bootloader and Application Help needed

Hi Guys,
I have a query regarding UART boot loader application.
 
I am using a UART bootloader application which is given by MPLAB Harmony.. I made necessary changes in the linker file. When I program the chip with the UART bootloader code I am able to program the user application code using the PC application. But if I try to program both the code using MPLAB and programmer it is not working.
 
I want both the bootloader code and also the user application to be programmed using MPLAB and PICkit programmer. Is it possible to do that and how to do it ?
 
I am using PIC32mz1024EFE100 chip.
 
Regards,
Vibhu.
 
post edited by vibhu - 2019/08/07 00:08:02
#1
maxruben
Super Member
  • Total Posts : 3366
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 03:23:36 (permalink)
0
Check out the loadables feature of MPLABX. At allows you to combine the bootloader and the app project and program and debug them together.
 
See here: https://microchipdeveloper.com/mplabx:projects-loadable-bootloaders
 
/Ruben
#2
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 03:44:46 (permalink)
0
Hi ruben,
Thanks for the reply.
 
I have an application project and a bootloader project, 
In the link which you have mentioned, they are telling to add bootloader project into application project.
I am not able to add the bootloader project as such into the application project. If I select the project it is not getting displayed in the list. I am able to only select the hex file.
 
If I select the hex file and build it I am getting ,
(944) data conflict at address 1FC0FFC3h error.
 
Please help.
 
#3
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 03:50:28 (permalink)
0
And,
Is it possible that I can build them both separately ?
I want the application code to run when it is dumped using programmer also. Now it is not working when dumped using programmer it is only working when dumped using the PC application for UART boot loader.
 
#4
maxruben
Super Member
  • Total Posts : 3366
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 05:03:14 (permalink)
5 (1)
I usually do it the other way around, load the application into the bootloader.
 
Also make sure you have the "Normalize hex file" Building configuration setting checked for the application that should be loaded by the bootloader and run together with the bootloader.
 
When you build your application without the bootloader it will need a a different linker script. You need two configurations for the application project, one that is run standalone and one that is going to be run together with the bootloader. In one configuration you need to exclude the linkerscript for the other.
 
Also, the conflicting address error is most likely for the config memory setting (#pragma config), make sure that the config memory setting is the same for both the bootloader and the application. You really don't need the #pragma config in the application that is going to be run together with the bootloader (but you do need it in the boot loader and the stand alone application).
 
/Ruben
#5
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 05:38:22 (permalink)
0
Hi Ruben,
Thanks, I will try out what you told.
 
But I have a doubt.
After downloading the bootloader code I am able to dump the hex file using PC application (bootloader application).
So with the same linker file why I am not able to dump the same project using programmer ? 
When I dump it it should be placed above the bootloader file and it should work know ?
 
Thanks,
 
#6
maxruben
Super Member
  • Total Posts : 3366
  • Reward points : 0
  • Joined: 2011/02/22 03:35:11
  • Location: Sweden
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 08:02:57 (permalink)
0
vibhu
After downloading the bootloader code I am able to dump the hex file using PC application (bootloader application).
So with the same linker file why I am not able to dump the same project using programmer ? 
When I dump it it should be placed above the bootloader file and it should work know ?

 
I'm sorry but I don't understand what you mean. The PC software will only work if the boot loader is present. I thought you were going to program the application and run it without the bootloader?
 
/Ruben
#7
ric
Super Member
  • Total Posts : 23859
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: UART Bootloader and Application 2019/07/15 18:32:59 (permalink)
0
Are you using "dump" to mean "program" ?
"Dump" usually means to read the code OUT of the PIC.
Programming normally starts by erasing the chip, so if you program the bootloader, then program the application as a separate operation, it will erase the bootloader.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#8
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 21:36:30 (permalink)
0
ric
Are you using "dump" to mean "program" ?

Yes I meant programming only.
ric
"Dump" usually means to read the code OUT of the PIC.

Sorry I didnt know that.
ric
Programming normally starts by erasing the chip, so if you program the bootloader, then program the application as a separate operation, it will erase the bootloader.

Thank You, Now I understood why it is not working.
 




#9
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 21:44:26 (permalink)
0
maxruben
Also, the conflicting address error is most likely for the config memory setting (#pragma config), make sure that the config memory setting is the same for both the bootloader and the application. You really don't need the #pragma config in the application that is going to be run together with the bootloader (but you do need it in the boot loader and the stand alone application).

I copied the same configuration bits settings for both the bootloader and the application.
But it is still giving an error
(944) data conflict at address 1FC005F0h
But I copied the same configuration from application to bootloader.
Does the Harmony configurations have anything to do with this ?
Can it be different for bootloader and application or should it be same ?
post edited by vibhu - 2019/07/15 21:51:33
#10
ric
Super Member
  • Total Posts : 23859
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: UART Bootloader and Application 2019/07/15 22:03:54 (permalink)
5 (1)
It doesn't matter that they are the same, it is complaining that they are both trying to set it.
Remove the CONFIG settings from your app altogether.
 
(The app has to use the same settings as the bootloader. It can't set them at all, it has to just reuse what was set for the bootloader.)
 
post edited by ric - 2019/07/15 22:22:27

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#11
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/15 23:49:04 (permalink)
0
Thanks ric.
 
I will try that out.
Another doubt I have.
The project which I program using MPLAB at first into the chip will have a unified hex file, and the application will start to run. Once if we enter into the bootloader mode I need to program an hex file right, Should that hex file also be a unified hex file or is it enough if I program only the application hex file ?
 
 
#12
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/16 00:17:45 (permalink)
0
Hi ric,
 
I tried removing the configuration bits from the application program but still it gives an error.
(944) data conflict at address 1FC005F0h, the same error.
 
I am attaching the screenshots.
Screenshot(35) is of system_init of application
Screenshot(37) is of system_init of bootloader
 
Can you please help,
Thanks.
post edited by vibhu - 2019/07/16 00:47:24

Attached Image(s)

#13
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/16 03:15:31 (permalink)
0
I am also attaching the linker script for both bootloader and my application.
Please tell me if there is anything wrong with the linker script as well.
 
 
When I am trying to build the application code separately its giving

Configuration Bits: address 0x1FC0FFC4: FPLLRNG = 7 does not match any valid value in the device database.
Setting to the default value.
Configuration Bits: address 0x1FC0FFC8: DMTCNT = 31 does not match any valid value in the device database.
Setting to the default value.
Loading completed

So, does that mean the application is still taking the configuration bits ?
I have commented out the configuration bits part i system_init.c
post edited by vibhu - 2019/07/16 07:00:24
#14
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/17 06:23:53 (permalink)
0
Please Help.
#15
aschen0866
Super Member
  • Total Posts : 4504
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: UART Bootloader and Application 2019/07/17 07:34:57 (permalink)
0
Try adding this section command to the end of your application's linker script

SECTIONS
{
/DISCARD/ : { *(._debug_exception) }
}

 
#16
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/17 08:07:28 (permalink)
0
There are already three SECTIONS in the linker file. Should I add it as a fourth or should I add it at the end of the third?
#17
aschen0866
Super Member
  • Total Posts : 4504
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: UART Bootloader and Application 2019/07/17 08:22:21 (permalink)
0
Adding it to the end is fine. 
#18
vibhu
Starting Member
  • Total Posts : 86
  • Reward points : 0
  • Joined: 2019/02/25 05:37:34
  • Location: 0
  • Status: offline
Re: UART Bootloader and Application 2019/07/17 21:51:06 (permalink)
0
Hi aschen,
 
The exception which you suggested is already added in the linker file which I have attached in #14.
I removed it and added it again at the last but the error is not resolved. It is still giving the same error.
#19
aschen0866
Super Member
  • Total Posts : 4504
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: UART Bootloader and Application 2019/07/18 06:51:21 (permalink)
0
In your application linker script, you have

MEMORY
{
kseg1_boot_mem : ORIGIN = (0x9D000000 + 0x1000 + 0x970), LENGTH = 0x490
kseg0_program_mem (rx) : ORIGIN = (0x9D000000 + 0x1000 + 0x970 + 0x490), LENGTH = (0x80000 - (0x1000 + 0x970 + 0x490))
kseg0_boot_mem : ORIGIN = (0x9D000000 + 0x1000), LENGTH = 0x970
kseg1_boot_mem_4B0 : ORIGIN = 0xBFC004B0, LENGTH = 0x1000 - 0x4B0
...
}

You need to move kseg1_boot_mem_4B0 into the PFM, presumably 9D00_0000 since there is nothing starting at that location.
#20
Page: 12 > Showing page 1 of 2
Jump to:
© 2019 APG vNext Commercial Version 4.5