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.

LP-AM243: sbl-ospi demo not working correctly after added a custom flash device.

Part Number: LP-AM243
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

Hello TI

We are testing example mcu_plus_sdk_am243x_09_02_01_05\examples\drivers\boot\sbl_ospi with a custome flash in am243-lp device. After flashing the flash with the sbl-ospi image, booting log is "Some tests have failed!!".
We tried to debug sbl_ospi using CCS, but the code were pending on init function and can not run further. 
We are confued that in CCS debug mode , we can not even print out "Some tests have failed!!", how can we debug sbl-ospi in CCS?
We can just add print to check the error location, we found that there are error when reading flash. so we just print all OSPI registers out, we found that OSPI registers are different from ospi register values when testing another demo "ospi_flash_io" under dev mode. In dev mode, after run load_dmsc.js, flash operation is correct.
Register values when testing demo "ospi flash io" in dev boot mode after run load_dmsc.js in ccs:
Reg_fc44000 : 68747900
Reg_fc44004 : 0
Reg_fc44008 : 2
Reg_fc44020 : 0
Reg_fc40000 : 80083841
Reg_fc40004 : 60222eb
Reg_fc40008 : 22002
Reg_fc4000c : a0a0a0a
Reg_fc40010 : 5
Reg_fc40014 : 101003
Reg_fc40018 : 3f
Reg_fc4001c : 0
Reg_fc40020 : 0
Reg_fc40024 : 0
Reg_fc40028 : 200
Reg_fc4002c : 0
Reg_fc40030 : 1
Reg_fc40034 : 1
Reg_fc40038 : 340ff
Reg_fc4003c : ffffffff
Reg_fc40040 : 0
Reg_fc40044 : 0
Reg_fc40048 : 0
Reg_fc4004c : 0
Reg_fc40050 : 0
Reg_fc40054 : 0
Reg_fc40058 : 0
Reg_fc4005c : 0
Reg_fc40060 : 0
Reg_fc40064 : 0
Reg_fc40068 : 0
Reg_fc4006c : 0
Reg_fc40070 : 0
Reg_fc40074 : ffffffff
Reg_fc40078 : 0
Reg_fc4007c : 0
Reg_fc40080 : 4
Reg_fc40084 : 0
Reg_fc40088 : 0
Reg_fc4008c : 0
Reg_fc40090 : 16800000
Reg_fc40094 : 0
Reg_fc40098 : 0
Reg_fc4009c : 0
Reg_fc400a0 : 80
Reg_fc400a4 : 0
Reg_fc400a8 : 0
Reg_fc400ac : 0
Reg_fc400b0 : 0
Reg_fc400b4 : 0
Reg_fc400b8 : 800000
Reg_fc400bc : 0
Reg_fc400c0 : 0
Reg_fc400c4 : 0
Reg_fc400c8 : 0
Reg_fc400cc : 0
Reg_fc400d0 : 0
Reg_fc400d4 : 0
Reg_fc400d8 : 0
Reg_fc400dc : 0
Reg_fc400e0 : 302fa00
Reg_fc400e4 : 6f90000
Reg_fc400e8 : 0
Reg_fc400ec : 0
Reg_fc400f0 : 0
Reg_fc400f4 : 0
Reg_fc400f8 : 0
Reg_fc400fc : 3000300
Register values when burned demo "ospi_sbl" binary to flash device and boot from ospi:
Reg_fc44000 : 68747900
Reg_fc44004 : 0
Reg_fc44008 : 2
Reg_fc44020 : 0
Reg_fc40000 : 80083841
Reg_fc40004 : 60222eb
Reg_fc40008 : 22002
Reg_fc4000c : a0a0a0a
Reg_fc40010 : 25
Reg_fc40014 : 101003
Reg_fc40018 : 3f
Reg_fc4001c : 0
Reg_fc40020 : 0
Reg_fc40024 : 0
Reg_fc40028 : 0
Reg_fc4002c : 0
Reg_fc40030 : 1
Reg_fc40034 : 1
Reg_fc40038 : 340ff
Reg_fc4003c : ffffffff
Reg_fc40040 : 0
Reg_fc40044 : 0
Reg_fc40048 : 0
Reg_fc4004c : 0
Reg_fc40050 : 0
Reg_fc40054 : 0
Reg_fc40058 : 0
Reg_fc4005c : 0
Reg_fc40060 : 0
Reg_fc40064 : 0
Reg_fc40068 : 0
Reg_fc4006c : 0
Reg_fc40070 : 0
Reg_fc40074 : ffffffff
Reg_fc40078 : 0
Reg_fc4007c : 0
Reg_fc40080 : f
Reg_fc40084 : 0
Reg_fc40088 : 0
Reg_fc4008c : 0
Reg_fc40090 : 710b8000
Reg_fc40094 : 4
Reg_fc40098 : 0
Reg_fc4009c : 0
Reg_fc400a0 : 42
Reg_fc400a4 : 0
Reg_fc400a8 : 4c
Reg_fc400ac : 0
Reg_fc400b0 : 0
Reg_fc400b4 : 0
Reg_fc400b8 : 800000
Reg_fc400bc : 0
Reg_fc400c0 : 0
Reg_fc400c4 : 0
Reg_fc400c8 : 0
Reg_fc400cc : 0
Reg_fc400d0 : 0
Reg_fc400d4 : 0
Reg_fc400d8 : 0
Reg_fc400dc : 0
Reg_fc400e0 : 302fa00
Reg_fc400e4 : 6f90000
Reg_fc400e8 : 0
Reg_fc400ec : 0
Reg_fc400f0 : 0
Reg_fc400f4 : 0
Reg_fc400f8 : 0
Reg_fc400fc : 3000300
Why flash operation is ok in dev boot mode after run load_dmsc.js for demo "ospi flash io" but not ok when just burn the demo "ospi_sbl" and then boot from ospi? The ospi flash configuration in syscfg are all the same between the two demo. 
Anybody can help for our ospi_sbl failure?  Looking forward to your reply.
  • Hello Cheng,

    It is possible to debug for sure.

    So you see that in SBL OSPI main.c file there is an api called loop_forever(). SO you essentially add that in your main.c file because currently it will not be added anywhere except for its declaration in main.c file. Once added rebuild your sbl ospi application.

    Now flash using python uart uniflash command the config file you are using.

    This will make sure that the files are flashed properly at their respective offsets, assuming you have default offset configured for SBL OSPI then it will be flashed at 0x0 to the flash part you are using.

    Now on this note, you set the bootmode to QSPI/OSPI bootmode and then simply go ahead and connect to the debugger. Once connected to the debugger via CCS, you can simply go ahead and connect to the core r50_0. Now you can simply load symbols which will be sbl ospi debug.out image.

    Once loaded you will see that the flow is stuck at loop forever and now from here onwards you can set the loop from 1 to 0 and step over to continue debugging.

    Regards,

    Vaibhav

  • Thanks Vaibhav

    void loop_forever()
    {
        volatile uint32_t loop = 1;
        while(loop)
            ;
    }
    
    int main()
    {
        int32_t status;
        loop_forever();
        Bootloader_socLoadSysFw();

    Like this?

  • Hello Cheng,

    Yes the above code looks fine.

    To know steps for debugging SBL, Please refer faq-am62x-am64x-faq-debugging-sbl-boot-in-rtos-sdk. 

    Regards,

    Tushar