[SOLVED] J-Link Debugger crashes when loading GHS .elf file

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

  • [SOLVED] J-Link Debugger crashes when loading GHS .elf file

    Hello,

    I am trying to use J-Link Debugger V1.78 with an .elf file generated using Green Hills compiler suite(GHS).
    When using the New Project Wizard, after selecting the .elf file, the program crashes. I am able to load an .elf file generated with GCC, so I believe there is an error with the .elf format generated by GHS.

    I have found a topic which I think describes a similar problem, stating that some compiler .elfs are not supported:
    [SOLVED] JScope crashes

    Is this compiler output not supported?
    I would appreciate any advice and I am sorry if this is an inappropriate questions(I am a beginner with these tools).

    Thank you,
    Marius
  • Hello Marius,

    thanks for your inquiry. Would it be possible to provide us an elf file and / or the project (or another project) for reproduction purposes?
    If you do not want to post it here, you can send me a download link via Personal Message, or we can continue this conversation via mail.

    Best regards,
    Niklas
    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,

    Thanks for providing the ELF file.
    We can reproduce the problem and will fix it in the J-Link Debugger.


    - Alex
    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,

    We have added a preliminary fix for this.
    Anyhow, the ELF information looks somewhat strange for the case where J-Link Debugger crashed.
    Would it be possible to explain how dataPtrUnaligned is declared in your source code?
    The code should look like below.
    Anyhow, we are curious of what type dataPtrUnaligned is.
    void* dataPtrUnaligned?

    C Source Code

    1. C:/tools/tresos_14_2_1/plugins/Fls_TS_T40D2M8I0R0/src/Fls.c
    2. Fls_Flash_SectorRead(phySector, sectorOffset, dataLength, dataPtr) {
    3. [var] initDataLength;
    4. [var] RetVal;
    5. [var] readAddressEndPtr;
    6. [var] readBlockAddressEndPtr;
    7. [var] dataPtrUnaligned;
    8. }



    Best regards
    Alex
    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,

    The code looks like that and dataPtrUnaligned variable is defined like:

    __packed P2VAR(uint32, AUTOMATIC, FLS_APPL_DATA) volatile dataPtrUnaligned = NULL_PTR;

    The __packed qualifier is needed because of a pointer typecast; a similar usecase is described in more detail in the link below, under Compiler assumptions paragraph:
    infocenter.arm.com/help/index.…arm.doc.faqs/ka15414.html


    Thank you and please tell me if I can provide more details.

    Marius

    The post was edited 1 time, last by mariusene ().

  • Hi,

    thanks for sharing this information.

    Thank you and please tell me if I can provide more details.

    Would it be possible to provide us with the definition of the P2VAR macro? (And optional, of AUTOMATIC and FLS_APPL_DATA ?)
    We are still researching if GHS generates a faulty .elf file or if GHS interprets the ELF/DWARF specs in a way we are not yet compatible with.

    Best regards,
    Niklas
    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.
  • FLS_APPL_DATA and AUTOMATIC are empty defines, so
    __packed P2VAR(uint32, AUTOMATIC, FLS_APPL_DATA) volatile dataPtrUnaligned = NULL_PTR;
    would translate to:
    __packed uint32 * volatile dataPtrUnaligned = NULL_PTR;

    Thank you,
    Marius
  • the P2VAR and similar macros come from the AUTOSAR world,
    it is resolved in an compiler abstraction header and
    P2VAR(uint32, AUTOMATIC, FLS_APPL_DATA)
    should result in uint32 *
    possibly in data section defined by FLS_APPL_DATA, which i guess as a flash driver variable.

    We use GHS and IAR and i had to write tools to convert GHS compiled obect files to be linkable and running with IAR.
    My understanding is that GHS has a different opionion about reloactions, ABI markup..
  • One more comment:
    the GHS compiler and IDE works with the GHS probes (price it a lot higher then a J-Link) and you need a license to use the probes.
    GHS multi has support for other probes too (MACRAIGOR, HP), but RDI support seem to be gone now.
    The interface of the multi debug probe interface (like rtserv.exe) is not public documented.
    Would be a dream to have GHS multi working with J-Link!
  • Hi,

    IDE support is doable if the IDE either supports a generic API like GDB or RDI or provides a documented API.
    If time intensive reverse engineering is required, IDE support will most likely only implemented on heavy public demand or customer order.


    Best regards,
    Niklas
    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.
  • Hello Niklas,

    i have asked our Green Hills support, and the interfaces are not public.

    Also from support point - who is in responsible in case of problems: user, GHS, Segger, chip manufacturer,..
    and i guess also from buisiness view there is no reason for GHS.
  • Hi Marius,


    the issue has been fixed in V1.79a of J-Link Debugger.

    Best regards,
    Niklas
    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.