This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VM: How to build SBL in debug mode j721e RTOS SDK?

Part Number: TDA4VM

Hi,

I am trying to build SBL in debug mode using BUILD_PROFILE=debug flag, but the build fails with the error “gmake: *** No rule to make target 'sbl_mmcsd_img'.  Stop.”.

Is there a way to build SBL in debug mode?

  • Hi,

    The size of SBL needs to be restricted due to memory restrictions posed by limited OCMC. Typically, OCMC needs to fit both SBL and firmware. Building in debug mode generally increases the size of binaries and there is a risk it might go beyond available memory. That’s why, by default, debug mode is disabled for SBL

    Although, there are some ways to build SBL for debugging:

    1) Enabling the debug mode

    You can enable the debug mode by modifying the sbl_component.mk at <pdkInstallPath>\packages\ti\boot\sbl\ .  See the patches below:

    1. sblComponent_8_0.patch
    2. sblComponent_8_1.patch

    Save and build the SBL using the command

    gmake BOARD=j721e_evm CORE=mcu1_0 BUILD_RPOFILE=debug sbl_{BootMode}_img

    where BootMode can be uart, mmcsd, ospi, cust

    This approach will give you complete control over SBL during debug, but this may fail in future releases, if the size of SBL increases for some reason This has been tested on j721e RTOS SDK 8.0 and 8.1.

     

    2) Building specific components in debug mode

    Instead of building the complete SBL in debug mode, you can build specific components which you need to debug and link them to SBL to keep the size of SBL in check. The easiest way to this is to build the component in debug mode using BUILD_PROFILE flag and then renaming the debug library as release.

    For example, if you want to debug “board”:

    1. gmake board BOARD=j721e_evm CORE=mcu1_0 BUILD_PROFILE=debug
    2. Rename <pdkInstallPath>\packages\ti\board\lib\j721e_evm\r5f\debug to <pdkInstallPath>\packages\ti\board\lib\j721e_evm\r5f\release
    3. Build the SBL image using

    gmake BOARD=j721e_evm CORE=mcu1_0 sbl_{BootMode}_img

     

    This approach will keep the size of SBL in check and give you more control over the components built in debug mode, but you still won’t be able to single step through SBL code.

     

    3) Removing compiler optimizations and rebuilding specific components

    This is similar to previous approach, but it will give you control over SBL code as well. You can remove the compiler optimization by modifying <pdkInstallPath>\packages\ti\build\makerules\rules_ti_cgt_arm.mk . See the patch below.

    1. rules_ti_cgt_arm_8_0.patch
    2. rules_ti_cgt_arm_8_1.patch

    Once the compiler optimization is removed, just rebuild the components you want to debug and the SBL release mode. This will give you control over the component and the SBL during debug.

    Please make sure to restore the optimizations once the debug is done, as it may affect the performance of your application.

    Regards,
    Parth