• AVR Freaks

Hot!Customer Linker setup PIC24FJ

Page: 12 > Showing page 1 of 2
Author
jtzeng
Super Member
  • Total Posts : 458
  • Reward points : 0
  • Joined: 2003/11/07 12:42:20
  • Status: offline
2019/07/09 08:35:45 (permalink)
0

Customer Linker setup PIC24FJ

I am using a PIC24FJ256GA705 part where half the memory(data) will be generated by another application.
I will take the hex file from code development and insert the other generated hex data for part programming.
I need to reserve the area of memory so no code or data is placed there.
How do I get the default linker file generated and then edit it.
MCC does not seam to add a linker file.

John Zigrang
JTZ Engineering, Inc.
#1

21 Replies Related Threads

    du00000001
    Just Some Member
    • Total Posts : 2767
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Customer Linker setup PIC24FJ 2019/07/09 08:44:55 (permalink)
    +1 (1)
    What about RTF (compiler) M ?

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #2
    jtzeng
    Super Member
    • Total Posts : 458
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 09:15:46 (permalink)
    0
    Not sure what you are asking on RTF  /  M ?
    Must be over my head.

    John Zigrang
    JTZ Engineering, Inc.
    #3
    NKurzman
    A Guy on the Net
    • Total Posts : 17485
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 09:19:48 (permalink)
    0
    You can either 
    1. Copy the Linker script to your Project.
    2. Edit it.
    3. Add it to the Project.
    4. Check the "use Response file" in the Linker options.
     
    Or create a giant variable at that address and size.
     
     
    #4
    jtzeng
    Super Member
    • Total Posts : 458
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 09:23:36 (permalink)
    0
    Need to find a linker script to copy..
     
    Is there a way to create the variable without initialization?
     

    John Zigrang
    JTZ Engineering, Inc.
    #5
    Jim Nickerson
    User 452
    • Total Posts : 6016
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 09:31:12 (permalink)
    +1 (1)
    as du00000001 has suggested I see this 

    Attached Image(s)

    #6
    du00000001
    Just Some Member
    • Total Posts : 2767
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Customer Linker setup PIC24FJ 2019/07/09 09:38:38 (permalink)
    +1 (1)
    @jtzeng
    https://en.wikipedia.org/wiki/RTFM
     
    P.S: jtzeng or jtzstud ?

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #7
    nice
    Super Member
    • Total Posts : 1069
    • Reward points : 0
    • Joined: 2004/09/18 11:42:25
    • Location: Germany
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 11:11:38 (permalink)
    0
    jtzeng
    Is there a way to create the variable without initialization?

     
    ; foo.S
    .section .reserved_ram, bss, address (0x2000)       ; uninitialized data starting at address 0x2000
        .space 512                                      ; reserves 512 Bytes

     
     
    #8
    Jim Nickerson
    User 452
    • Total Posts : 6016
    • Reward points : 0
    • Joined: 2003/11/07 12:35:10
    • Location: San Diego, CA
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 12:01:10 (permalink)
    0
    maybe like this

    int last_mode __attribute__((persistent));
     

     
    #9
    nice
    Super Member
    • Total Posts : 1069
    • Reward points : 0
    • Joined: 2004/09/18 11:42:25
    • Location: Germany
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 12:23:27 (permalink)
    +1 (1)
    The persistent attribute would work as well. There are many ways to skin a cat. I’d prefer both ways over messing with the linker script.
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 17485
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 13:56:16 (permalink)
    0
    It is a gcc compiler you can google.
     
     
    maybe more like?
    int last_mode __attribute__((program, persistent, address(0x123456)));
    #11
    jtzeng
    Super Member
    • Total Posts : 458
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 14:02:09 (permalink)
    0
    To clarify, my target result here is to block off program memory (about 36Kb) to be filled from anther application at a specified location.  Then my project hex file will be merged with the other data file for programming.
    The linker script is just one of many options.  And I am reading the manuals.
    I have found the default script and added it to my project.  It is not that hard to modify.

    John Zigrang
    JTZ Engineering, Inc.
    #12
    NKurzman
    A Guy on the Net
    • Total Posts : 17485
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 14:24:52 (permalink)
    0
    How will the Merging be handled?  if you use a hex merge tool like "hexmate", then you do not need to do anything special. the Tool will take care of it.
    #13
    jtzeng
    Super Member
    • Total Posts : 458
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 14:29:45 (permalink)
    0
    The application that generates the data will append the project released hex file.
    The output is a unique file for each part that is being programmed.
     
     

    John Zigrang
    JTZ Engineering, Inc.
    #14
    NKurzman
    A Guy on the Net
    • Total Posts : 17485
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 15:41:13 (permalink)
    0
    The application can not just append it to the end. It must delete the end of file record first.
    And place a new one on the end.
    The data will be out of order, so if a bootloader is used it must support that.

    Optionally it can import the code hex file and add its stuff and create a new unified file.
    #15
    jtzeng
    Super Member
    • Total Posts : 458
    • Reward points : 0
    • Joined: 2003/11/07 12:42:20
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 17:19:05 (permalink)
    0
    The data generation application is write its data to a file with the SN of the unit as part of the file name.
    It will not add the end-of-file record to that output.
    Then it will read the code project hex file and append it to the same file.
    The end-of-file will be in the same place.
     
    The Data will align to page boundaries as well.
     

    John Zigrang
    JTZ Engineering, Inc.
    #16
    nice
    Super Member
    • Total Posts : 1069
    • Reward points : 0
    • Joined: 2004/09/18 11:42:25
    • Location: Germany
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 18:50:06 (permalink)
    +1 (1)
    NKurzmanmaybe more like?int last_mode __attribute__((program, persistent, address(0x123456)));

    I was under the assumption that the OP was asking for a solution to reserve RAM. Of course the address attribute is needed for specifying the reserved memory range.

    The OP didn’t clearly state wich memory he is talking about. In his initial post he’d wrote: "I am using a PIC24FJ256GA705 part where half the memory(data) will be generated by another application.". Data usually refers to RAM. Besides that he’d asked "Is there a way to create the variable without initialization?", which would also point to RAM. Later on he disclosed that he’s trying to reserve about 36 kB of program memory. This figure is neither the half of the available RAM nor the half of the available flash memory…

    I’m with du00000001 that jtzstud would be a more appropriate nickname.
    #17
    NKurzman
    A Guy on the Net
    • Total Posts : 17485
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 18:58:57 (permalink)
    0
    A second Application will create data.  That Data will be stored in the Flash.  So his application will add to the Hex File.
    He would like the Compiler not to initialize this flash so it will not conflict with the Data he is adding.
     
    #18
    NKurzman
    A Guy on the Net
    • Total Posts : 17485
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/09 19:01:59 (permalink)
    0
    jtzeng
    The data generation application is write its data to a file with the SN of the unit as part of the file name.
    It will not add the end-of-file record to that output.
    Then it will read the code project hex file and append it to the same file.
    The end-of-file will be in the same place.
     
    The Data will align to page boundaries as well. 




    If you want the Data C readable it must be 16bit so for a Flash word 2 bytes, then 1 dummy Byte + 1 Phantom Byte.
    If you are doing 24bit non C readable it is 3 bytes + 1 Phantom Byte. 
    #19
    davekw7x
    Entropy++
    • Total Posts : 1766
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: Customer Linker setup PIC24FJ 2019/07/10 07:56:15 (permalink)
    +2 (2)
    jtzeng
    Is there a way to create the variable without initialization?

    jtzeng
    ...my target result here is to block off program memory (about 36Kb) to be filled from anther application at a specified location.

     
    I like to keep things visible in C source code whenever practical (rather than mucking around with a linker script).
     
    There is an XC16 attribute called noload that can create uninitialized program memory blocks
    Maybe try something like the following:
    const uint8_t __attribute__ ((space(prog), address(0x9000), noload)) xxxxx[36864];

    The compiler won't put any code there, and the hex file for a project containing this statement will not have any entries for this block.
     
    Note that for sizes larger than 32767 you have to select "Allow arrays larger than 32K" in the Project Properties->xc16-gcc->Memory model box.
     
    Regards,

    Dave
    post edited by davekw7x - 2019/07/10 14:24:30

    Sometimes I just can't help myself...
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5