~aleteoryx/muditaos

ref: f54d4005001945760d87300a8b1e6b0cc6025b1e muditaos/cmake/modules/FetchBootloader.cmake -rw-r--r-- 833 bytes
f54d4005 — Marcin Smoczyński [BH-734] Add hardware board selection 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function(fetch_ecoboot)
    set(ECOBOOT_ASSET_NAME ecoboot.bin)
    if(${BOARD} STREQUAL "puretx" AND ${BOARD_REVISION} LESS_EQUAL 6)
        set(ECOBOOT_ASSET_NAME ecoboot_T6.bin)
    endif()

    add_custom_command(OUTPUT ecoboot.bin
        COMMAND ${CMAKE_SOURCE_DIR}/tools/download_asset.py
            "$<$<BOOL:$ENV{ASSETS_LOGIN}>:-l$ENV{ASSETS_LOGIN}>"
            "$<$<BOOL:$ENV{ASSETS_TOKEN}>:-t$ENV{ASSETS_TOKEN}>"
            -w ${CMAKE_BINARY_DIR}
            ecoboot download
            -n ${ECOBOOT_ASSET_NAME}
            -o ecoboot.bin
        COMMENT "Downloading ecoboot.bin"
        BYPRODUCTS ecoboot.version
    )

    add_custom_target(ecoboot.bin-target DEPENDS ecoboot.bin)

    multicomp_install(PROGRAMS ${CMAKE_BINARY_DIR}/ecoboot.bin DESTINATION "./"
        COMPONENTS Standalone Update)
endfunction()