~aleteoryx/muditaos

25fc56f4c69adfcdae299eace84dad19a5d3ecd4 — Radoslaw Wicik 4 years ago aa1ca51
[BH-353] Add minimal build target for BH

* add BellHybridMain
* fixing post review

Git automatically converts BellHybird as move from source/main.cpp to
prevent this and maintain "main.cpp" history adding new target as
separate commit.
M CMakeLists.txt => CMakeLists.txt +2 -3
@@ 16,7 16,7 @@ include(SerialPort)
include(CopyGdbInit)
include(Utils)
include(ModuleUtils)
include(AddBootloader)
include(FetchBootloader)
include(DiskImage)
include(AddPackage)



@@ 131,7 131,6 @@ add_subdirectory(module-apps)
add_subdirectory(module-bluetooth)
add_subdirectory(module-lwip)
add_subdirectory(image)
        $<$<STREQUAL:${PROJECT_TARGET},TARGET_RT1051>:CrashCatcher::CrashCatcher>
add_subdirectory(host-tools)

include(tools/clang-tidy.cmake)


@@ 157,7 156,7 @@ add_custom_target(
        "Generating version info"
    )

add_ecoboot()
fetch_ecoboot()
add_subdirectory(products)

include(GitHubWorkerMessages)

M Jenkinsfile => Jenkinsfile +1 -1
@@ 124,7 124,7 @@ echo "./configure.sh linux Debug -G Ninja"
./configure.sh linux Debug -G Ninja

pushd build-linux-Debug
ninja -j ${JOBS}
ninja -j ${JOBS} Pure Bell
popd'''
                echo "Build Unit Tests"
                sh '''#!/bin/bash -e

M cmake/modules/AddBootBin.cmake => cmake/modules/AddBootBin.cmake +1 -0
@@ 35,4 35,5 @@ function(add_boot_bin SOURCE_TARGET)
    message("Adding '${SOURCE_TARGET}-boot.bin' target")
    add_custom_target(${SOURCE_TARGET}-boot.bin
        DEPENDS ${BIN_FILE})
    set_target_properties(${SOURCE_TARGET}-boot.bin PROPERTIES BIN_FILE ${BIN_FILE})
endfunction()

M cmake/modules/AddPackage.cmake => cmake/modules/AddPackage.cmake +46 -52
@@ 1,12 1,15 @@
if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
    set(CPACK_SYSTEM_NAME "Linux")
    set(CPACK_COMPONENTS_ALL Standalone)
else()
    set(CPACK_SYSTEM_NAME "RT1051")
    set(CPACK_COMPONENTS_ALL Standalone Update)
endif()


macro(set_cpack_vars)
    if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
        set(CPACK_SYSTEM_NAME "Linux")
        set(CPACK_COMPONENTS_ALL Standalone)
    elseif(${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
        set(CPACK_SYSTEM_NAME "RT1051")
        set(CPACK_COMPONENTS_ALL Standalone Update)
    else()
        message(FATAL_ERROR "Unsupported project target: '${PROJECT_TARGET}'")
    endif()

    set(CPACK_PACKAGE_VENDOR "Mudita")
    set(CPACK_PACKAGE_HOMEPAGE_URL "https://mudita.com/products/pure/")


@@ 20,60 23,51 @@ macro(set_cpack_vars)
    set(CPACK_PACKAGE_FILE_NAME ${PACKAGE_COMMON_NAME})
    set(PACKAGE_STAGING_DIRECTORY ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/${CPACK_GENERATOR}/${CPACK_PACKAGE_FILE_NAME})

#    message("---cpak vars---")
#    print_var(PACKAGE_COMMON_NAME)
#    print_var(CPACK_PACKAGE_NAME)
#    print_var(CPACK_PACKAGE_FILE_NAME)
#    print_var(CPACK_TOPLEVEL_TAG)
#    print_var(CPACK_GENERATOR)
#    print_var(PACKAGE_STAGING_DIRECTORY)
#    message("----------------")
endmacro()

function(add_standalone_image SOURCE_TARGET)
    if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
        set(BIN_FILE ${SOURCE_TARGET}-boot.bin)
        set(CPACK_PACKAGE_NAME ${SOURCE_TARGET})
        set_cpack_vars()

        set(ECOBOOT_FILE ecoboot.bin)
        set(VERSION_JSON_FILE version.json)
    if (NOT ${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
        return()
    endif()
    set(BIN_FILE ${SOURCE_TARGET}-boot.bin)
    set(CPACK_PACKAGE_NAME ${SOURCE_TARGET})
    set_cpack_vars()

        set(PACKAGE_STANDALONE_MIME "application/x-xz")
        set(PACKAGE_STANDALONE_FILE_NAME ${PACKAGE_COMMON_NAME}-image.tar.xz)
    set(PACKAGE_STANDALONE_MIME "application/x-xz")
    set(PACKAGE_STANDALONE_FILE_NAME ${PACKAGE_COMMON_NAME}-image.tar.xz)

        add_custom_target(${PACKAGE_COMMON_NAME}-package-standalone
            COMMAND tar -ScJf ${PACKAGE_STANDALONE_FILE_NAME} ${SOURCE_TARGET}.img
            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
            DEPENDS ${BIN_FILE} ${ECOBOOT_FILE}-target ${VERSION_JSON_FILE}-target ${SOURCE_TARGET}.img
            )
    add_custom_target(${PACKAGE_COMMON_NAME}-package-standalone
        COMMAND tar -ScJf ${PACKAGE_STANDALONE_FILE_NAME} ${SOURCE_TARGET}.img
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
        DEPENDS ${BIN_FILE} ${ECOBOOT_FILE}-target ${VERSION_JSON_FILE}-target ${SOURCE_TARGET}.img
        )

        message("Adding stand alone target '${SOURCE_TARGET}-StandaloneImage'")
        add_custom_target(${SOURCE_TARGET}-StandaloneImage
            DEPENDS ${PACKAGE_COMMON_NAME}-package-standalone)
    endif()
    message("Adding stand alone target '${SOURCE_TARGET}-StandaloneImage'")
    add_custom_target(${SOURCE_TARGET}-StandaloneImage
        DEPENDS ${PACKAGE_COMMON_NAME}-package-standalone)
endfunction()


function(add_update_package SOURCE_TARGET)
    if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
        set(CPACK_PACKAGE_NAME ${SOURCE_TARGET})
        set_cpack_vars()
        set(UPDATE_PKG "${SOURCE_TARGET}-${CMAKE_PROJECT_VERSION}-${CPACK_SYSTEM_NAME}-Update.tar")
        add_custom_command(
            OUTPUT ${UPDATE_PKG}
            DEPENDS ${SOURCE_TARGET}
            DEPENDS ${SOURCE_TARGET}-boot.bin
            DEPENDS ecoboot.bin-target
            DEPENDS version.json-target
            DEPENDS assets
            COMMAND ${CMAKE_SOURCE_DIR}/tools/generate_update_image.sh ${SOURCE_TARGET} ${CMAKE_PROJECT_VERSION} ${CPACK_SYSTEM_NAME}
            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
            COMMENT "Generating update image"
            )
        message("Adding '${SOURCE_TARGET}-UpdatePackage' target")
        add_custom_target(${SOURCE_TARGET}-UpdatePackage
            DEPENDS ${UPDATE_PKG}
            )
    if (NOT ${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
        return()
    endif()
    set(CPACK_PACKAGE_NAME ${SOURCE_TARGET})
    set_cpack_vars()
    set(UPDATE_PKG "${SOURCE_TARGET}-${CMAKE_PROJECT_VERSION}-${CPACK_SYSTEM_NAME}-Update.tar")
    add_custom_command(
        OUTPUT ${UPDATE_PKG}
        DEPENDS ${SOURCE_TARGET}
        DEPENDS ${SOURCE_TARGET}-boot.bin
        DEPENDS ecoboot.bin-target
        DEPENDS version.json-target
        DEPENDS assets
        COMMAND ${CMAKE_SOURCE_DIR}/tools/generate_update_image.sh ${SOURCE_TARGET} ${CMAKE_PROJECT_VERSION} ${CPACK_SYSTEM_NAME}
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
        COMMENT "Generating update image"
        )
    message("Adding '${SOURCE_TARGET}-UpdatePackage' target")
    add_custom_target(${SOURCE_TARGET}-UpdatePackage
        DEPENDS ${UPDATE_PKG}
        )
endfunction()

M cmake/modules/DiskImage.cmake => cmake/modules/DiskImage.cmake +10 -5
@@ 1,7 1,8 @@
function(add_image SOURCE_TARGET)
    set(DISK_IMAGE_NAME ${SOURCE_TARGET}.img)
    set(DISK_IMAGE ${CMAKE_BINARY_DIR}/${DISK_IMAGE_NAME})
    set(BIN_FILE ${SOURCE_TARGET}-boot.bin)
    set(BIN_FILE_TARGET ${SOURCE_TARGET}-boot.bin)
    get_target_property(BIN_FILE ${BIN_FILE_TARGET} BIN_FILE)

    if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
        SET(TARGET_DEP ${BIN_FILE} pureflash)


@@ 11,17 12,21 @@ function(add_image SOURCE_TARGET)

    add_custom_command(
        OUTPUT ${DISK_IMAGE_NAME}
        DEPENDS
        DEPENDS genlittlefs
        DEPENDS assets
        DEPENDS ${BIN_FILE_TARGET}
        DEPENDS ${TARGET_DEP}
        DEPENDS ${BIN_FILE}
        DEPENDS ${CMAKE_SOURCE_DIR}/generate_purephone_image.sh
        COMMAND ${CMAKE_SOURCE_DIR}/generate_purephone_image.sh ${DISK_IMAGE} ${CMAKE_BINARY_DIR} ${BIN_FILE}
        DEPENDS ${CMAKE_SOURCE_DIR}/generate_image.sh
        COMMAND ${CMAKE_SOURCE_DIR}/generate_image.sh
        ${DISK_IMAGE}
        ${CMAKE_BINARY_DIR}
        "$<$<STREQUAL:${PROJECT_TARGET},TARGET_RT1051>:${BIN_FILE}>"
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
        COMMENT "Generate ${DISK_IMAGE_NAME}"
        )

    message("Adding disk image target: ${DISK_IMAGE_NAME}")
    add_custom_target(${SOURCE_TARGET}-disk-img
        DEPENDS ${DISK_IMAGE_NAME})

endfunction()

R cmake/modules/AddBootloader.cmake => cmake/modules/FetchBootloader.cmake +5 -17
@@ 1,34 1,22 @@
# download the bootloader
set(ECOBOOT_FILE ecoboot.bin)
set(VERSION_JSON_FILE version.json)

function(add_ecoboot)
    set(ECOBOOT_FILE ecoboot.bin)
function(fetch_ecoboot)
    set(ECOBOOT_DOWNLOAD_LOG ${CMAKE_BINARY_DIR}/download_info.txt)
    if(DEFINED ENV{ASSETS_LOGIN} AND DEFINED ENV{ASSETS_TOKEN})
        message("ecooboot download with tokens")
        add_custom_command(OUTPUT ${ECOBOOT_FILE}
            COMMAND ${CMAKE_SOURCE_DIR}/tools/download_asset.py
            -l $ENV{ASSETS_LOGIN}
            -t $ENV{ASSETS_TOKEN}
            "$<$<BOOL:$ENV{ASSETS_LOGIN}>:-l$ENV{ASSETS_LOGIN}>"
            "$<$<BOOL:$ENV{ASSETS_TOKEN}>:-t$ENV{ASSETS_TOKEN}>"
            -w ${CMAKE_BINARY_DIR} ecoboot download
            > ${ECOBOOT_DOWNLOAD_LOG}
            COMMENT "Downloading ${ECOBOOT_FILE}"
            BYPRODUCTS ${ECOBOOT_DOWNLOAD_LOG}
            )
    else()
        message("ecoboot download with git")
        add_custom_command(OUTPUT ${ECOBOOT_FILE}
            COMMAND ${CMAKE_SOURCE_DIR}/tools/download_asset.py
            -w ${CMAKE_BINARY_DIR} ecoboot download
            > ${ECOBOOT_DOWNLOAD_LOG}
            COMMENT "Downloading ${ECOBOOT_FILE}"
            BYPRODUCTS ${ECOBOOT_DOWNLOAD_LOG}
            )
    endif()

    add_custom_target(${ECOBOOT_FILE}-target DEPENDS ${ECOBOOT_FILE})

    # generate version.json file (runs CMake script at build time)
    set(VERSION_JSON_FILE version.json)
    add_custom_command(OUTPUT ${VERSION_JSON_FILE}
        COMMAND ${CMAKE_COMMAND}
        -DSRC_DIR=${CMAKE_SOURCE_DIR}

M cmake/modules/GitHubWorkerMessages.cmake => cmake/modules/GitHubWorkerMessages.cmake +13 -10
@@ 1,11 1,14 @@
if (NOT "$ENV{GITHUB_WORKSPACE}" STREQUAL "")
    message("set-output name=package-standalone::${PACKAGE_STANDALONE_FILE_NAME}")
    message("::set-output name=package-standalone::${PACKAGE_STANDALONE_FILE_NAME}")
    message("set-output name=standalone-mime_type::${PACKAGE_STANDALONE_MIME}")
    message("::set-output name=standalone-mime_type::${PACKAGE_STANDALONE_MIME}")
function(github_worker_message)
    if (NOT DEFINED ENV{GITHUB_WORKSPACE})
        return()
    endif()
        message("set-output name=package-standalone::${PACKAGE_STANDALONE_FILE_NAME}")
        message("::set-output name=package-standalone::${PACKAGE_STANDALONE_FILE_NAME}")
        message("set-output name=standalone-mime_type::${PACKAGE_STANDALONE_MIME}")
        message("::set-output name=standalone-mime_type::${PACKAGE_STANDALONE_MIME}")

    message("set-output name=package-update::${PACKAGE_UPDATE_FILE_NAME}")
    message("::set-output name=package-update::${PACKAGE_UPDATE_FILE_NAME}")
    message("set-output name=update-mime_type::${PACKAGE_UPDATE_MIME}")
    message("::set-output name=update-mime_type::${PACKAGE_UPDATE_MIME}")
endif()
        message("set-output name=package-update::${PACKAGE_UPDATE_FILE_NAME}")
        message("::set-output name=package-update::${PACKAGE_UPDATE_FILE_NAME}")
        message("set-output name=update-mime_type::${PACKAGE_UPDATE_MIME}")
        message("::set-output name=update-mime_type::${PACKAGE_UPDATE_MIME}")
endfunction()

M cmake/modules/Utils.cmake => cmake/modules/Utils.cmake +21 -0
@@ 19,3 19,24 @@ macro(print_var VARIABLE)
        message(STATUS "${Orange}No such variable: '${Red}${VARIABLE}${ColourReset}'")
    endif()
endmacro()

function(strip_executable TARGET)
    if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
        add_custom_command(TARGET ${TARGET} POST_BUILD
            COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:${TARGET}>
            COMMENT "Striping  ${TARGET}"
            )
    endif()

    if (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
        add_custom_command(TARGET ${TARGET} POST_BUILD
            COMMAND ${CMAKE_OBJCOPY} --only-keep-debug
                    $<TARGET_FILE:${TARGET}>
                    $<TARGET_FILE:${TARGET}>.debug
            COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:${TARGET}>
            COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:${TARGET}>.debug
                    $<TARGET_FILE:${TARGET}>
            COMMENT "Striping  ${TARGET}"
            )
    endif()
endfunction()

M configure.sh => configure.sh +3 -3
@@ 1,5 1,5 @@
#!/bin/bash
# Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

if [[ $BASH_VERSINFO -lt 4 ]]; then


@@ 87,9 87,9 @@ if check_target && check_build_type ; then
        if $CMAKE_CMD; then
            Ninja=$(echo $@ | grep "Ninja")
            if [[ -z ${Ninja} ]]; then
                echo -e "\e[32mcd ${BUILD_DIR} && make -j $(nproc)\e[0m"
                echo -e "\e[32mcd ${BUILD_DIR} && make -j $(nproc) <Pure|Bell>\e[0m"
            else
                echo -e "\e[32mcd ${BUILD_DIR} && ninja\e[0m"
                echo -e "\e[32mcd ${BUILD_DIR} && ninja <Pure|Bell>\e[0m"
            fi
        else
            echo -e "configuration error!"

M doc/boot_and_update.md => doc/boot_and_update.md +1 -1
@@ 65,7 65,7 @@ The type variable in `boot.json` is for MuditaOS - this will indicate a subdirec
6. Move into the project root directory and run the image generation script

```bash
    ./generate_purephone_image.sh pure.img build-rt1051-Debug
    ./generate_image.sh pure.img build-rt1051-Debug
```
   
   Example output:

R generate_purephone_image.sh => generate_image.sh +8 -9
@@ 4,14 4,14 @@

usage() {
cat << ==usage
Usage: $(basename $0) [image_path] [build_dir] [boot.bin_file]
    image_path    - Destination image path name for. ex PurePhone.img
    build_dir     - PurePhone build dir for ex. build-rt1051-RelWithDebInfo
    boot.bin_file - name of the boot.bin file (for diferrent targets)
Usage: $(basename $0) image_path build_dir [boot.bin_file]
    image_path    - Destination image path name e.g. PurePhone.img
    build_dir     - PurePhone build dir e.g. build-rt1051-RelWithDebInfo
    boot.bin_file - optional for linux image - name of the boot.bin file (for different targets)
==usage
}

if [ $# -ne 3 ]; then
if [[ ( $# -ne 2 ) && ( $# -ne 3 ) ]]; then
	echo "Error! Invalid argument count"
	usage
	exit -1


@@ 19,8 19,7 @@ fi

IMAGE_NAME=$(realpath $1)
BUILDDIR=$(realpath $2)
BIN_FILE="$3"
BIN_FILE_PATH="current/${BIN_FILE}"
BIN_FILE=$3

if [ ! -d "$BUILDDIR" ]; then
	echo "Error! \${build_dir} (${BUILDDIR}) is not a directory"


@@ 109,8 108,8 @@ for i in $CURRENT_DATA; do
	fi
done

if [ -f "${BIN_FILE_PATH}" ]; then
    mcopy -s -i "$PART1" ${BIN_FILE_PATH} ::/current/boot.bin
if [[ -n "${BIN_FILE}" && -f "${BIN_FILE}" ]]; then
    mcopy -v -s -i "$PART1" ${BIN_FILE} ::/current/boot.bin
else
	echo "Warning! Missing boot.bin"
	echo "(it's fine for a Linux build)"

M module-sys/CMakeLists.txt => module-sys/CMakeLists.txt +2 -1
@@ 51,7 51,7 @@ target_include_directories(bus PRIVATE ${BOARD_DIR_INCLUDES})
target_include_directories(bus PRIVATE ${PROJECT_INCLUDES})
target_link_options(bus PRIVATE ${TARGET_LINK_OPTIONS})

add_library(module-sys STATIC)
add_library(module-sys)
target_sources(module-sys PRIVATE ${SOURCES} ${BOARD_SOURCES})

target_link_libraries(module-sys


@@ 59,6 59,7 @@ target_link_libraries(module-sys
        bus
        service-evtmgr
        messagetype
        magic_enum
    PUBLIC
        module-os
    )

A products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +189 -0
@@ 0,0 1,189 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "config.h"

// applications
#include <application-antenna/ApplicationAntenna.hpp>
#include <application-call/ApplicationCall.hpp>
#include <application-calllog/ApplicationCallLog.hpp>
#include <application-desktop/ApplicationDesktop.hpp>
#include <application-messages/ApplicationMessages.hpp>
#include <application-notes/ApplicationNotes.hpp>
#include <application-phonebook/ApplicationPhonebook.hpp>
#include <application-settings/ApplicationSettings.hpp>
#include <application-settings-new/ApplicationSettings.hpp>
#include <application-special-input/ApplicationSpecialInput.hpp>
#include <application-calendar/ApplicationCalendar.hpp>
#include <application-music-player/ApplicationMusicPlayer.hpp>
#include <application-meditation/ApplicationMeditation.hpp>
#include <application-calculator/ApplicationCalculator.hpp>
#include <application-alarm-clock/ApplicationAlarmClock.hpp>
#include <application-onboarding/ApplicationOnBoarding.hpp>

// services
#include <service-appmgr/model/ApplicationManager.hpp>
#include <service-audio/ServiceAudio.hpp>
#include <service-bluetooth/ServiceBluetooth.hpp>
#include <service-db/ServiceDB.hpp>
#include <service-evtmgr/EventManager.hpp>
#include <service-lwip/ServiceLwIP.hpp>
#include <service-time/ServiceTime.hpp>
#include <Service/ServiceCreator.hpp>
#include <service-gui/ServiceGUI.hpp>
#include <service-gui/Common.hpp>
#include <module-services/service-eink/ServiceEink.hpp>
#include <service-fileindexer/Constants.hpp>
#include <service-fileindexer/ServiceFileIndexer.hpp>
#include <service-desktop/ServiceDesktop.hpp>

#if ENABLE_GSM == 1
#include <service-fota/ServiceFota.hpp>
#include <service-cellular/ServiceCellular.hpp>
#include <service-antenna/ServiceAntenna.hpp>
#endif

#include <bsp/bsp.hpp>
#include <Application.hpp>
#include <ApplicationLauncher.hpp>
#include <log/log.hpp>
#include <log/Logger.hpp>
#include <phonenumbers/phonenumberutil.h>
#include <source/version.hpp>
#include <SystemManager/SystemManager.hpp>
#include <SystemWatchdog/SystemWatchdog.hpp>
#include <thread.hpp>
#include <purefs/vfs_subsystem.hpp>

#include <memory>
#include <vector>

int main()
{

#if SYSTEM_VIEW_ENABLED
    SEGGER_SYSVIEW_Conf();
    SEGGER_SYSVIEW_DisableEvents(SYSVIEW_EVTMASK_ISR_ENTER);
    SEGGER_SYSVIEW_DisableEvents(SYSVIEW_EVTMASK_ISR_EXIT);
    SEGGER_SYSVIEW_DisableEvents(SYSVIEW_EVTMASK_ISR_TO_SCHEDULER);
    SEGGER_SYSVIEW_WaitForConnection();
    SEGGER_SYSVIEW_Start();
#endif

    bsp::BoardInit();

    purefs::subsystem::vfs_handle_t vfs;
    if (!sys::SystemWatchdog::getInstance().init()) {
        LOG_ERROR("System watchdog failed to initialize");
        // wait for the hardware watchdog (initialized in reset ISR) to reset the system
        while (1)
            ;
    }

    std::vector<std::unique_ptr<sys::BaseServiceCreator>> systemServices;
    systemServices.emplace_back(sys::CreatorFor<EventManager>());
#if ENABLE_FILEINDEXER_SERVICE
    systemServices.emplace_back(sys::CreatorFor<service::ServiceFileIndexer>());
#endif
    systemServices.emplace_back(sys::CreatorFor<ServiceDB>());
#if ENABLE_GSM == 0
    // For now disable permanently Service cellular when there is no GSM configured
    LOG_INFO("ServiceCellular (GSM) - Disabled");
#else
    systemServices.emplace_back(sys::CreatorFor<ServiceAntenna>());
    systemServices.emplace_back(sys::CreatorFor<ServiceCellular>());
    systemServices.emplace_back(sys::CreatorFor<FotaService::Service>());
#endif
    systemServices.emplace_back(sys::CreatorFor<ServiceAudio>());
    systemServices.emplace_back(sys::CreatorFor<ServiceBluetooth>());
    systemServices.emplace_back(sys::CreatorFor<ServiceLwIP>());
    systemServices.emplace_back(sys::CreatorFor<ServiceDesktop>());
    systemServices.emplace_back(sys::CreatorFor<stm::ServiceTime>());
    systemServices.emplace_back(sys::CreatorFor<service::eink::ServiceEink>());
    systemServices.emplace_back(sys::CreatorFor<service::gui::ServiceGUI>());

    auto sysmgr = std::make_shared<sys::SystemManager>(std::move(systemServices));
    sysmgr->StartSystem(
        [&vfs]() {
            vfs     = purefs::subsystem::initialize();
            int err = purefs::subsystem::mount_defaults();
            if (err) {
                LOG_FATAL("VFS subystem fatal error %i", err);
                std::abort();
            }
            Log::Logger::get().init();
            /// force initialization of PhonenumberUtil because of its stack usage
            /// otherwise we would end up with an init race and PhonenumberUtil could
            /// be initiated in a task with stack not big enough to handle it
            i18n::phonenumbers::PhoneNumberUtil::GetInstance();
            return true;
        },
        [sysmgr]() {
            // vector with launchers to applications
            std::vector<std::unique_ptr<app::ApplicationLauncher>> applications;
#ifdef ENABLE_APP_DESKTOP
            applications.push_back(
                app::CreateLauncher<app::ApplicationDesktop>(app::name_desktop, app::Closeable::False));
#endif
#ifdef ENABLE_APP_CALL
            applications.push_back(app::CreateLauncher<app::ApplicationCall>(app::name_call, app::Closeable::False));
#endif
#ifdef ENABLE_APP_SETTINGS
            applications.push_back(app::CreateLauncher<app::ApplicationSettings>(app::name_settings));
#endif
#ifdef ENABLE_APP_SETTINGS_NEW
            applications.push_back(app::CreateLauncher<app::ApplicationSettingsNew>(app::name_settings_new));
#endif
#ifdef ENABLE_APP_NOTES
            applications.push_back(app::CreateLauncher<app::ApplicationNotes>(app::name_notes));
#endif
#ifdef ENABLE_APP_CALLLOG
            applications.push_back(app::CreateLauncher<app::ApplicationCallLog>(app::CallLogAppStr));
#endif
#ifdef ENABLE_APP_PHONEBOOK
            applications.push_back(app::CreateLauncher<app::ApplicationPhonebook>(app::name_phonebook));
#endif
#ifdef ENABLE_APP_MESSAGES
            applications.push_back(app::CreateLauncher<app::ApplicationMessages>(app::name_messages));
#endif
#ifdef ENABLE_APP_SPECIAL_INPUT
            applications.push_back(
                app::CreateLauncher<app::ApplicationSpecialInput>(app::special_input, app::Closeable::False));
#endif
#ifdef ENABLE_APP_ANTENNA
            applications.push_back(app::CreateLauncher<app::ApplicationAntenna>(app::name_antenna));
#endif
#ifdef ENABLE_APP_CALENDAR
            applications.push_back(app::CreateLauncher<app::ApplicationCalendar>(app::name_calendar));
#endif
#ifdef ENABLE_APP_MUSIC_PLAYER
            applications.push_back(app::CreateLauncher<app::ApplicationMusicPlayer>(app::name_music_player));
#endif
#ifdef ENABLE_APP_MEDITATION
            applications.push_back(
                app::CreateLauncher<app::ApplicationMeditation>(app::name_meditation, app::Closeable::True));
#endif
#ifdef ENABLE_APP_CALCULATOR
            applications.push_back(app::CreateLauncher<app::ApplicationCalculator>(app::name_calculator));
#endif
#ifdef ENABLE_APP_ALARM_CLOCK
            applications.push_back(app::CreateLauncher<app::ApplicationAlarmClock>(app::name_alarm_clock));
#endif
#ifdef ENABLE_APP_ONBOARDING
            applications.push_back(app::CreateLauncher<app::ApplicationOnBoarding>(app::name_onboarding));
#endif
            // start application manager
            return sysmgr->RunSystemService(
                std::make_shared<app::manager::ApplicationManager>(
                    app::manager::ApplicationManager::ServiceName, std::move(applications), app::name_desktop),
                sysmgr.get());
        });

    LOG_PRINTF("Launching BellHybrid \n");
    LOG_PRINTF("commit: %s tag: %s branch: %s\n", GIT_REV, GIT_TAG, GIT_BRANCH);
    cpp_freertos::Thread::StartScheduler();

    purefs::subsystem::unmount_all();

    return 0;
}

M products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +43 -49
@@ 1,84 1,78 @@
add_executable(BellHybrid)
add_image(BellHybrid)

add_custom_target(Bell
    DEPENDS BellHybrid BellHybrid.img
    )

target_link_directories(BellHybrid PRIVATE ${PROJECT_LIB_DIRECTORY})

target_link_directories(BellHybrid PUBLIC ${PROJECT_LIB_DIRECTORY})

target_compile_definitions(BellHybrid PUBLIC ${PROJECT_CONFIG_DEFINITIONS}
    ${TARGET_COMPILE_DEFINITIONS}
    ${PROJECT_TARGET}
target_compile_definitions(BellHybrid
    PRIVATE
        ${PROJECT_CONFIG_DEFINITIONS}
        ${TARGET_COMPILE_DEFINITIONS}
        ${PROJECT_TARGET}
    )

target_compile_features(BellHybrid PUBLIC
    ${TARGET_COMPILE_FEATURES})
target_compile_features(BellHybrid
    PRIVATE
        ${TARGET_COMPILE_FEATURES}
    )

target_compile_options(BellHybrid PUBLIC $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>)
target_compile_options(BellHybrid PUBLIC "-Wno-error=deprecated-declarations")
target_compile_options(BellHybrid
    PRIVATE
        $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>
        "-Wno-error=deprecated-declarations"
    )

target_sources(BellHybrid PRIVATE ${TARGET_SOURCES})

target_sources(BellHybrid
    PRIVATE
    BellHybridMain.cpp
        ${TARGET_SOURCES}
        BellHybridMain.cpp
    )
target_include_directories(BellHybrid PUBLIC ${TARGET_DIR_INCLUDES})
target_include_directories(BellHybrid PUBLIC ${PROJECT_INCLUDES})
target_include_directories(BellHybrid PUBLIC ${CMAKE_BINARY_DIR})

set_target_properties(BellHybrid PROPERTIES SUFFIX ".elf")

set_target_properties(BellHybrid PROPERTIES LINK_FLAGS "-Xlinker -Map=${CMAKE_BINARY_DIR}/BellHybrid.map ")
target_include_directories(BellHybrid
    PRIVATE
        ${TARGET_DIR_INCLUDES}
        ${PROJECT_INCLUDES}
        ${CMAKE_BINARY_DIR}
)

set_target_properties(BellHybrid
    PROPERTIES
        SUFFIX ".elf"
        LINK_FLAGS "-Xlinker -Map=${CMAKE_BINARY_DIR}/BellHybrid.map "
    )

target_link_libraries(BellHybrid
    PUBLIC
    module-apps
    service-desktop
    service-bluetooth
    service-lwip
    ${LWIP_LIBRARIES}
    PRIVATE
        module-apps
        service-desktop
        service-bluetooth
        service-lwip
        ${LWIP_LIBRARIES}
        messagetype
        "$<$<STREQUAL:${PROJECT_TARGET},TARGET_Linux>:iosyscalls>"
        "$<$<STREQUAL:${PROJECT_TARGET},TARGET_RT1051>:CrashCatcher::CrashCatcher>"
    )

target_link_options(BellHybrid PRIVATE ${TARGET_LINK_OPTIONS})

if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
    target_link_libraries(BellHybrid
        PUBLIC iosyscalls)
    add_dependencies(Pure service_renderer)
    add_dependencies(Bell service_renderer)
endif()

set_source_files_properties(BellHybridMain.cpp PROPERTIES COMPILE_DEFINITIONS "${ENABLED_APPS_DEFINES}")

target_link_options(BellHybrid PUBLIC ${TARGET_LINK_OPTIONS})

strip_executable(BellHybrid)


if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
    add_custom_command(TARGET BellHybrid POST_BUILD
        COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:BellHybrid>
        )
endif()

if (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
    add_custom_command(TARGET BellHybrid POST_BUILD
        COMMAND ${CMAKE_OBJCOPY} --only-keep-debug
        $<TARGET_FILE:BellHybrid>
        $<TARGET_FILE:BellHybrid>.debug
        COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:BellHybrid>
        COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:BellHybrid>.debug
        $<TARGET_FILE:BellHybrid>
        )
endif()

message_serial_status()

target_link_libraries(BellHybrid PUBLIC messagetype)

add_dependencies(BellHybrid version)

include(AddBootBin)
add_boot_bin(BellHybrid)
add_image(BellHybrid)

include(AddHexTarget)
add_hex_target(BellHybrid)

M products/PurePhone/CMakeLists.txt => products/PurePhone/CMakeLists.txt +40 -46
@@ 1,5 1,4 @@
add_executable(PurePhone)
add_image(PurePhone)

add_custom_target(Pure
    DEPENDS PurePhone PurePhone.img


@@ 8,79 7,74 @@ add_custom_target(Pure

target_link_directories(PurePhone PUBLIC ${PROJECT_LIB_DIRECTORY})

target_compile_definitions(PurePhone PUBLIC ${PROJECT_CONFIG_DEFINITIONS}
    ${TARGET_COMPILE_DEFINITIONS}
    ${PROJECT_TARGET}
target_compile_definitions(PurePhone
    PRIVATE
        ${PROJECT_CONFIG_DEFINITIONS}
        ${TARGET_COMPILE_DEFINITIONS}
        ${PROJECT_TARGET}
    )

define_serial(PurePhone)

target_compile_features(PurePhone PUBLIC
    ${TARGET_COMPILE_FEATURES})

target_compile_options(PurePhone PUBLIC $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>)
target_compile_options(PurePhone PUBLIC "-Wno-error=deprecated-declarations")
target_compile_features(PurePhone
    PRIVATE
        ${TARGET_COMPILE_FEATURES}
    )

target_sources(PurePhone PRIVATE ${TARGET_SOURCES})
target_compile_options(PurePhone
    PRIVATE
        $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>
        "-Wno-error=deprecated-declarations"
    )

target_sources(PurePhone
    PRIVATE
    PurePhoneMain.cpp
        ${TARGET_SOURCES}
        PurePhoneMain.cpp
    )
target_include_directories(PurePhone PUBLIC ${TARGET_DIR_INCLUDES})
target_include_directories(PurePhone PUBLIC ${PROJECT_INCLUDES})
target_include_directories(PurePhone PUBLIC ${CMAKE_BINARY_DIR})

set_target_properties(PurePhone PROPERTIES SUFFIX ".elf")
target_include_directories(PurePhone
    PRIVATE
        ${TARGET_DIR_INCLUDES}
        ${PROJECT_INCLUDES}
        ${CMAKE_BINARY_DIR}
    )

set_target_properties(PurePhone PROPERTIES LINK_FLAGS "-Xlinker -Map=${CMAKE_BINARY_DIR}/PurePhone.map ")
set_target_properties(PurePhone
    PROPERTIES
        SUFFIX ".elf"
        LINK_FLAGS "-Xlinker -Map=${CMAKE_BINARY_DIR}/PurePhone.map "
    )

target_link_libraries(PurePhone
    PUBLIC
    module-apps
    service-desktop
    service-bluetooth
    service-lwip
    ${LWIP_LIBRARIES}
    PRIVATE
        module-apps
        service-desktop
        service-bluetooth
        service-lwip
        ${LWIP_LIBRARIES}
        messagetype
        "$<$<STREQUAL:${PROJECT_TARGET},TARGET_Linux>:iosyscalls>"
        "$<$<STREQUAL:${PROJECT_TARGET},TARGET_RT1051>:CrashCatcher::CrashCatcher>"
    )

target_link_options(PurePhone PUBLIC ${TARGET_LINK_OPTIONS})

if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
    target_link_libraries(PurePhone
        PUBLIC iosyscalls)
    add_dependencies(Pure service_renderer)
endif()

set_source_files_properties(PurePhoneMain.cpp PROPERTIES COMPILE_DEFINITIONS "${ENABLED_APPS_DEFINES}")

target_link_options(PurePhone PUBLIC ${TARGET_LINK_OPTIONS})



if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
    add_custom_command(TARGET PurePhone POST_BUILD
        COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:PurePhone>
        )
endif()

if (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
    add_custom_command(TARGET PurePhone POST_BUILD
        COMMAND ${CMAKE_OBJCOPY} --only-keep-debug
        $<TARGET_FILE:PurePhone>
        $<TARGET_FILE:PurePhone>.debug
        COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:PurePhone>
        COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:PurePhone>.debug
        $<TARGET_FILE:PurePhone>
        )
endif()
strip_executable(PurePhone)

message_serial_status()

target_link_libraries(PurePhone PUBLIC messagetype)

add_dependencies(PurePhone version)

include(AddBootBin)
add_boot_bin(PurePhone)
add_image(PurePhone)

include(AddHexTarget)
add_hex_target(PurePhone)

M tools/generate_update_image.sh => tools/generate_update_image.sh +4 -4
@@ 6,7 6,7 @@

function help() {
cat <<- EOF
	Crate Update Image for the SOURCE_TARGET. This scritp should be run from build directory.
	Create Update Image for the SOURCE_TARGET. This script should be run from build directory.
	
	${0} <SOURCE_TARGET> <VERSION> <PLATFORM>
	


@@ 14,7 14,7 @@ cat <<- EOF
	    VERSION          - version number to attach to file name
	    PLATFORM         - RT1051 or Linux
	
	In current work dir script will crete update image inf form:
    In the current work dir, the script will create update image named from this template:
	<SOURCE_TARGET>-<VERSION>-<PLATFORM>-Update.tar
	
	


@@ 54,7 54,7 @@ function checkForDeps() {
    echo "Deps-OK"
}

function clenStagingDir(){
function cleanStagingDir(){
    local STAGEING_DIR=${1}
    if [[ -d ${STAGEING_DIR} ]]; then
        rm -Rf ${STAGEING_DIR}


@@ 91,7 91,7 @@ fi

setVars "${1}" "${2}" "${3}"
checkForDeps ${DEPS}
clenStagingDir ${STAGEING_DIR}
cleanStagingDir ${STAGEING_DIR}
linkInStageing
addChecksums
compress