[ABANDONED] Create and use Symbol Definition File with GNU or Segger Linker

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] Create and use Symbol Definition File with GNU or Segger Linker

    Hello

    question:
    is it possible to create and use a symbol definition file with/for the gnu or segger linker?
    Eg like this: infocenter.arm.com/help/index.…oc.dai0242a/CHDFICBG.html

    proberberly what i want do do:
    1.) create and build new Project "A"
    2.) symdef file generated from Project "A"
    3.) Add symdef file to Project "B"
    4.) Project "B" is configured to another Flash and RAM area than Project "A"
    5.) Project "B" contains only one function (no main, no startupcode, etc...) in this function i want to call functions and/or variables defined in Project "A"
    6.) compile Project "B" and link against Project "A".
    7.) geht flash content from Project "B".

    i want to use this to create patches for existing project "A", that mean if i release project "A" this porject will never be changed again, but i need the flash position from the functions and variables to linkt the patch against.

    best regards
    markus
  • Hi Markus,

    Sounds like a bootloader + application setup.
    In such case you can set the symbols file of Project A via project option Debug Symbols File in Project B, where up to 4 additional symbol files can be added.

    If you are looking for professional bootloader software we recommend emload:
    segger.com/products/field-upgrades/emload/

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi Nino,

    Yes thats right, okey i understand i can add Debug Symbols File in Project B but how can i generate the Debug Symbols File from Project A?
    Where i get this file? Can SES generate this file, because make it from hand sound like a lot of work.

    Best Regards
    Markus
  • Hello Markus,

    Well the compiler that generates the image of Project A will also generate the symbols file.
    We recommend to set up your Project A in Embedded Studio as well.
    Either have both projects in one solution or in separate ones.
    Now first build application A. In the output you will find the elf file. This you can set in Project B as the additional symbols file.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hy Nino,

    i have now tried the following this is my project "B" source code.
    i have changed the linker entry point to "patch" and without the function call the project builds successfully.


    C Source Code

    1. #include <stdbool.h>
    2. #include <stdint.h>
    3. //--------------------------------------------------------------------------------------------------------------
    4. //------------------------------------------------external function---------------------------------------------
    5. //--------------------------------------------------------------------------------------------------------------
    6. extern void bsp_board_led_invert(uint32_t led_idx);
    7. /**
    8. * @brief Function for application main entry.
    9. */
    10. int patch(void)
    11. {
    12. int i;
    13. while (true)
    14. {
    15. i++;
    16. bsp_board_led_invert(1);
    17. }
    18. }
    Display All

    The function bsp_board_led_invert is defined in project "A" the project is already build and linked.
    I have added the elf file from project "A" as Debug Symbols File in Project "B" like your suggestion.
    But now i get a linker error:

    Output/Blinky_Patch Debug/Obj/patch.o: in function `patch':
    undefined reference to `bsp_board_led_invert'

    But the function is defined in the elf file from project "A" -> this is the objdump from elf file project "A"

    Brainfuck Source Code

    1. 000205e8 <bsp_board_led_invert>:
    2. 205e8: b500 push {lr}
    3. 205ea: b083 sub sp, #12
    4. 205ec: 9001 str r0, [sp, #4]
    5. 205ee: 4a05 ldr r2, [pc, #20] ; (20604 <bsp_board_led_invert+0x1c>)
    6. 205f0: 9b01 ldr r3, [sp, #4]
    7. 205f2: 4413 add r3, r2
    8. 205f4: 781b ldrb r3, [r3, #0]
    9. 205f6: 4618 mov r0, r3
    10. 205f8: f7ff ff7e bl 204f8 <nrf_gpio_pin_toggle>
    11. 205fc: bf00 nop
    12. 205fe: b003 add sp, #12
    13. 20600: f85d fb04 ldr.w pc, [sp], #4
    14. 20604: 00020644 andeq r0, r2, r4, asr #12
    Display All

    The post was edited 1 time, last by maxl_1989: add function dump ().