Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_project.py broken under Windows. #81

Open
rnicolas opened this issue Sep 25, 2024 · 6 comments
Open

build_project.py broken under Windows. #81

rnicolas opened this issue Sep 25, 2024 · 6 comments

Comments

@rnicolas
Copy link

Just follow the steps described in the README. When trying to build the firmware, I have got this error:

INFO:__main__:Building in C:\Users\Dell\SimplicityStudio\v5_workspace\silabs-firmware-builder\build
INFO:__main__:SDK ..\..\SDKs\gecko_sdk_4.4.4 has version 4.4.4
INFO:__main__:Version is correct, picking ..\..\SDKs\gecko_sdk_4.4.4
INFO:__main__:Building component graph and identifying board-specific files
Traceback (most recent call last):
  File "C:\Users\Dell\SimplicityStudio\v5_workspace\silabs-firmware-builder\tools\build_project.py", line 648, in <module>
    main()
  File "C:\Users\Dell\SimplicityStudio\v5_workspace\silabs-firmware-builder\tools\build_project.py", line 416, in main
    for name in determine_chip_specific_config_filenames(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dell\SimplicityStudio\v5_workspace\silabs-firmware-builder\tools\build_project.py", line 147, in determine_chip_specific_config_filenames
    proc = subprocess.run(
           ^^^^^^^^^^^^^^^
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

The command called is:

python .\tools\build_project.py --sdk ..\..\SDKs\gecko_sdk_4.4.4 --toolchain C:\SiliconLabs\SimplicityStudio\v5\developer\toolchains\gnu_arm\12.2.rel1_2023.7 --manifest .\manifests\nabucasa\yellow_ncp-uart-hw.yaml --build-dir build --output-dir output --output gbl --output out --output hex
@rnicolas
Copy link
Author

If I try to run the command in subprocess separately, which I think is this one:

slc graph --project-file "C:\Users\Dell\SimplicityStudio\v5_workspace\silabs-firmware-builder\src\ncp-uart-hw\ncp-uart-hw.slcp" --sdk "C:\Users\Dell\SimplicityStudio\SDKs\gecko_sdk_4.4.4"

I get this information:

EFR32MG21A010F1024IM32
  - cmsis_core
brd4001a
brd4179b
  - brd4179b_config
    - brd4179b [Cycle]
      - brd4179b_config ^ [Cycle]
      - EFR32MG21A010F1024IM32 (efr32mg21a010f1024im32)
        - cmsis_core
      - brd4001a (hardware_board_mainboard) Recommended! (brd4179b)
  - EFR32MG21A010F1024IM32 ^ (efr32mg21a010f1024im32)
  - brd4001a (hardware_board_mainboard) Recommended! (brd4179b)
iostream_usart
  - iostream_usart_core
    - emlib_gpio
      - EFR32MG21A010F1024IM32 ^ (device, device_has_gpio)
      - enum
      - cmsis_core
      - emlib_common
        - EFR32MG21A010F1024IM32 ^ (device)
        - sl_common
          - sl_assert
        - sl_assert
        - cmsis_core
    - iostream
      - iostream_vuart (iostream_transport_core)
        - segger_rtt
        - iostream ^ [Cycle]
        - debug_swo
          - emlib_gpio ^ (lld_gpio)
          - emlib_cmu
            - EFR32MG21A010F1024IM32 ^ (device, device_has_cmu)
            - emlib_gpio ^
            - emlib_syscfg
              - emlib_common ^
            - emlib_msc
              - EFR32MG21A010F1024IM32 ^ (device_has_msc, device)
              - emlib_cmu ^ [Cycle]
              - cmsis_core
              - emlib_system
                - EFR32MG21A010F1024IM32 ^ (device)
                - emlib_syscfg ^
                - cmsis_core
                - emlib_common ^
              - emlib_common ^
              - emlib_core
                - EFR32MG21A010F1024IM32 ^ (device)
                - cmsis_core
                - emlib_common ^
            - status
            - enum
            - emlib_emu
              - EFR32MG21A010F1024IM32 ^ (device, device_has_emu)
              - emlib_syscfg ^
              - emlib_cmu ^ [Cycle]
              - status
              - cmsis_core
              - emlib_system ^
              - emlib_common ^
              - emlib_core ^
            - cmsis_core
            - emlib_system ^
            - emlib_common ^
            - component_catalog
          - status
          - cmsis_core
      - iostream_debug (iostream_transport_core)
        - iostream ^ [Cycle]
        - debug_swo ^
      - iostream_usart_core ^ (iostream_transport_core)[Cycle]
      - status
      - enum
      - sl_assert
      - emlib_common ^
      - emlib_core ^
      - component_catalog
    - atomic
    - emlib_cmu ^
    - status
    - iostream_uart_common
      - iostream ^
      - atomic
      - sl_string
      - status
      - configuration_over_swo
        - debug_swo ^
        - status
        - enum
      - dmadrv
        - ecode
        - enum
        - emlib_ldma (lld_ldma)
          - EFR32MG21A010F1024IM32 ^ (device, device_has_ldma)
          - emlib_cmu ^
          - cmsis_core
          - emlib_common ^
          - emlib_core ^
        - emlib_core ^
    - emlib_usart
      - EFR32MG21A010F1024IM32 ^ (device, device_has_uart)
      - emlib_gpio ^
      - emlib_cmu ^
      - cmsis_core
      - emlib_common ^
  - EFR32MG21A010F1024IM32 ^ (device_has_usart)
  - dmadrv ^
iostream_vuart
  - segger_rtt
  - iostream ^
  - debug_swo ^
token_manager
  - se_manager
    - EFR32MG21A010F1024IM32 ^ (device)
    - se_manager_crypto
      - EFR32MG21A010F1024IM32 ^ (device)
      - status
      - emlib_se
        - EFR32MG21A010F1024IM32 ^ (device, device_series_2)
        - cmsis_core
        - emlib_common ^
      - emlib_system ^
      - emlib_common ^
      - emlib_core ^
    - se_manager_osal
      - se_manager_config
        - EFR32MG21A010F1024IM32 ^ (device)
      - emlib_core ^
    - status
    - emlib_se ^
    - se_manager_config ^
    - emlib_system ^
    - trustzone_unaware (trustzone_security_state) Recommended! (EFR32MG21A010F1024IM32, psa_crypto, mbedtls_core, psa_driver, psa_crypto_trng, se_manager)
    - emlib_common ^
    - emlib_core ^
  - zigbee_app_framework_common (wireless_stack)
    - zigbee_watchdog_periodic_refresh
    - zigbee_phy_2_4 (zigbee_phy) Recommended! (zigbee_app_framework_common)
    - sl_system
      - device_init_core
        - emlib_chip
          - EFR32MG21A010F1024IM32 ^ (device)
          - emlib_system ^ (lld_system)
          - cmsis_core
          - emlib_common ^
      - sl_system_init
        - event_handler
      - sl_system_process_action
        - event_handler
      - component_catalog
    - zigbee_pro_stack (zigbee_pro_stack_support)
      - zigbee_pro_stack_library (zigbee_pro_stack_implementation)
        - zigbee_pro_stack ^ [Cycle]
      - zigbee_stack_common
        - endianness
        - token_manager [Cycle]
          - se_manager ^
          - zigbee_app_framework_common ^ (wireless_stack)[Cycle]
          - token_manager_nvm3 (token_manager_storage) Recommended! (token_manager)
            - token_manager ^ [Cycle]
            - nvm3_default
              - nvm3_default_config
              - nvm3_lib (nvm3) Recommended! (nvm3_default)
                - ecode
                - emlib_msc ^
              - nvm3_default_flash_backend (nvm3_default_backend) Recommended! (nvm3_default)
            - nvm3_lib ^  Recommended! (nvm3_default)
          - component_catalog
        - rail_util_ieee802154_stack_event
          - EFR32MG21A010F1024IM32 ^ (device)
          - rail_lib
            - emlib_gpio ^
            - emlib_cmu ^
            - emlib_emu ^
            - rail_util_features
            - rail_lib_singleprotocol (rail_lib_Xprotocol) Recommended! (zigbee_stack_common, rail_lib)
              - rail_lib ^ [Cycle]
              - rail_util_built_in_phys
                - EFR32MG21A010F1024IM32 ^ (device)
                - emlib_cmu ^
                - rail_lib ^ [Cycle]
                - emlib_common ^
                - device_init_hfxo
                  - emlib_cmu ^
                  - status
                  - component_catalog
            - cmsis_core
            - emlib_system ^
            - rail_util_rf_path
              - EFR32MG21A010F1024IM32 ^ (device)
              - rail_lib ^ [Cycle]
            - emlib_core ^
            - emlib_prs
              - EFR32MG21A010F1024IM32 ^ (device, device_has_prs)
              - emlib_gpio ^
              - cmsis_core
              - emlib_common ^
            - rail_util_power_manager_init
              - rail_lib ^ [Cycle]
              - power_manager
                - power_manager_core
                  - atomic
                  - power_manager_deepsleep_blocking_hfxo_restore (power_manager_energy_mode_impl) Recommended! (power_manager_core)
                    - EFR32MG21A010F1024IM32 ^ (device_series_2, device_has_rtcc)
                    - power_manager ^ [Cycle]
                  - emlib_cmu ^
                  - sleeptimer
                    - emlib_timer (lld_timer)
                      - EFR32MG21A010F1024IM32 ^ (device, device_has_timer)
                      - cmsis_core
                      - emlib_common ^
                    - atomic
                    - emlib_rtcc
                      - EFR32MG21A010F1024IM32 ^ (device, device_has_rtcc)
                      - cmsis_core
                      - emlib_common ^
                    - emlib_cmu ^
                    - sl_common ^
                    - status
                    - emlib_burtc
                      - EFR32MG21A010F1024IM32 ^ (device, device_has_burtc)
                      - cmsis_core
                      - emlib_common ^
                    - sl_assert
                    - emlib_common ^ (lld_common)
                    - emlib_core ^
                  - status
                  - enum
                  - emlib_emu ^
                  - sl_assert
                  - slist
                    - emlib_common ^
                  - emlib_core ^
                - power_manager_handler_implementation (power_manager_handler) Recommended! (power_manager)
            - device_init_hfxo ^
          - status
          - emlib_common ^
        - EFR32MG21A010F1024IM32 ^ (device_supports_zigbee)
        - rail_lib ^
        - zigbee_strong_random_api_radio (zigbee_strong_random) Recommended! (zigbee_stack_common)
        - status
        - rail_util_ieee802154_phy_select
          - EFR32MG21A010F1024IM32 ^ (device)
          - rail_util_ieee802154_stack_event ^
          - rail_lib ^
          - status
          - emlib_common ^
        - zigbee_pro_stack ^ (zigbee_pro_stack_support)[Cycle]
        - zigbee_security_manager
          - zigbee_classic_key_storage (zigbee_key_storage) Recommended! (zigbee_security_manager)
            - psa_crypto_cipher_ecb
              - psa_crypto_aes
                - psa_crypto
                  - EFR32MG21A010F1024IM32 ^ (device)
                  - psa_crypto_config
                  - psa_crypto_source
                  - psa_crypto_common
                    - psa_crypto_config
                  - psa_driver
                    - trustzone_unaware (trustzone_security_state) Recommended! (EFR32MG21A010F1024IM32, psa_crypto, mbedtls_core, psa_driver, psa_crypto_trng, se_manager)
                    - psa_driver_source
                      - se_manager ^
                      - psa_crypto_common ^
                      - mbedtls_core
                        - mbedtls_config
                          - mbedtls_platform_dynamic_memory_allocation_config_default (mbedtls_platform_dynamic_memory_allocation_config) Recommended! (mbedtls_config)
                            - silabs_core_sl_malloc  Recommended! (EFR32MG21A010F1024IM32)
                          - component_catalog
                        - EFR32MG21A010F1024IM32 ^ (device)
                        - mbedtls_slcrypto
                          - mbedtls_slcrypto_driver
                            - se_manager ^
                            - emlib_se ^
                            - psa_driver ^ [Cycle]
                            - component_catalog
                        - mbedtls_source
                          - psa_crypto_common ^
                        - trustzone_unaware (trustzone_security_state) Recommended! (EFR32MG21A010F1024IM32, psa_crypto, mbedtls_core, psa_driver, psa_crypto_trng, se_manager)
                    - component_catalog
                  - trustzone_unaware (trustzone_security_state) Recommended! (EFR32MG21A010F1024IM32, psa_crypto, mbedtls_core, psa_driver, psa_crypto_trng, se_manager)
                  - mbedtls_core ^
                  - psa_crypto_trng
                    - psa_crypto_common ^
                    - psa_driver ^
                    - trustzone_unaware (trustzone_security_state) Recommended! (EFR32MG21A010F1024IM32, psa_crypto, mbedtls_core, psa_driver, psa_crypto_trng, se_manager)
            - psa_crypto_aes ^
            - psa_crypto_ccm
              - psa_crypto_aes ^
        - legacy_hal
          - legacy_hal_soc
            - iostream_usart_core ^
            - EFR32MG21A010F1024IM32 ^ (device)
            - token_manager ^ [Cycle]
            - legacy_hal_wdog
              - component_catalog
            - emlib_chip ^
            - emlib_cmu ^
            - rail_lib ^
            - sl_system ^
            - sleeptimer ^
            - status
            - emlib_rmu
              - EFR32MG21A010F1024IM32 ^ (device, device_has_emu)
              - emlib_emu ^
              - cmsis_core
              - emlib_common ^
            - device_init
              - device_init_emu
                - status
                - emlib_emu ^
              - device_init_clocks
                - emlib_cmu ^
                - status
              - device_init_nvic
                - status
                - emlib_core ^
              - board_control
                - emlib_gpio ^ (lld_gpio)
                - emlib_cmu ^
                - status
                - enum
                - configuration_over_swo ^
                - component_catalog
              - device_init_lfxo
                - emlib_cmu ^
                - status
              - device_init_hfrco  Recommended! (device_init)
                - emlib_cmu ^
                - status
              - device_init_hfxo ^
            - emlib_wdog
              - EFR32MG21A010F1024IM32 ^ (device, device_has_wdog)
              - cmsis_core
              - emlib_common ^
              - emlib_core ^
            - rail_util_pa
              - EFR32MG21A010F1024IM32 ^ (device)
              - emlib_cmu ^
              - rail_lib ^
              - emlib_common ^
            - emlib_core ^
            - power_manager ^
            - component_catalog
          - component_catalog
        - zigbee_app_framework_common ^ [Cycle]
        - component_catalog
    - rail_util_pti
      - emlib_gpio ^
      - rail_lib ^
    - zigbee_enhanced_routing
    - power_manager ^
  - token_manager_nvm3 ^ (token_manager_storage) Recommended! (token_manager)
  - component_catalog
zigbee_app_framework_common
  - zigbee_watchdog_periodic_refresh
  - zigbee_phy_2_4 (zigbee_phy) Recommended! (zigbee_app_framework_common)
  - sl_system ^
  - zigbee_pro_stack ^ (zigbee_pro_stack_support)
  - rail_util_pti ^
  - zigbee_enhanced_routing
  - power_manager ^
zigbee_debug_basic
  - iostream_debug ^
  - zigbee_debug_basic_library (zigbee_debug_basic_implementation)
    - zigbee_debug_basic [Cycle]
      - iostream_debug ^
      - zigbee_debug_basic_library ^ (zigbee_debug_basic_implementation)[Cycle]
      - legacy_hal ^
  - legacy_hal ^
zigbee_debug_extended
  - zigbee_debug_extended_library (zigbee_debug_extended_implementation)
    - zigbee_debug_extended [Cycle]
      - zigbee_debug_extended_library ^ (zigbee_debug_extended_implementation)[Cycle]
      - legacy_printf
        - iostream ^
        - status
        - component_catalog
      - zigbee_debug_basic ^
  - legacy_printf ^
  - zigbee_debug_basic ^
zigbee_debug_print
  - printf
    - iostream ^
zigbee_gp
  - zigbee_gp_library (zigbee_gp_implementation)
    - zigbee_gp [Cycle]
      - zigbee_gp_library ^ (zigbee_gp_implementation)[Cycle]
zigbee_mfglib
  - zigbee_mfglib_library (zigbee_mfglib_implementation)
    - zigbee_mfglib [Cycle]
      - zigbee_mfglib_library ^ (zigbee_mfglib_implementation)[Cycle]
zigbee_ncp_uart_hardware
  - zigbee_ncp_framework
    - bootloader_interface
      - EFR32MG21A010F1024IM32 ^ (device)
      - bootloader_app_properties
      - cmsis_core
      - trustzone_unaware (trustzone_security_state) Recommended! (EFR32MG21A010F1024IM32, psa_crypto, mbedtls_core, psa_driver, psa_crypto_trng, se_manager)
      - component_catalog
    - zigbee_ncp_uart_hardware (zigbee_ncp)[Cycle]
      - zigbee_ncp_framework ^ [Cycle]
      - legacy_ncp_ash
        - EFR32MG21A010F1024IM32 ^ (device)
        - token_manager ^
        - zigbee_debug_basic ^
        - legacy_common_ash
          - legacy_hal ^
          - component_catalog
        - component_catalog
      - zigbee_ncp_uart_library (zigbee_ncp_uart_implementation)
        - zigbee_ncp_uart_hardware ^ (zigbee_ncp_uart)[Cycle]
    - zigbee_zdo_cluster_filter
      - zigbee_stack_common ^
  - legacy_ncp_ash ^
  - zigbee_ncp_uart_library ^ (zigbee_ncp_uart_implementation)
zigbee_pro_stack
  - zigbee_pro_stack_library ^ (zigbee_pro_stack_implementation)
  - zigbee_stack_common ^
zigbee_r22_support
  - zigbee_r22_support_library (zigbee_r22_support_implementation)
    - zigbee_r22_support [Cycle]
      - zigbee_r22_support_library ^ (zigbee_r22_support_implementation)[Cycle]
zigbee_security_link_keys
zigbee_source_route
  - zigbee_source_route_library (zigbee_source_route_implementation)
    - zigbee_source_route [Cycle]
      - zigbee_source_route_library ^ (zigbee_source_route_implementation)[Cycle]
zigbee_token_interface
zigbee_zll
  - zigbee_zll_library (zigbee_zll_implementation)
    - zigbee_zll [Cycle]
      - zigbee_zll_library ^ (zigbee_zll_implementation)[Cycle]
ncp-uart-hw [Project]

@rnicolas
Copy link
Author

Found what triggered that error, turns out that even if slc is installed and in the path, the script needs to specify that the command to be executed is slc.bat in line 38. Now it's blaming it cannot run make, but I cannot find any make binary in the Simplicity Studio folders. I see in the Dockerfile it is installed as a dependency, but that is not specified in the README.md

@puddly
Copy link
Collaborator

puddly commented Sep 25, 2024

Windows isn't really a supported platform. We rely on GNU Make to build the resulting project so if you don't have it, either install it or run the tools via WSL.

@rnicolas
Copy link
Author

I can see that, because in the generated Makefile I see there are some calls to uname, which is not available in MS Windows. So, I solved the make "problem" by issuing winget install ezwinports.make, but now I am stuck there with the uname problem (I think line 163 on ncp-uart-hw.Makefile). Let me check if I can solve it through WSL.

@rnicolas
Copy link
Author

I managed to get something functional, but instead of using WSL and reinstalling all the tools I had already set up, I used MSYS2 and added its binaries to the system path. This allowed me to run the build script up to the point where it calls the script to generate the GBL file, which fails due to some improperly escaped paths. However, when I manually run the GBL generation script, it successfully creates a GBL file that is recognized by the Universal Silabs Flasher and also by the Home Assistant configurator when flashed. Now, I just need to figure out what's causing the issue with the incorrect paths.

@rnicolas
Copy link
Author

rnicolas commented Sep 27, 2024

I wanted to share how I managed in the end. And maybe it helps as reference for someone that has the system already setup in Windows and does not want to mix with more tools.

I installed MSYS2 by issuing winget install MSYS2.MSYS2, then in the MSYS2 terminal I installed make by executing pacman -S make, and then adding C:\msys64\usr\bin to the path.

After that, I made some adjustments in build_project.py, I successfully got everything working "nicely." The main issue I encountered was the incorrect recognition by make when trying to run Python. To resolve this, I removed the postbuild injection to the makefile and instead I called create_gbl.py right after the make command.

Here’s the revised post-build command I implemented:

    # Postbuild command
    command = [
        "python",
        str(args.postbuild).replace("\\", "/").lstrip("C:"),
        "postbuild",
        str((args.build_dir / base_project_name).with_suffix(".slpb").resolve()).replace("\\", "/").lstrip("C:"),
        "--parameter", "build_dir:" + str(output_artifact.parent.resolve()).replace("\\", "/").lstrip("C:"),
        "--parameter", "sdk_dir:" + str(sdk).replace("\\", "/").lstrip("C:")
    ]

    # Run the command using subprocess
    result = subprocess.run(command, check=True, text=True)

The command I am using to run it is:

python "tools/build_project.py" --sdk "C:/Users/Dell/SimplicityStudio/SDKs/gecko_sdk_4.4.4" --toolchain "C:/SiliconLabs/SimplicityStudio/v5/developer/toolchains/gnu_arm/12.2.rel1_2023.7" --manifest "C:/Users/Dell/SimplicityStudio/v5_workspace/silabs-firmware-builder/manifests/nabucasa/yellow_ncp-uart-hw.yaml" --postbuild "C:/Users/Dell/SimplicityStudio/v5_workspace/silabs-firmware-builder/tools/create_gbl.py" --build-dir build --output-dir output --output gbl --output out --output hex

And that works smooth. Once that said, this is more like a workaround that a proper solution to make it running in MS Windows. So whoever is in charge of issues, do with this information whatever you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants