Skip to main content
Visitor II
May 29, 2023
Solved

STM32MP135 tf-a-stm32mp problem with compilation

  • May 29, 2023
  • 8 replies
  • 2634 views

Hi,

I have a rather simple question. I use cube mx to generate dts, my Openstlinux is v22.11.23 and during 'bitbake tf-a-stm32mp' I encounter a lack of definition in some '*.c' files like

 Built stm32image successfully
| 
| CC drivers/st/ddr/stm32mp1_ram.c
| CC drivers/st/ddr/stm32mp_ddr_test.c
| CC drivers/st/ddr/stm32mp_ram.c
| drivers/st/crypto/stm32_hash.c: In function 'hash_hw_init':
| drivers/st/crypto/stm32_hash.c:161:24: error: 'HASH_CR_ALGO_SHA1' undeclared (first use in this function)
| 161 | reg |= HASH_CR_ALGO_SHA1;
| | ^~~~~~~~~~~~~~~~~
| drivers/st/crypto/stm32_hash.c:161:24: note: each undeclared identifier is reported only once for each function it appears in
| drivers/st/ddr/stm32mp1_ddr.c: In function 'stm32mp1_ddr3_dll_off':
| drivers/st/ddr/stm32mp1_ddr.c:491:26: error: 'DDRPHYC' undeclared (first use in this function); did you mean 'DDRPHYC_PIR'?
| 491 | if (clk_get_rate(DDRPHYC) < 100000000U) {
| | ^~~~~~~
| | DDRPHYC_PIR
| drivers/st/ddr/stm32mp1_ddr.c:491:26: note: each undeclared identifier is reported only once for each function it appears in
| drivers/st/crypto/stm32_hash.c:165:24: error: 'HASH_CR_ALGO_SHA224' undeclared (first use in this function)
| 165 | reg |= HASH_CR_ALGO_SHA224;

Did I miss something? During the code investigation, it seems to miss #define STM32MP13 somewhere, but where? Or maybe it different kind of problem.

    This topic has been closed for replies.
    Best answer by OlivierK

    Hello,

     

    The overall project is too large to include it in my github repo despite cleaning most of temp and cache files. (I tried but got many hangs up from server).

    Anyway, here's the ctm layer I used including cubemx DTS files, but it has nothing exotic. The stm32mp13 cubemx project is very simple (cubemx6.8.1).

    bitbake tf-a-stm32mp -> run to completion.

     

    For issues you may have encountered during the do_compile, you may try to clean then deploy again.

    bitbake tf-a-stm32mp -c clean

    bitbake tf-a-stm32mp -c deploy

     

    Hope it helps.

     

    Regards,

    Olivier

     

    8 replies

    Technical Moderator
    May 31, 2023
    MWoło.2Author
    Visitor II
    June 1, 2023

    Hi Oliver,

    Yes, I think I followed on mentioned instructions but nothing helped.

    My machine.conf

    #@TYPE: Machine
    #@NAME: stm32mp13-mx
    #@DESCRIPTION: Configuration for STM32CubeMX generated project
    #@NEEDED_BSPLAYERS: layers/meta-openembedded/meta-oe layers/meta-openembedded/meta-python layers/meta-st/meta-st-stm32mp-addons
     
    ###########################################################################
    #
    # Default machine configuration sections
    #
    ###########################################################################
     
    include conf/machine/include/st-machine-common-stm32mp.inc
    include conf/machine/include/st-machine-providers-stm32mp.inc
     
    # Define specific common machine name
    MACHINEOVERRIDES .= ":stm32mp1common:stm32mp13common"
    MACHINEOVERRIDES .= ":stm32mpsagittarius"
     
    # =========================================================================
    # Chip architecture
    # =========================================================================
    DEFAULTTUNE = "cortexa7thf-neon-vfpv4"
    include conf/machine/include/arm/armv7a/tune-cortexa7.inc
     
    # =========================================================================
    # Machine settings
    # =========================================================================
    STM32MP_DEVICETREE = "${CUBEMX_DTB}"
     
    # =========================================================================
    # Machine features (default for stm32mp1 like)
    # =========================================================================
    MACHINE_FEATURES += "splashscreen"
    MACHINE_FEATURES += "watchdog"
    MACHINE_FEATURES += "${@'gpu' if d.getVar('ACCEPT_EULA_'+d.getVar('MACHINE')) == '1' else ''}"
    MACHINE_FEATURES += "m4copro"
     
    # =========================================================================
    # Device Storage
    # =========================================================================
    # Enable the board device storage support with CUBEMX_DTB according to BOOTDEVICE_LABELS
    DEVICE_BOARD_ENABLE:NAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${CUBEMX_DTB}', '', d)}"
    DEVICE_BOARD_ENABLE:NOR += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard' , '${CUBEMX_DTB}', '', d)}"
    DEVICE_BOARD_ENABLE:EMMC += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', '${CUBEMX_DTB}', '', d)}"
    DEVICE_BOARD_ENABLE:SDCARD += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', '${CUBEMX_DTB}', '', d)}"
     
    # =========================================================================
    # Flashlayout
    # =========================================================================
    # Set the FLASHLAYOUT_TYPE_LABELS to CUBEMX_DTB according to BOOTDEVICE_LABELS
    FLASHLAYOUT_TYPE_LABELS:emmc = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', '${CUBEMX_DTB}', '', d)}"
    FLASHLAYOUT_TYPE_LABELS:nand-4-256 = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${CUBEMX_DTB}', '', d)}"
    FLASHLAYOUT_TYPE_LABELS:nor-sdcard = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard' , '${CUBEMX_DTB}', '', d)}"
    FLASHLAYOUT_TYPE_LABELS:sdcard = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', '${CUBEMX_DTB}', '', d)}"
     
    # Specific settings for 'extensible' and 'deleteall' configurations
    FLASHLAYOUT_CONFIG_LABELS:deleteall = "cubemx"
    FLASHLAYOUT_TYPE_LABELS:deleteall:cubemx = "${CUBEMX_DTB}"
    FLASHLAYOUT_TYPE_LABELS:extensible = "${CUBEMX_DTB}"
     
    # =========================================================================
    # CubeMX extra config
    # =========================================================================
    ENABLE_CUBEMX_DTB ?= "1"
     
    ###########################################################################
    #
    # User machine customization sections
    #
    ###########################################################################
     
    UBOOT_EXTLINUX_SPLASH = "${@'${UBOOT_SPLASH_LANDSCAPE_IMAGE}' if d.getVar('DISPLAY_ORIENTATION') == 'landscape' \
     else '${UBOOT_SPLASH_PORTRAIT_IMAGE}'}"
     
    BOOTSCHEME_LABELS += "trusted"
    #BOOTSCHEME_LABELS += "optee"
     
    # Bootloader config file
    UBOOT_CONFIG[trusted_stm32mp13] = "m1-sagittarius-mx-trusted_defconfig,,u-boot.dtb"
     
    DEVICE_STORAGE = "EMMC:mmc1, NAND:nand0, NOR:nor0, SDCARD:mmc0, SPINAND:spi-nand0"
     
    # Boot Device Choice
    # =========================================================================
    # Define the boot device supported
    BOOTDEVICE_LABELS += "sdcard"
    BOOTDEVICE_LABELS += "emmc"
    #BOOTDEVICE_LABELS += "nand-4-256"
    #BOOTDEVICE_LABELS += "nor-sdcard"
     
    # Connected display orientation: 'portrait', 'landscape'
    DISPLAY_ORIENTATION = "portrait"
     
    # Support Feature Choice
    # =========================================================================
    # Define the features to enable on board
    #MACHINE_FEATURES += "bluetooth"
    #MACHINE_FEATURES += "wifi"
     
    # Specific firmwares and kernel modules configuration
    # =========================================================================
    # Set the list of kernel module to be auto-loaded during boot
    KERNEL_MODULE_AUTOLOAD += ""
    MACHINE_EXTRA_RDEPENDS += "kernel-modules"
     
    # Set Bluetooth related package list needed when 'bluetooth' feature is enabled
    #BLUETOOTH_LIST += ""
     
    # Set Wifi related package list needed when 'wifi' feature is enabled
    #WIFI_LIST += ""
     
    # CubeMX Project Config
    # =========================================================================
    # Assign CubeMX Board devicetree and project path name
    CUBEMX_DTB = "mp135f-sagittarius-mx"
    CUBEMX_PROJECT = "mx/mp13-sgaittraius"
     
    # Indicate which STM32MP package are used: 'A', 'C', 'D' or 'F'
    CUBEMX_SOC_PACKAGE = "C"
     
    # Indicate the size of DDR available on BOARD: 512 or 1024 (size in MB unit)
    CUBEMX_BOARD_DDR_SIZE = "512"
     
    # Indicate if you like to disable the DVFS which are activated by default
    CUBEMX_SOC_DVFS_OFF = "0"

    and layer.conf

    # We have a conf and classes directory, add to BBPATH
    BBPATH .= ":${LAYERDIR}"
     
    # We have a recipes-* directories, add to BBFILES
    BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
    	${LAYERDIR}/recipes-*/*/*.bbappend"
     
    BBFILE_COLLECTIONS += "meta-sagittarius"
    BBFILE_PATTERN_meta-sagittarius := "^${LAYERDIR}/"
    BBFILE_PRIORITY_meta-sagittarius = "7"
     
    EULA_FILE_ST:stm32mpsagittarius = "${LAYERDIR}/conf/eula/${MACHINE}"
    EULA_FILE_ST_MD5SUM:stm32mpsagittarius = "8b505090fb679839cefbcc784afe8ce9"
     
    #Inform bitbake for adding another location to search for licenses
    LICENSE_PATH += "${LAYERDIR}/files/licenses"
     
    EULA_FILE_ST:stm32mp13commonmx = "${LAYERDIR}/conf/eula/${MACHINE}"
    EULA_FILE_ST_MD5SUM:stm32mp13commonmx = "0a914c9b1cc125c57262a61d9251b8ff"
     
    # This should only be incremented on significant changes that will
    # cause compatibility issues with other layers
    LAYERSERIES_COMPAT_meta-sagittarius = "kirkstone"
     
    # for optee-os-stm32mp dependency
    LAYERDEPENDS_meta-sagittarius = "core openembedded-layer meta-python stm-st-stm32mp-mx"
     
    # OpenSTLinux compatibility version
    ST_OSTL_COMPATIBILITY_VERSION_meta-sagittarius = "4.1.0"
     
    # Set a variable to get the STM32MP MX BSP location
    STM32MP_SAGITTARIUS = "${LAYERDIR}"
     
    # This should only be incremented on significant changes that may
    # cause compatibility issues with other layers
    LAYERVERSION_meta-sagittarius = "1"

    Maybe I missed something. I did not found yet any mx examples just ...dk2.

    BR Michal

    MWoło.2Author
    Visitor II
    June 3, 2023

    I make my metal layer public. Can You please reproduce my problem

    https://github.com/voloviq/meta-sagittarius

    Thanks

    Technical Moderator
    June 6, 2023

    Hi MWoło.2 (Community Member)

    No issues to report on my side, I've included a CubeMX mp13 project in my OSTL distribution-package DV4.1, following the guidelines from:

    https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Distribution_Package

    https://wiki.st.com/stm32mpu/wiki/How_to_create_a_new_open_embedded_layer

    • I've created/added a new layer, as mentioned it is not recomended to use the existing meta-st-stm32mp-addons (it is for reference only)
    • For the missing #define stm32mp13 config, it is done at this stage, as described here:

    https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Distribution_Package#Prepare_the_machine_configuration_file

    ->cp layers/meta-st/meta-st-stm32mp-addons/conf/machine/stm32mp13-mx.conf <your layer>/conf/machine/<machine.conf>

    Rgds,

    Olivier

    MWoło.2Author
    Visitor II
    June 6, 2023

    Hi Olivier,

    I kindly asked You to share Your demo project on GitHub for instance.

    PS.

    IMHO, the template meta-demo-layer is much better than the best-generated guide.

    Thanks for Your help and time

    BR Michal

    OlivierKAnswer
    Technical Moderator
    June 8, 2023

    Hello,

     

    The overall project is too large to include it in my github repo despite cleaning most of temp and cache files. (I tried but got many hangs up from server).

    Anyway, here's the ctm layer I used including cubemx DTS files, but it has nothing exotic. The stm32mp13 cubemx project is very simple (cubemx6.8.1).

    bitbake tf-a-stm32mp -> run to completion.

     

    For issues you may have encountered during the do_compile, you may try to clean then deploy again.

    bitbake tf-a-stm32mp -c clean

    bitbake tf-a-stm32mp -c deploy

     

    Hope it helps.

     

    Regards,

    Olivier

     

    MWoło.2Author
    Visitor II
    June 8, 2023

    Thanks a lot Olivier,

    I try and let You know.

    BR Michal

    MWoło.2Author
    Visitor II
    June 9, 2023

    Hi Olivier,

    first thanks for Your template, it was very helpful. My problem was related not to the layer, conf etc. but to dts. Precisely the project name, the project name has to have a CPU model name, it was my fault to change it manually. This compatible name can't be changed manually.

    compatible = "st,stm32mp135f-sagittarius-mx", "st,stm32mp135";

    So according to this now the compilation process pass successfully.

    Many thanks

    BR Michal