cancel
Showing results for 
Search instead for 
Did you mean: 

How to boot CDC_Standalone on DDR3 via SD card.

it3
Associate II

Hello,

 

I am trying to boot a Hi-Speed USB Device application using the STM32MP135F-DK by loading it from an SD card to DDR3, but it is not working. To investigate the issue, I am trying to boot CDC_Standalone that is included in STM32Cube_FW_MP13_V1.1.0 by loading it from an SD card to DDR3, but it is not going well too. I am following the procedure as below.

  1. Change the linker script of CDC_Standalone to use DDR_BASE as attached "stm32mp13xx_a7_ddr.ld.txt" and define USE_DDR.
    Reference: Build application for DDR
  2. Change CDC_Standalone to sign the application via postbuild steps and scripts.
    Reference: Create signed application.
  3. Create a loader for the signed CDC_Standalone based on SD_Ext_Loader in STM32Cube_FW_MP13_V1.1.0.
  4. Write the application to an SD card via UART interface by using STM32CubeProgrammer and try to boot it.
    Reference: How_to_load_and_start_STM32CubeMP13_applications_via_microSD_card

After following the procedure, the blue LED lights up momentarily and turns off immediately. After that, the light remains off. ROM code execution and FSBL execution seems to succeeded.
Reference: How to diagnose a boot failure 

Even after adding code to CDC_Standalone to turn on the blue LED, the blue LED remains off, so it looks that CDC_Standalone is not booting at all.

--

I am investigating the issue and found some feature.

  • When USBD_CDC in usb_cdc.c is not linked to the application, CDC_Standalone can boot from SD card.
  • CDC_Standalone can boot from SD card if USBD_ClassTypeDef that is a type of USBD_CDC has 204 bytes padding at the tail of it even if USBD_CDC is linked as below.

 

typedef struct _Device_cb
{
  uint8_t (*Init)(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx);
  uint8_t (*DeInit)(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx);
  /* Control Endpoints*/
  uint8_t (*Setup)(struct _USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef  *req);
  uint8_t (*EP0_TxSent)(struct _USBD_HandleTypeDef *pdev);
  uint8_t (*EP0_RxReady)(struct _USBD_HandleTypeDef *pdev);
  /* Class Specific Endpoints*/
  uint8_t (*DataIn)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum);
  uint8_t (*DataOut)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum);
  uint8_t (*SOF)(struct _USBD_HandleTypeDef *pdev);
  uint8_t (*IsoINIncomplete)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum);
  uint8_t (*IsoOUTIncomplete)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum);

  uint8_t  *(*GetHSConfigDescriptor)(uint16_t *length);
  uint8_t  *(*GetFSConfigDescriptor)(uint16_t *length);
  uint8_t  *(*GetOtherSpeedConfigDescriptor)(uint16_t *length);
  uint8_t  *(*GetDeviceQualifierDescriptor)(uint16_t *length);
  // uint32_t dummy[50];  // Cannot boot from SD card.
  uint32_t dummy[51];  // Can boot from SD card.
} USBD_ClassTypeDef;

 

 

  • Also CDC_Standalone can boot from SD card by 204 bytes padding after __DATA_END__ of .data sections below instead of the above padding.

 

    .data . : {
        RW_DATA = .;
        *(.data*)
        __DATA_END__ = .;
    } >RAM

    .igot.plt : {
        *(.igot.plt*)

        /* Cannot boot from SD card */
        /* . += 0xc8; */

        /* Can boot from SD card */
        . += 0xcc;
    } >RAM

    /*
     * The .bss section gets initialised to 0 at runtime.
     * Its base address must be 16-byte aligned.
     */
    .bss : ALIGN(32) {
        ZI_DATA = .;
        *(SORT_BY_ALIGNMENT(.bss*))
        *(COMMON)
        . = ALIGN(32);
        __BSS_END__ = .;
    } >RAM

 

 

I could boot my Hi-Speed USB Device application by the same way, but I would like to know what is the correct way to boot CDC_Standalone from SD card.

--

 

I am attaching two map files for reference.

  • CDC_Standalone_A7_fail.map.txt
    A map file of CDC_Standalone that cannot boot from SD card.
  • CDC_Standalone_A7_ok.map.txt
    A map file of CDC_Standalone that the linker scripts changed and can boot from SD card.

 

Best regards,

1 ACCEPTED SOLUTION

Accepted Solutions
it3
Associate II

Hello,

 

I solved it myself.

 

I checked my SD_Ext_Loader and was old one in STM32Cube_FW_MP13_V1.0.0. I updated SD_Ext_Loader to the latest one in STM32Cube_FW_MP13_V1.1.0. As a result, CDC_Standalone and my USB Device application both boot from SD card without any padding.

 

Thank you,

View solution in original post

2 REPLIES 2
it3
Associate II

Hello,

 

The following code is more simple changes of linker script that the CDC_Standalone application can boot from SD card. The application can boot even if the padding is before RW_DATA or after RW_DATA or before __DATA_END__.

    .data . : {
        RW_DATA = .;
        *(.data*)
        __DATA_END__ = .;

        /* Dummy padding */
        . += 0xcc;
    } >RAM

 

Best regards,

it3
Associate II

Hello,

 

I solved it myself.

 

I checked my SD_Ext_Loader and was old one in STM32Cube_FW_MP13_V1.0.0. I updated SD_Ext_Loader to the latest one in STM32Cube_FW_MP13_V1.1.0. As a result, CDC_Standalone and my USB Device application both boot from SD card without any padding.

 

Thank you,