No RTT output when enabling mcuboot

I am working on a custom board featuring a nrf9160, when i run the zephyr hello_world application with:

CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y 
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096
CONFIG_LOG_MODE_IMMEDIATE=y

Everything works and i can see the output in JLinkRTTViewer. But when i enable:


CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_BOOTUTIL_LIB=y

i get no output at all. The application seems to be running since i can see the current consumption changing.


I found this: Cannot see both bootloader and application RTT output #53544 Closed which seems to be an issue with only being able to see either mcuboot logs or applications logs which is not really the case for me. I cant see anything.

But i tried to add the patches suggested by giansta but it still does not work. This is part of what i got from objdump on the .elf file:

objdump -t zephyr.elf | grep RTT
2000c568 l    d  _RTT_SECTION_NAME      00000000 _RTT_SECTION_NAME
00000000 l    df *ABS*  00000000 SEGGER_RTT.c
2000c578 l     O _RTT_SECTION_NAME      00001000 _acUpBuffer
2000c568 l     O _RTT_SECTION_NAME      00000010 _acDownBuffer
2000c568 l       _RTT_SECTION_NAME      00000000 $d
00000000 l    df *ABS*  00000000 SEGGER_RTT_zephyr.c
00000001 g     O *ABS*  00000000 CONFIG_SEGGER_RTT_SECTION_CUSTOM
0002843d g     F text   00000058 SEGGER_RTT_WriteNoLock
000284d9 g     F text   00000030 SEGGER_RTT_Init
00000000 g     O *ABS*  00000000 CONFIG_SEGGER_RTT_MODE
2000c568 g       _RTT_SECTION_NAME      00000000 __rtt_buff_data_start
00000001 g     O *ABS*  00000000 CONFIG_SEGGER_RTT_SECTION_CUSTOM_NAME
2000c580 g       _RTT_SECTION_NAME      00000000 _image_ram_start
2000d578 g     O _RTT_SECTION_NAME      000000a8 _SEGGER_RTT
2000d620 g       _RTT_SECTION_NAME      00000000 __rtt_buff_data_end


I have also tried to disable logs from mcuboot by adding a child_image/mcuboot.conf with:

CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_OFF=y
CONFIG_LOG=n

but this also did not work.

I am on Ubuntu 22.04.5 LTS
using nrf connect sdk 2.6.1 and J Link V7.94i.

Parents
  • I tried to use your config but still got no output on my custom nrf9160 board. I got when i built and ran it for nrf9160 devkit like before. I also tried to run the build for the custom board on the devkit and then i got:

    [Sec Thread] Secure image initializing!
    TF-M isolation level is: 0x00000001
    Booting TF-M v2.0.0
    FATAL ERROR: SecureFault
    Here is some context for the exception:
        EXC_RETURN (LR): 0xFFFFFFBD
        Exception came from non-secure FW in thread mode.
        xPSR:    0x60000007
        MSP:     0x20000BF8
        PSP:     0x200018B8
        MSP_NS:  0x2000E770
        PSP_NS:  0x2000E590
        Exception frame at: 0x2000E590
            R0:   0x40000105
            R1:   0x020103F5
            R2:   0x2000E660
            R3:   0x2000E688
            R12:  0x00019850
            LR:   0x0001B78F
            PC:   0x00007C20
            xPSR: 0x61000000
        Callee saved register state:        R4:   0x00007C21
            R5:   0x40000105
            R6:   0x020103F5
            R7:   0x2000E660
            R8:   0x00000000
            R9:   0x00019850
            R10:  0x00019850
            R11:  0x00019850
        CFSR:  0x00000000
        BFSR:  0x00000000
        BFAR:  Not Valid
        MMFSR: 0x00000000
        MMFAR: Not Valid
        UFSR:  0x00000000
        HFSR:  0x00000000
        SFSR:  0x00000001
        SFAR: Not Valid

    addr2line -e zephyr.elf 0x0001B78F
    /home/ncs/v2.6.1/zephyr/modules/trusted-firmware-m/interface/interface.c:60

    shows that it is coming from

    tfm_ns_interface_dispatch()
    and the line:
    result = fn(arg0, arg1, arg2, arg3);


    here is the build folder:
    0361.build.tar.gz
  • I managed to fix the secure fault by adding some missing configurations in my boards defconfig files. But the main issue still remains, i cant see any logs on my custom board when mcuboot is enabled.

    this is my build folder now:
    2630.build.tar.gz

  • I see. There should not be a fundamental difference between a DK and a custom board when it comes to RTT, as it is just a RAM buffer that is accessed by the degbugger, so I suspect a configuration issue of some sort. Can you share your board files for your custom board?

  • The defconfigs are exactly the same as thingy 91 except that i have removed:

    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    

    from both secure and non secure.

  • I see. There must be something though, and I am not able to see what that oculd be.. Can you share your custom board files as well as the map file (or full build folder again) you bild for the DK (where you confirmed RTT works and the map file for your custom board (where it does not)? (same exact project, just built for the working and non-working board)

Reply Children
  • build_folders.tar.gz

    "build" is the build folder for the custom board and "build_1" is for the devkit.

  • Hi

    Thanks. Looking at these files, in both cases the map files look good and same with regards to RTT, and also the configs. I do not see anything that explains this. What happens if you build and run the project built for the custom board on the DK (I assuem somethings will fail, but perhaps not until after something has been written to the RTT buffer). Do you get output then?

  • If i program the DK with the project built for the custom board i get 

     "[Sec Thread] Secure image initializing!
    TF-M isolation level is: 0x00000001
    Booting TF-M v2.0.0"

    in the serial terminal and then i get the "hello world" application output in the JLinkRTTViewer.

  • I see. Then this should really work on the custom board as well. At least from an RTT perspective, as that does not depend on anything on the board (just the SoC itself and the debugger). Can you debug a bit further to verify that the application runs properly and that the code that should log to RTT runs successfully? Perhaps stepping down and verifying if things actually gets written to the RTT Buffer, or if not, why?

  • I have noticed that when i remove CONFIG_BOOTLOADER_MCUBOOT=y from the custom boards _ns_defconfig but enable it in prj.conf i get this output in the RTTViewer, when i add CONFIG_BOOTLOADER_MCUBOOT=y back to the _ns_defconfig i get no output.

    ******  BBoooottiinngg  nnRRFF  CCoonnnneecctt  SSDDKK  vv33..55..9999--nnccss11--11  ******
    
    II::  SSttaarrttiinngg  bboooottllooaaddeerr
    
    II::  PPrriimmaarryy  iimmaaggee::  mmaaggiicc==uunnsseett,,  sswwaapp__ttyyppee==00xx11,,  ccooppyy__ddoonnee==00xx33,,  iimmaaggee__ookk==00xx33
    
    II::  SSeeccoonnddaarryy  iimmaaggee::  mmaaggiicc==uunnsseett,,  sswwaapp__ttyyppee==00xx11,,  ccooppyy__ddoonnee==00xx33,,  iimmaaggee__ookk==00xx33
    
    II::  BBoooott  ssoouurrccee::  nnoonnee
    
    II::  IImmaaggee  iinnddeexx::  00,,  SSwwaapp  ttyyppee::  nnoonnee
    
    II::  BBoooottllooaaddeerr  cchhaaiinnllooaadd  aaddddrreessss  ooffffsseett::  00xx1100000000
    
    II::  JJuummppiinngg  ttoo  tthhee  ffiirrsstt  iimmaaggee  sslloott

Related