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.

MCU-PLUS-SDK-AM243X: How can I debug the AM243x SBL via debugger ?

Part Number: MCU-PLUS-SDK-AM243X

Tool/software:

Hi,

I'm using the am243x with mcu_plus_sdk_am243x_09_01_00_41.

I use the OSPI SBL which successfully runs "Hello world" example code from 0x80000.

I've added to another Boot loader to syscfg to run code from 0x5DC000 (my ftp_loader code)

then added to SBL main.c 

uint32_t ul_app_image_addr=0x80000;
bootHandle = Bootloader_open(CONFIG_BOOTLOADER_FLASH0, &bootParams);
int32_t i_auth = App_authenticateAppImage(bootHandle,ul_app_image_addr);
if(i_auth == SystemP_SUCCESS)
DebugP_log("CD3E app authenticated \r\n");
else
{
ul_app_image_addr=0x5DC000;
bootHandle = Bootloader_open(CONFIG_BOOTLOADER_FLASH1, &bootParams);
i_auth = App_authenticateAppImage(bootHandle,ul_app_image_addr);
if(i_auth == SystemP_SUCCESS)
DebugP_log("CD3E ftp loader authenticated \r\n");
}//ftp loader

when I load my ftp_loader code via jtag - it works,

but if I put it in FLASH (0x80000 or in 0x5DC000) the SBL runs then writes 

SBL Certificate address: 0x60080000
SBL Authentication passed
CD3E app authenticated
[BOOTLOADER_PROFILE] Boot Media : NOR SPI FLASH
[BOOTLOADER_PROFILE] Boot Media Clock : 200.000 MHz
[BOOTLOADER_PROFILE] Boot Image Size : 0 KB
[BOOTLOADER_PROFILE] Cores present :
r5f0-0
[BOOTLOADER PROFILE] SYSFW init : 12154us
[BOOTLOADER PROFILE] System_init : 531us
[BOOTLOADER PROFILE] Drivers_open : 280us
[BOOTLOADER PROFILE] Board_driversOpen : 9674us
[BOOTLOADER PROFILE] Sciclient Get Version : 9911us
[BOOTLOADER PROFILE] CPU load : 73679us
[BOOTLOADER_PROFILE] SBL Total Time Taken : 106232us

Image loading done, switching to application ...

Then all stuck .

What can be the problem ?

How can I debug the SBL via debugger ?

Thanks,

Eli

  • The way I debug my SBL is:

    1.)Put boot mode pins to dev config

    2.)Insert a debug while test loop at the beginning of SBL code, like this:

    int test = 1;
    
    int main()
    {
        while(test);
        
        /*
        Rest of your SBL code
        */
    }

    3.)Recompile the SBL and put it in your boot media.

    4.)Reboot device. Your code will get stuck in while test loop.

    5.)Now you attach your debugger to the Boot core, in your case that would be the R5F0.

    6.)Load Symbols of SBL code

    7.)Pause execution.

    8.)Change value of test in runtime to 0.

    9.)Done, you now debug step through your code.

    Alternativley:

    1.)Erase your boot media

    2.)Put boot mode pins to dev config

    3.)Reboot device.

    4.)Load your SBL application on your Boot core, using CCS.

    5.)Done, Puse execution how ever you like.

    Now to understand what could be the problem that "Hello World" won't show. I don't know exactly could be N number of things. I guess you will have it find it out yourself.

  • Hi,

    I will try that.

    I have to find how to  "Put boot mode pins to dev config" , on my board.

    I think I can only get into the "UART boot mode" - then I load the "writer , SBL , Hello World" , via UART.

    Can I use the "UART boot mode" to debug the SBL ?

    Thanks,

    Eli

  • Hi ,

    Continuing on the above suggestion by  (permanent link: MCU-PLUS-SDK-AM243X: How can I debug the AM243x SBL via debugger? - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums),

    First, in case you have some optimised compilation, please prefer using 'volatile' qualifier to the test integer shown in the answer so that the empty-body loop doesn't get optimised out in your source. Once it hits upto that point, it can be set to 0 (false) using a debug session and stepping or running it with/without breakpoints thereon to continue debugging.

    I have to find how to  "Put boot mode pins to dev config" , on my board.

    This means to switch to Dev Boot Mode (previously called as "No Boot" Mode). You can check for its boot mode switch configuration from here: AM243x MCU+ SDK: EVM Setup (ti.com). This has to be done after flashing image (and to let it run until it hits the while loop used) so that it gets into the SBL upto the loop line, and thereon it can be checked by connecting to the flashed core using CCS Debug with its Target Configuration and then using Load Symbols option with the flashed image binary to load the debug symbol information.

    I can only get into the "UART boot mode" - then I load the "writer , SBL , Hello World" , via UART

    Yes, I understand that when using UART Flashing, UART Boot Mode is the only Boot Mode used which may not allow a boot mode switch when the program is flashed and run for once following some 2-5 seconds after the flash. So, in order to flash the SBL and then check, you may try connecting to the core with Code Composer Studio while on the same UART/OSPI Boot Mode which has loaded and run the flashed application (that may face a connection issue, please confirm) or go with the standard core connect and debug with Dev Boot Mode on Code Composer Studio's Program Load way if you have to check using the executable binary (generally .out or core-specific .xer5f, .xea52 and so on) of your program, as suggested in the above original answer.

    Can I use the "UART boot mode" to debug the SBL ?

    When using TI CCS, I would consider that if you are able to connect to your core while being on the same UART boot mode, you may be able to continue debugging with the same boot mode.

    I hope it adds some details that you were looking for.

    Thanks,
    Harshit

  • Hi Eli,

    Can I use the "UART boot mode" to debug the SBL ?

    I am assuming that you are able to use OSPI boot mode to boot the device from OSPI media. You can flash the SBL using UART and then switch to OSPI boot mode, connect the debugger and start debugging SBL example.

    To know about the SOC initialization using SBL binaries, please refer Flash SBL binaries. 

    Please refer faq-am62x-am64x-faq-debugging-sbl-boot-in-rtos-sdk for detailed steps on debugging SBL.

    Hope the above information helps.

    Regards,

    Tushar

  • Hi Tushar,

    I'll try.

    Thanks,

    Regards,

    Eli

  • Hi Harshit,

    I'll try that.

    Thanks,

    Regards,

    Eli

  • Hi Eli,

    I'll try.

    Looking forward to your response.

    Regards,

    Tushar