• AVR Freaks

PIC32MM bootloader process explanation

Author
stoyanoff
Super Member
  • Total Posts : 233
  • Reward points : 0
  • Joined: 2011/01/10 03:37:28
  • Location: 0
  • Status: offline
2019/12/03 00:01:40 (permalink)
0

PIC32MM bootloader process explanation

Hi, Everyone! I`m making my own bootloader system. I want to use extenal flash to load the new program runtime, reset the controller and load it to the uC flash. So there are multiple things I don`t fully understand.
First: About the .hex file. Can you tell me where I can find info about the structure of the HEX file? I suppose every row starts with ':', address and info. But this is just a suggestion. I think I should remove the rows which are going to affect my bootloader section, so I need a way to determine which are they.
Second: I`m looking at EN1388 framework.c file. There a special interface is used to transfer the hex file to the controller. I don`t need that. I can do it run time. But I need to know if there are sections into the hex file row containing CRC, different type of records and so on. Or it is just pure address + data?! 
Thanks!
 
#1

9 Replies Related Threads

    stoyanoff
    Super Member
    • Total Posts : 233
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: PIC32MM bootloader process explanation 2019/12/03 05:55:17 (permalink)
    0
    Ok! I found info! How can I remove from the .HEX file rows connected to the bootloader? To delete the rows with addresses in the bootloader address space? I don`t want the new program vertion to update the bootloader section!
    Thanks!
    #2
    Jim Nickerson
    User 452
    • Total Posts : 6373
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: online
    Re: PIC32MM bootloader process explanation 2019/12/03 06:53:13 (permalink)
    0
    In my system the bootloader skips over the hex rows that would cause a problem.
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 18043
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: PIC32MM bootloader process explanation 2019/12/03 07:50:51 (permalink)
    5 (1)
    I do the same thing. My bootloaders Will not overwrite themselves.
    post edited by NKurzman - 2019/12/03 08:12:52
    #4
    stoyanoff
    Super Member
    • Total Posts : 233
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: PIC32MM bootloader process explanation 2019/12/04 04:22:23 (permalink)
    0
    Ok! A simple question, just to be sure. I am writing my functions for decoding Extended Segment Address(02) and Extended Linear Address (04). So in case of 02 package the ext_seg_addr should take the 2 bites from the package is put them is between -
    0102 - package bites
    ext_seg_addr=0x00010200
    and in case of 04 should put them like that- >
    0102 - package bites
    ext_lin_addr=0x01020000
    Is that correct?
    I`ve noticed the memcpy funct writes the databites from the liest significant->
    data->01020304
    memcpy(&dataholder,&data,4);
    ->result dataholder->04030201
    Is that correct?
    post edited by stoyanoff - 2019/12/04 07:21:38
    #5
    Jim Nickerson
    User 452
    • Total Posts : 6373
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: online
    Re: PIC32MM bootloader process explanation 2019/12/04 07:26:08 (permalink)
    0
    I used form AN1388  the source code to decode the hex line.
    #6
    stoyanoff
    Super Member
    • Total Posts : 233
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: PIC32MM bootloader process explanation 2019/12/09 04:31:07 (permalink)
    0
    Hi! So I`ve written my bootloader and now I have to modify the ld file. So I`m folloing the instructions int the AN1388, but I don`t know how to determine how big should be the bootloader area. The document says I have to put the main program in a different area so the bootloader can erase only it. Where should I check how big is my bootloader?
    Thanks!
    #7
    Jim Nickerson
    User 452
    • Total Posts : 6373
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: online
    Re: PIC32MM bootloader process explanation 2019/12/09 07:46:10 (permalink)
    0
    When I compile my bootloader I tick the Display Memory Usage box

     

    Attached Image(s)

    #8
    stoyanoff
    Super Member
    • Total Posts : 233
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: PIC32MM bootloader process explanation 2019/12/09 08:22:12 (permalink)
    0
    Just a second! Stupid question again! As far as I understand I have to compile the project twice - first only the bootloader(to see the memory usage) and then I add the rest?
    Thanks!
    PP: I haven`t done this before and I`m a little bit confused!
    #9
    hudejun
    Electrical engineer
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2019/12/05 08:48:06
    • Location: 0
    • Status: online
    Re: PIC32MM bootloader process explanation 2019/12/09 08:56:43 (permalink)
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5