M CMakeLists.txt => CMakeLists.txt +46 -360
@@ 3,7 3,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
-project(PurePhone)
+project(PureOS)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@@ 16,9 16,11 @@ include(SerialPort)
include(CopyGdbInit)
include(Utils)
include(ModuleUtils)
+include(AddBootloader)
+include(DiskImage)
+include(AddPackage)
message("PROJECT_TARGET: ${PROJECT_TARGET}")
-message("TARGET_SOURCES: ${TARGET_SOURCES}")
message("TARGET_COMPILE_DEFINITIONS: ${TARGET_COMPILE_OPTIONS}")
message("TARGET_LIBRARIES: ${TARGET_LIBRARIES}")
message("TARGET_LINKER_FLAGS: ${TARGET_LINKER_FLAGS}")
@@ 26,18 28,17 @@ message("TARGET_LINKER_FLAGS: ${TARGET_LINKER_FLAGS}")
string(REPLACE "TARGET_" "" PROJECT_TARGET_NAME ${PROJECT_TARGET})
string(TOLOWER "${PROJECT_TARGET_NAME}" PROJECT_TARGET_NAME)
message("Project target name: ${PROJECT_TARGET_NAME}")
-
-add_executable(${PROJECT_NAME} "" )
-
if (NOT ${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
- set(ENABLE_TESTS ON)
+ set(ENABLE_TESTS ON)
endif()
+
+
if (${ENABLE_TESTS})
- enable_testing()
- add_custom_target(check ${CMAKE_CTEST_COMMAND} -V)
- add_subdirectory(test)
- include(PureCoverage)
+ enable_testing()
+ add_custom_target(check ${CMAKE_CTEST_COMMAND} -V)
+ add_subdirectory(test)
+ include(PureCoverage)
endif ()
# setting build flags
@@ 62,44 63,35 @@ endif()
set(TOOLCHAIN_PATH "" CACHE STRING "Path to toolchain directory")
-target_link_directories(${PROJECT_NAME} PUBLIC ${PROJECT_LIB_DIRECTORY})
-
-message("Setting PROJECT_LIB_DIRECTORY to ${PROJECT_LIB_DIRECTORY}")
-message("Setting CMAKE_BINARY_DIR to ${CMAKE_BINARY_DIR}")
-target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_CONFIG_DEFINITIONS}
- ${TARGET_COMPILE_DEFINITIONS}
- ${PROJECT_TARGET}
- )
-
-define_serial(${PROJECT_NAME})
-
add_compile_definitions(FSL_RTOS_FREE_RTOS
- USB_STACK_FREERTOS
- DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
- FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1
- __STARTUP_INITIALIZE_NONCACHEDATA
- SDK_OS_FREE_RTOS
- XIP_EXTERNAL_FLASH=0
- CPU_MIMXRT1051DVL6B_cm7
- CPU_MIMXRT1051DVL6B
- SDK_DEBUGCONSOLE=0
- __MCUXPRESSO
- __USE_CMSIS
- __NEWLIB__
- SKIP_SYSCLK_INIT
- _GNU_SOURCE)
+ USB_STACK_FREERTOS
+ DEBUG_CONSOLE_TRANSFER_NON_BLOCKING
+ FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1
+ __STARTUP_INITIALIZE_NONCACHEDATA
+ SDK_OS_FREE_RTOS
+ XIP_EXTERNAL_FLASH=0
+ CPU_MIMXRT1051DVL6B_cm7
+ CPU_MIMXRT1051DVL6B
+ SDK_DEBUGCONSOLE=0
+ __MCUXPRESSO
+ __USE_CMSIS
+ __NEWLIB__
+ SKIP_SYSCLK_INIT
+ _GNU_SOURCE)
add_compile_options( ${TARGET_COMPILE_OPTIONS}
- $<$<COMPILE_LANGUAGE:C>:-std=gnu11>
- -fsingle-precision-constant
- -ffunction-sections
- -fdata-sections
- -MMD
- -MP
- -fno-builtin
- -fno-diagnostics-color
- # warning flags
- -Wall -Wextra -Werror -Wno-unused-parameter -Wno-deprecated-declarations)
+ $<$<COMPILE_LANGUAGE:C>:-std=gnu11>
+ -fsingle-precision-constant
+ -ffunction-sections
+ -fdata-sections
+ -MMD
+ -MP
+ -fno-builtin
+ -fno-diagnostics-color
+ # warning flags
+ -Wall -Wextra -Werror -Wno-unused-parameter -Wno-deprecated-declarations)
+
+include_directories(${CMAKE_SOURCE_DIR})
option (GENERATE_STACK_USAGE "Generate stack usage report" OFF)
if (GENERATE_STACK_USAGE)
@@ 114,215 106,35 @@ if (NOT ENABLE_SECURE_BOOT)
add_compile_definitions(
XIP_BOOT_HEADER_ENABLE=1
XIP_BOOT_HEADER_DCD_ENABLE=0
- )
-endif ()
-
-target_compile_features(${PROJECT_NAME} PUBLIC
- ${TARGET_COMPILE_FEATURES})
-
-
-target_compile_options(${PROJECT_NAME} PUBLIC $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>)
-add_compile_options("-Wno-error=deprecated-declarations")
-target_compile_options(${PROJECT_NAME} PUBLIC "-Wno-error=deprecated-declarations")
-
-target_sources(${CMAKE_PROJECT_NAME} PUBLIC ${TARGET_SOURCES})
-target_sources(${CMAKE_PROJECT_NAME}
- PRIVATE
-
- source/main.cpp
- PUBLIC
- source/MessageType.hpp
-
)
+endif ()
-set(PROJECT_INCLUDES
-
- ${CMAKE_CURRENT_SOURCE_DIR}/source
- ${CMAKE_CURRENT_SOURCE_DIR}/config
-
-
- CACHE INTERNAL "")
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
-target_include_directories(${PROJECT_NAME} PUBLIC ${TARGET_DIR_INCLUDES})
-target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_INCLUDES})
-target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_BINARY_DIR})
add_subdirectory(third-party)
if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
- add_subdirectory(board/linux/libiosyscalls)
+ add_subdirectory(board/linux/libiosyscalls)
endif()
-message("${PROJECT_NAME}: add_subdirectory module-sys")
-add_subdirectory(module-sys)
-message("${PROJECT_NAME}: add_subdirectory module-utils")
+add_subdirectory(source)
+add_subdirectory(module-sys)
add_subdirectory(module-utils)
-
-message("${PROJECT_NAME}: add_subdirectory module-os")
add_subdirectory(module-os)
-
-message("${PROJECT_NAME}: add_subdirectory module-bsp")
add_subdirectory(module-bsp)
-
-message("${PROJECT_NAME}: add_subdirectory module-vfs")
add_subdirectory(module-vfs)
-
-message("${PROJECT_NAME}: add_subdirectory module-gui")
add_subdirectory(module-gui)
-
-message("${PROJECT_NAME}: add_subdirectory module-db")
add_subdirectory(module-db)
-
-message("${PROJECT_NAME}: add_subdirectory module-cellular")
add_subdirectory(module-cellular)
-
-message("${PROJECT_NAME}: add_subdirectory module-audio")
add_subdirectory(module-audio)
-
-message("${PROJECT_NAME}: add_subdirectory module-services")
add_subdirectory(module-services)
-
-message("${PROJECT_NAME}: add_subdirectory module-apps")
add_subdirectory(module-apps)
-
-message("${PROJECT_NAME}: add_subdirectory module-bluetooth")
add_subdirectory(module-bluetooth)
-
-message("${PROJECT_NAME}: add_subdirectory module-lwip")
add_subdirectory(module-lwip)
-
add_subdirectory(image)
-
-set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES SUFFIX ".elf")
-
-set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES LINK_FLAGS "-Xlinker -Map=${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map ")
-
-# M.P: Please don't change the order of modules in the first group ("module-bsp" - "module-utils")
-# They have to be arranged in specific order because of circular dependencies that need to be correctly resolved
-# In case of doubt please contact me: mateusz.piesta@mudita.com
-target_link_libraries(${PROJECT_NAME}
- date::date
$<$<STREQUAL:${PROJECT_TARGET},TARGET_RT1051>:CrashCatcher::CrashCatcher>
- module-apps
- service-desktop
- service-bluetooth
- service-lwip
- ${LWIP_LIBRARIES}
-)
-
-if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
- target_link_libraries(${PROJECT_NAME} iosyscalls)
-endif()
-
-include(tools/clang-tidy.cmake)
-
-set_source_files_properties(source/main.cpp PROPERTIES COMPILE_DEFINITIONS "${ENABLED_APPS_DEFINES}")
-
-target_link_options(${PROJECT_NAME} PUBLIC ${TARGET_LINK_OPTIONS})
-
add_subdirectory(host-tools)
-
-if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
- set(HEX_FILE ${CMAKE_PROJECT_NAME}.hex)
- set(BIN_FILE ${CMAKE_BINARY_DIR}/sys/current/boot.bin)
-
- if (ENABLE_SECURE_BOOT)
- set (SREC_FILE ${CMAKE_PROJECT_NAME}.srec)
- # .srec file required by elftosb
- add_custom_command(
- COMMENT "Generate ${CMAKE_PROJECT_NAME}.srec"
- OUTPUT ${CMAKE_BINARY_DIR}/${SREC_FILE}
- DEPENDS ${CMAKE_PROJECT_NAME}
- COMMAND ${CMAKE_OBJCOPY} -Osrec $<TARGET_FILE:${CMAKE_PROJECT_NAME}> ${SREC_FILE}
- )
-
- add_custom_command(
- COMMENT "Generate signed boot.bin (Secure Boot)"
- OUTPUT ${BIN_FILE}
- DEPENDS ${CMAKE_BINARY_DIR}/${SREC_FILE}
- COMMAND ${CMAKE_SOURCE_DIR}/config/elftosb_wrapper.sh "${ELFTOSB_PATH}" "${CST_PATH}" -f imx -V
- -c ${CMAKE_BINARY_DIR}/imx_authenticated_hab.bd
- -o ${BIN_FILE}
- ${CMAKE_BINARY_DIR}/${SREC_FILE}
- VERBATIM
- )
- else ()
- add_custom_command(
- COMMENT "Generate boot.bin"
- OUTPUT ${BIN_FILE}
- DEPENDS ${CMAKE_PROJECT_NAME}
- COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${CMAKE_PROJECT_NAME}> ${BIN_FILE}
- )
- endif()
-
- add_custom_command(
- COMMENT "Generate ${CMAKE_PROJECT_NAME}.hex"
- OUTPUT ${CMAKE_BINARY_DIR}/${HEX_FILE}
- DEPENDS ${CMAKE_PROJECT_NAME}
- COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${CMAKE_PROJECT_NAME}> ${HEX_FILE}
- )
-
- add_custom_target(
- ${HEX_FILE}-target ALL
- DEPENDS ${CMAKE_BINARY_DIR}/${HEX_FILE}
- )
-
- # download the bootloader
- set(ECOBOOT_FILE ecoboot.bin)
- 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}
- -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}
- -DECOBOOT_DOWNLOAD_LOG=${ECOBOOT_DOWNLOAD_LOG}
- -B ${CMAKE_BINARY_DIR}
- -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenUpdateVersionJson.cmake
- DEPENDS ${ECOBOOT_FILE}-target ${ECOBOOT_DOWNLOAD_LOG}
- )
-
- add_custom_target(${VERSION_JSON_FILE}-target DEPENDS ${VERSION_JSON_FILE})
-
- multicomp_install(PROGRAMS ${CMAKE_BINARY_DIR}/${ECOBOOT_FILE} DESTINATION "./"
- COMPONENTS Standalone Update)
- multicomp_install(FILES ${CMAKE_BINARY_DIR}/${VERSION_JSON_FILE} DESTINATION "./"
- COMPONENTS Standalone Update)
-endif()
-
-if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
- add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
- COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:${CMAKE_PROJECT_NAME}>
- )
-endif()
+include(tools/clang-tidy.cmake)
install(
FILES ${PROJECT_SOURCE_DIR}/changelog.md
@@ 330,31 142,11 @@ install(
COMPONENT Standalone
)
-if (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
- add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
- COMMAND ${CMAKE_OBJCOPY} --only-keep-debug
- $<TARGET_FILE:${CMAKE_PROJECT_NAME}>
- $<TARGET_FILE:${CMAKE_PROJECT_NAME}>.debug
- COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:${CMAKE_PROJECT_NAME}>
- COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:${CMAKE_PROJECT_NAME}>.debug
- $<TARGET_FILE:${CMAKE_PROJECT_NAME}>
- )
-endif()
-
-include(DiskImage)
-
-message_serial_status()
-
option (BUILD_DOC_WITH_ALL "Build documentation" OFF)
include (GenDoxygenDoc)
-message("SRC DIR: ${CMAKE_SOURCE_DIR}")
-
include(Version)
-configure_file(
- ${SRC_DIR}/source/version.hpp.template
- ${CMAKE_BINARY_DIR}/source/version.hpp
- )
+
add_custom_target(
version ALL
COMMAND ${CMAKE_COMMAND}
@@ 364,114 156,8 @@ add_custom_target(
COMMENT
"Generating version info"
)
-add_dependencies(${PROJECT_NAME} version)
-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()
-set(CPACK_PACKAGE_VENDOR "Mudita")
-set(CPACK_PACKAGE_NAME "PurePhone")
-set(CPACK_PACKAGE_HOMEPAGE_URL "https://mudita.com/products/pure/")
-set(CPACK_TOPLEVEL_TAG ${CPACK_SYSTEM_NAME})
-# the CPACK_PACKAGE_FILE_NAME variable will be reset after include(CPack) hence a copy
-set(PACKAGE_COMMON_NAME ${CPACK_PACKAGE_NAME}-${CMAKE_PROJECT_VERSION}-${CPACK_TOPLEVEL_TAG})
-set(CPACK_PACKAGE_FILE_NAME ${PACKAGE_COMMON_NAME})
-# setting this will CPack prevent from additing the default 'package' target
-set(CPACK_OUTPUT_CONFIG_FILE ${CMAKE_BINARY_DIR}/PackageConfig.cmake)
-set(CPACK_GENERATOR "External")
-set(CPACK_COMPONENTS_GROUPING IGNORE)
-set(CPACK_EXTERNAL_ENABLE_STAGING TRUE)
-set(PACKAGE_STAGING_DIRECTORY ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/${CPACK_GENERATOR}/${CPACK_PACKAGE_FILE_NAME})
-message(PACKAGE_STAGING_DIRECTORY ${CMAKE_BINARY_DIR}/_CPack_Packages/${CPACK_TOPLEVEL_TAG}/${CPACK_GENERATOR}/${CPACK_PACKAGE_FILE_NAME})
-message("CPACK_TOPLEVEL_TAG:'${CPACK_TOPLEVEL_TAG}'")
-message("CPACK_GENERATOR:'${CPACK_GENERATOR}'")
-message("CPACK_PACKAGE_FILE_NAME:'${CPACK_PACKAGE_FILE_NAME}'")
-
-include(CPack)
-
-if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
- multicomp_install(
- TARGETS ${CMAKE_PROJECT_NAME}
- DESTINATION "./"
- COMPONENTS Standalone Update
- )
- add_custom_target(package-standalone-staged
- COMMAND ${CMAKE_CPACK_COMMAND}
- -C $<CONFIGURATION>
- --config ${CPACK_OUTPUT_CONFIG_FILE}
- DEPENDS ${CMAKE_PROJECT_NAME} service_renderer
- )
- set(PACKAGE_STANDALONE_FILE_NAME ${PACKAGE_COMMON_NAME}-Standalone.tar.gz)
- set(PACKAGE_STANDALONE_MIME "application/x-compressed-tar")
-
- add_custom_target(package-standalone
- COMMAND tar
- -czf ${CMAKE_BINARY_DIR}/${PACKAGE_STANDALONE_FILE_NAME}
- -C ${PACKAGE_STAGING_DIRECTORY}/Standalone "."
- DEPENDS package-standalone-staged
- )
- add_custom_target(
- eeprom_image ALL
- DEPENDS genlittlefs
- DEPENDS assets
- COMMAND ${CMAKE_BINARY_DIR}/genlittlefs -b 128 -s 32768 --overwrite --image ${CMAKE_BINARY_DIR}/eeprom.img ${CMAKE_BINARY_DIR}/sys/personalization.json
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMENT "Generate eeprom image"
- )
-endif()
-
-if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
- set(PACKAGE_STANDALONE_MIME "application/x-xz")
- set(PACKAGE_STANDALONE_FILE_NAME ${PACKAGE_COMMON_NAME}-image.tar.xz)
- add_custom_target(package-standalone
- COMMAND tar -ScJf ${PACKAGE_STANDALONE_FILE_NAME} ${DISK_IMAGE_NAME}
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- DEPENDS ${BIN_FILE} ${ECOBOOT_FILE}-target ${VERSION_JSON_FILE}-target disk_image
- )
-
- set(PACKAGE_UPDATE_FILE_NAME ${PACKAGE_COMMON_NAME}-Update.tar)
- set(PACKAGE_UPDATE_MIME "application/x-tar")
- set(UPDATE_STAGING_DIRECTORY ${PACKAGE_STAGING_DIRECTORY}/Update)
- add_custom_target(package-update-staged
- COMMAND ${CMAKE_CPACK_COMMAND}
- -C $<CONFIGURATION>
- --config ${CPACK_OUTPUT_CONFIG_FILE}
- DEPENDS ${BIN_FILE} ${ECOBOOT_FILE}-target ${VERSION_JSON_FILE}-target
- )
- add_custom_target(package-update-checksums
- COMMAND rhash
- -u checksums.txt
- -r .
- WORKING_DIRECTORY ${UPDATE_STAGING_DIRECTORY}
- DEPENDS package-update-staged
- )
-
-
- add_custom_target(package-update
- COMMAND tar
- -cf ${CMAKE_BINARY_DIR}/${PACKAGE_UPDATE_FILE_NAME}
- -C ${PACKAGE_STAGING_DIRECTORY}/Update "."
- DEPENDS ${ECOBOOT_FILE}-target ${VERSION_JSON_FILE}-target PurePhone package-update-staged package-update-checksums
- )
-endif()
-
-
-
-
-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}")
-
- 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()
+add_ecoboot()
+add_subdirectory(products)
+include(GitHubWorkerMessages)
M board/linux/libiosyscalls/test/CMakeLists.txt => board/linux/libiosyscalls/test/CMakeLists.txt +1 -1
@@ 9,5 9,5 @@ add_catch2_executable(
LIBS
module-vfs iosyscalls
DEPS
- disk_image
+ PurePhone-disk-img
)
A cmake/modules/AddBootBin.cmake => cmake/modules/AddBootBin.cmake +38 -0
@@ 0,0 1,38 @@
+function(add_boot_bin SOURCE_TARGET)
+ set(BIN_FILE ${CMAKE_BINARY_DIR}/sys/current/${SOURCE_TARGET}-boot.bin)
+
+ if (ENABLE_SECURE_BOOT)
+ set (SREC_FILE ${CMAKE_PROJECT_NAME}.srec)
+ # .srec file required by elftosb
+ add_custom_command(
+ COMMENT "Generate ${CMAKE_PROJECT_NAME}.srec"
+ OUTPUT ${CMAKE_BINARY_DIR}/${SREC_FILE}
+ DEPENDS ${SOURCE_TARGET}
+ COMMAND ${CMAKE_OBJCOPY} -Osrec $<TARGET_FILE:${SOURCE_TARGET}> ${SREC_FILE}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+
+ add_custom_command(
+ COMMENT "Generate signed boot.bin (Secure Boot)"
+ OUTPUT ${BIN_FILE}
+ DEPENDS ${CMAKE_BINARY_DIR}/${SREC_FILE}
+ COMMAND ${CMAKE_SOURCE_DIR}/config/elftosb_wrapper.sh "${ELFTOSB_PATH}" "${CST_PATH}" -f imx -V
+ -c ${CMAKE_BINARY_DIR}/imx_authenticated_hab.bd
+ -o ${BIN_FILE}
+ ${CMAKE_BINARY_DIR}/${SREC_FILE}
+ VERBATIM
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+ else ()
+ add_custom_command(
+ COMMENT "Generate ${SOURCE_TARGET}-boot.bin"
+ OUTPUT ${BIN_FILE}
+ DEPENDS ${SOURCE_TARGET}
+ COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${SOURCE_TARGET}> ${BIN_FILE}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
+ endif()
+ message("Adding '${SOURCE_TARGET}-boot.bin' target")
+ add_custom_target(${SOURCE_TARGET}-boot.bin
+ DEPENDS ${BIN_FILE})
+endfunction()
A cmake/modules/AddBootloader.cmake => cmake/modules/AddBootloader.cmake +47 -0
@@ 0,0 1,47 @@
+# download the bootloader
+
+function(add_ecoboot)
+ set(ECOBOOT_FILE ecoboot.bin)
+ 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}
+ -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}
+ -DECOBOOT_DOWNLOAD_LOG=${ECOBOOT_DOWNLOAD_LOG}
+ -B ${CMAKE_BINARY_DIR}
+ -P ${CMAKE_SOURCE_DIR}/cmake/modules/GenUpdateVersionJson.cmake
+ DEPENDS ${ECOBOOT_FILE}-target ${ECOBOOT_DOWNLOAD_LOG}
+ )
+
+ add_custom_target(${VERSION_JSON_FILE}-target DEPENDS ${VERSION_JSON_FILE})
+
+ multicomp_install(PROGRAMS ${CMAKE_BINARY_DIR}/${ECOBOOT_FILE} DESTINATION "./"
+ COMPONENTS Standalone Update)
+ multicomp_install(FILES ${CMAKE_BINARY_DIR}/${VERSION_JSON_FILE} DESTINATION "./"
+ COMPONENTS Standalone Update)
+endfunction()
A cmake/modules/AddHexTarget.cmake => cmake/modules/AddHexTarget.cmake +13 -0
@@ 0,0 1,13 @@
+function(add_hex_target SOURCE_TARGET)
+ set(HEX_FILE ${SOURCE_TARGET}.hex)
+ add_custom_command(
+ COMMENT "Generate ${HEX_FILE}"
+ OUTPUT ${CMAKE_BINARY_DIR}/${HEX_FILE}
+ DEPENDS ${SOURCE_TARGET}
+ COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${SOURCE_TARGET}>
+ )
+ add_custom_target(
+ ${HEX_FILE}-target ALL
+ DEPENDS ${CMAKE_BINARY_DIR}/${HEX_FILE}
+ )
+endfunction()
A cmake/modules/AddPackage.cmake => cmake/modules/AddPackage.cmake +79 -0
@@ 0,0 1,79 @@
+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)
+
+ set(CPACK_PACKAGE_VENDOR "Mudita")
+ set(CPACK_PACKAGE_HOMEPAGE_URL "https://mudita.com/products/pure/")
+
+ set(CPACK_TOPLEVEL_TAG ${CPACK_SYSTEM_NAME})
+ set(CPACK_OUTPUT_CONFIG_FILE ${CMAKE_BINARY_DIR}/PackageConfig.cmake)
+ set(CPACK_GENERATOR "External")
+ set(CPACK_COMPONENTS_GROUPING IGNORE)
+ set(CPACK_EXTERNAL_ENABLE_STAGING TRUE)
+ set(PACKAGE_COMMON_NAME ${CPACK_PACKAGE_NAME}-${CMAKE_PROJECT_VERSION}-${CPACK_TOPLEVEL_TAG})
+ 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)
+
+ 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
+ )
+
+ message("Adding stand alone target '${SOURCE_TARGET}-StandaloneImage'")
+ add_custom_target(${SOURCE_TARGET}-StandaloneImage
+ DEPENDS ${PACKAGE_COMMON_NAME}-package-standalone)
+ endif()
+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}
+ )
+ endif()
+endfunction()
M cmake/modules/Colours.cmake => cmake/modules/Colours.cmake +20 -20
@@ 2,27 2,27 @@ option(COLOR_OUTPUT "Use colored output" ON)
set(CMAKE_COLOR_MAKEFILE ${COLOR_OUTPUT})
if (COLOR_OUTPUT)
- string(ASCII 27 Esc)
- set(ColourReset "${Esc}[m")
- set(ColourBold "${Esc}[1m")
- set(Red "${Esc}[31m")
- set(Green "${Esc}[32m")
- set(Yellow "${Esc}[33m")
- set(Blue "${Esc}[34m")
- set(Magenta "${Esc}[35m")
- set(Cyan "${Esc}[36m")
- set(White "${Esc}[37m")
- set(BoldRed "${Esc}[1;31m")
- set(BoldGreen "${Esc}[1;32m")
- set(BoldYellow "${Esc}[1;33m")
- set(BoldBlue "${Esc}[1;34m")
- set(BoldMagenta "${Esc}[1;35m")
- set(BoldCyan "${Esc}[1;36m")
- set(BoldWhite "${Esc}[1;37m")
+ string(ASCII 27 Esc)
+ set(ColourReset "${Esc}[m")
+ set(ColourBold "${Esc}[1m")
+ set(Red "${Esc}[31m")
+ set(Green "${Esc}[32m")
+ set(Yellow "${Esc}[33m")
+ set(Blue "${Esc}[34m")
+ set(Magenta "${Esc}[35m")
+ set(Cyan "${Esc}[36m")
+ set(White "${Esc}[37m")
+ set(BoldRed "${Esc}[1;31m")
+ set(BoldGreen "${Esc}[1;32m")
+ set(BoldYellow "${Esc}[1;33m")
+ set(BoldBlue "${Esc}[1;34m")
+ set(BoldMagenta "${Esc}[1;35m")
+ set(BoldCyan "${Esc}[1;36m")
+ set(BoldWhite "${Esc}[1;37m")
- set(ORANGE "${Esc}[38;2;255;100;0m")
+ set(Orange "${Esc}[38;2;255;100;0m")
- add_compile_options (-fdiagnostics-color=always)
+ add_compile_options (-fdiagnostics-color=always)
else (COLOR_OUTPUT)
- add_compile_options (-fdiagnostics-color=never)
+ add_compile_options (-fdiagnostics-color=never)
endif (COLOR_OUTPUT)
M cmake/modules/DiskImage.cmake => cmake/modules/DiskImage.cmake +25 -17
@@ 1,19 1,27 @@
-set(DISK_IMAGE_NAME ${CMAKE_PROJECT_NAME}.img)
-set(DISK_IMAGE ${CMAKE_BINARY_DIR}/${DISK_IMAGE_NAME})
+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)
-if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
- SET(TARGET_DEP ${BIN_FILE} pureflash)
-else()
- SET(TARGET_DEP ${CMAKE_PROJECT_NAME})
-endif()
+ if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
+ SET(TARGET_DEP ${BIN_FILE} pureflash)
+ else()
+ SET(TARGET_DEP ${SOURCE_TARGET})
+ endif()
-add_custom_target(
- disk_image ALL
- DEPENDS genlittlefs
- DEPENDS assets
- DEPENDS ${TARGET_DEP}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate_purephone_image.sh
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate_purephone_image.sh ${DISK_IMAGE} ${CMAKE_BINARY_DIR}
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMENT "Generate ${DISK_IMAGE}"
- )
+ add_custom_command(
+ OUTPUT ${DISK_IMAGE_NAME}
+ DEPENDS
+ DEPENDS genlittlefs
+ DEPENDS assets
+ 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}
+ 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()
M cmake/modules/GenVersionHpp.cmake => cmake/modules/GenVersionHpp.cmake +0 -1
@@ 3,7 3,6 @@
list(APPEND CMAKE_MODULE_PATH "${SRC_DIR}/cmake/modules")
include(Version)
-
configure_file(
${SRC_DIR}/source/version.hpp.template
${CMAKE_BINARY_DIR}/source/version.hpp
A cmake/modules/GitHubWorkerMessages.cmake => cmake/modules/GitHubWorkerMessages.cmake +11 -0
@@ 0,0 1,11 @@
+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}")
+
+ 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()
M cmake/modules/SerialPort.cmake => cmake/modules/SerialPort.cmake +3 -3
@@ 36,9 36,9 @@ macro(message_serial_status)
if (SERIAL_PORT_DEF)
message("Using serial port: ${SERIAL_PORT_DEF}")
else()
- message ("${ORANGE}Serial Port not defined, modem support disabled! ${ColourReset}")
- message ("${ORANGE}add -DSERIAL_PORT=<path to serail> where modem is connected ${ColourReset}")
- message ("${ORANGE}ex.: \n ./configure.sh linux Debug -DSERIAL_PORT=/dev/ttyUSB0 ${ColourReset}")
+ message ("${Orange}Serial Port not defined, modem support disabled! ${ColourReset}")
+ message ("${Orange}add -DSERIAL_PORT=<path to serail> where modem is connected ${ColourReset}")
+ message ("${Orange}ex.: \n ./configure.sh linux Debug -DSERIAL_PORT=/dev/ttyUSB0 ${ColourReset}")
endif()
endif()
endmacro()
M cmake/modules/Utils.cmake => cmake/modules/Utils.cmake +7 -0
@@ 12,3 12,10 @@ function(multicomp_install)
endforeach()
endfunction()
+macro(print_var VARIABLE)
+ if(${VARIABLE})
+ message(STATUS "${Green}${VARIABLE}: '${Orange}${${VARIABLE}}${ColourReset}'")
+ else()
+ message(STATUS "${Orange}No such variable: '${Red}${VARIABLE}${ColourReset}'")
+ endif()
+endmacro()
M cmake/modules/Version.cmake => cmake/modules/Version.cmake +0 -1
@@ 90,4 90,3 @@ set(CMAKE_PROJECT_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(CMAKE_PROJECT_VERSION_MINOR "${CMAKE_MATCH_2}")
set(CMAKE_PROJECT_VERSION_PATCH "${CMAKE_MATCH_3}")
set(CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH}")
-
M generate_purephone_image.sh => generate_purephone_image.sh +9 -6
@@ 4,13 4,14 @@
usage() {
cat << ==usage
-Usage: $(basename $0) [image_path] [build_dir]
- image_path Destination image path name for. ex PurePhone.img
- build_dir PurePhone build dir for ex. build-rt1051-RelWithDebInfo
+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
}
-if [ $# -ne 2 ]; then
+if [ $# -ne 3 ]; then
echo "Error! Invalid argument count"
usage
exit -1
@@ 18,6 19,8 @@ fi
IMAGE_NAME=$(realpath $1)
BUILDDIR=$(realpath $2)
+BIN_FILE="$3"
+BIN_FILE_PATH="current/${BIN_FILE}"
if [ ! -d "$BUILDDIR" ]; then
echo "Error! \${build_dir} (${BUILDDIR}) is not a directory"
@@ 106,8 109,8 @@ for i in $CURRENT_DATA; do
fi
done
-if [ -f "current/boot.bin" ]; then
- mcopy -s -i "$PART1" "current/boot.bin" ::/current/
+if [ -f "${BIN_FILE_PATH}" ]; then
+ mcopy -s -i "$PART1" ${BIN_FILE_PATH} ::/current/boot.bin
else
echo "Warning! Missing boot.bin"
echo "(it's fine for a Linux build)"
M module-db/tests/CMakeLists.txt => module-db/tests/CMakeLists.txt +2 -1
@@ 1,4 1,4 @@
-if (NOT IS_SYMLINK "${CMAKE_BINARY_DIR}/sys/user")
+if (NOT IS_SYMLINK "${CMAKE_BINARY_DIR}/sys/user")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/sys/user")
endif()
@@ 40,5 40,6 @@ add_catch2_executable(
module-db
DEPS
assets
+ PurePhone-disk-img
)
add_subdirectory(test-initializer)
M module-db/tests/test-initializer/CMakeLists.txt => module-db/tests/test-initializer/CMakeLists.txt +2 -1
@@ 1,4 1,4 @@
-if (NOT IS_SYMLINK "${CMAKE_BINARY_DIR}/sys/user")
+if (NOT IS_SYMLINK "${CMAKE_BINARY_DIR}/sys/user")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/sys/user")
endif()
@@ 15,4 15,5 @@ add_catch2_executable(
module-db
DEPS
assets
+ PurePhone-disk-img
)
M module-gui/test/test-catch-text/CMakeLists.txt => module-gui/test/test-catch-text/CMakeLists.txt +2 -1
@@ 1,4 1,4 @@
-# gui tests
+# gui tests
add_catch2_executable(
NAME
gui-text
@@ 25,4 25,5 @@ add_catch2_executable(
module-gui
DEPS
assets
+ PurePhone-disk-img
)
M module-gui/test/test-catch/CMakeLists.txt => module-gui/test/test-catch/CMakeLists.txt +2 -1
@@ 1,4 1,4 @@
-# gui tests
+# gui tests
add_catch2_executable(
NAME
gui
@@ 19,4 19,5 @@ add_catch2_executable(
module-gui
DEPS
assets
+ PurePhone-disk-img
)
M module-services/service-db/test/CMakeLists.txt => module-services/service-db/test/CMakeLists.txt +1 -1
@@ 17,7 17,7 @@ add_catch2_executable(
module-cellular
iosyscalls
DEPS
- disk_image
+ PurePhone-disk-img
)
add_catch2_executable(
M module-services/service-db/test/test-settings/CMakeLists.txt => module-services/service-db/test/test-settings/CMakeLists.txt +2 -1
@@ 1,4 1,4 @@
-# service-db tests
+# service-db tests
add_catch2_executable(
NAME
service-db-settings
@@ 12,4 12,5 @@ add_catch2_executable(
service-cellular
module-cellular
DEPS
+ PurePhone-disk-img
)
M module-services/service-desktop/tests/CMakeLists.txt => module-services/service-desktop/tests/CMakeLists.txt +1 -1
@@ 13,7 13,7 @@ add_catch2_executable(
module-apps
iosyscalls
DEPS
- disk_image
+ PurePhone-disk-img
)
add_catch2_executable(
M module-services/service-eink/board/linux/renderer/CMakeLists.txt => module-services/service-eink/board/linux/renderer/CMakeLists.txt +0 -2
@@ 43,5 43,3 @@ if(_target_link_flags)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_OPTIONS "${_target_link_flags}")
endif()
-add_dependencies(${CMAKE_PROJECT_NAME} service_renderer)
-
M module-services/service-eink/board/linux/renderer/src/RWindow.hpp => module-services/service-eink/board/linux/renderer/src/RWindow.hpp +1 -1
@@ 1,4 1,4 @@
-// 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
#pragma once
M module-sys/CMakeLists.txt => module-sys/CMakeLists.txt +6 -3
@@ 51,14 51,17 @@ 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(${PROJECT_NAME} STATIC ${SOURCES} ${BOARD_SOURCES})
+add_library(module-sys STATIC)
+target_sources(module-sys PRIVATE ${SOURCES} ${BOARD_SOURCES})
-target_link_libraries(${PROJECT_NAME}
+target_link_libraries(module-sys
PRIVATE
bus
service-evtmgr
+ messagetype
PUBLIC
- module-os)
+ module-os
+ )
# Board specific compilation definitions,options,include directories and features
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_CONFIG_DEFINITIONS})
M module-sys/Service/Message.hpp => module-sys/Service/Message.hpp +3 -2
@@ 3,11 3,12 @@
#pragma once
-#include <magic_enum.hpp>
#include "Common.hpp"
-#include "MessageType.hpp"
#include "MessageForward.hpp"
+#include <MessageType.hpp>
+#include <magic_enum.hpp>
+
#include <cstdint>
#include <memory>
#include <string>
M module-utils/test/CMakeLists.txt => module-utils/test/CMakeLists.txt +2 -2
@@ 64,7 64,7 @@ add_catch2_executable(
module-utils
iosyscalls
DEPS
- disk_image
+ PurePhone-disk-img
)
# utils tests
@@ 77,7 77,7 @@ add_catch2_executable(
module-utils
iosyscalls
DEPS
- disk_image
+ PurePhone-disk-img
)
# Math tests
A products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +88 -0
@@ 0,0 1,88 @@
+add_executable(BellHybrid)
+add_image(BellHybrid)
+
+add_custom_target(Bell
+ DEPENDS BellHybrid BellHybrid.img
+ )
+
+
+target_link_directories(BellHybrid PUBLIC ${PROJECT_LIB_DIRECTORY})
+
+target_compile_definitions(BellHybrid PUBLIC ${PROJECT_CONFIG_DEFINITIONS}
+ ${TARGET_COMPILE_DEFINITIONS}
+ ${PROJECT_TARGET}
+ )
+
+target_compile_features(BellHybrid PUBLIC
+ ${TARGET_COMPILE_FEATURES})
+
+target_compile_options(BellHybrid PUBLIC $<$<COMPILE_LANGUAGE:C>:-Wno-discarded-qualifiers>)
+target_compile_options(BellHybrid PUBLIC "-Wno-error=deprecated-declarations")
+
+target_sources(BellHybrid PRIVATE ${TARGET_SOURCES})
+
+target_sources(BellHybrid
+ PRIVATE
+ 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_link_libraries(BellHybrid
+ PUBLIC
+ module-apps
+ service-desktop
+ service-bluetooth
+ service-lwip
+ ${LWIP_LIBRARIES}
+ )
+
+if (${PROJECT_TARGET} STREQUAL "TARGET_Linux")
+ target_link_libraries(BellHybrid
+ PUBLIC iosyscalls)
+ add_dependencies(Pure service_renderer)
+endif()
+
+set_source_files_properties(BellHybridMain.cpp PROPERTIES COMPILE_DEFINITIONS "${ENABLED_APPS_DEFINES}")
+
+target_link_options(BellHybrid PUBLIC ${TARGET_LINK_OPTIONS})
+
+
+
+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)
+
+include(AddHexTarget)
+add_hex_target(BellHybrid)
+
+add_standalone_image(BellHybrid)
+add_update_package(BellHybrid)
+
A products/BellHybrid/config.h => products/BellHybrid/config.h +6 -0
@@ 0,0 1,6 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#define ENABLE_GSM (0)
A products/CMakeLists.txt => products/CMakeLists.txt +2 -0
@@ 0,0 1,2 @@
+add_subdirectory(PurePhone)
+add_subdirectory(BellHybrid)
A products/PurePhone/CMakeLists.txt => products/PurePhone/CMakeLists.txt +90 -0
@@ 0,0 1,90 @@
+add_executable(PurePhone)
+add_image(PurePhone)
+
+add_custom_target(Pure
+ DEPENDS PurePhone PurePhone.img
+ )
+
+
+target_link_directories(PurePhone PUBLIC ${PROJECT_LIB_DIRECTORY})
+
+target_compile_definitions(PurePhone PUBLIC ${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_sources(PurePhone PRIVATE ${TARGET_SOURCES})
+
+target_sources(PurePhone
+ PRIVATE
+ 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")
+
+set_target_properties(PurePhone PROPERTIES LINK_FLAGS "-Xlinker -Map=${CMAKE_BINARY_DIR}/PurePhone.map ")
+
+target_link_libraries(PurePhone
+ PUBLIC
+ module-apps
+ service-desktop
+ service-bluetooth
+ service-lwip
+ ${LWIP_LIBRARIES}
+ )
+
+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()
+
+message_serial_status()
+
+target_link_libraries(PurePhone PUBLIC messagetype)
+
+add_dependencies(PurePhone version)
+
+include(AddBootBin)
+add_boot_bin(PurePhone)
+
+include(AddHexTarget)
+add_hex_target(PurePhone)
+
+add_standalone_image(PurePhone)
+add_update_package(PurePhone)
+
R source/main.cpp => products/PurePhone/PurePhoneMain.cpp +0 -0
R source/config.h => products/PurePhone/config.h +0 -0
A source/CMakeLists.txt => source/CMakeLists.txt +6 -0
@@ 0,0 1,6 @@
+add_library(messagetype INTERFACE)
+target_sources(messagetype
+ PUBLIC
+ MessageType.hpp
+ )
+target_include_directories(messagetype INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
M source/MessageType.hpp => source/MessageType.hpp +1 -4
@@ 1,8 1,7 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#ifndef SOURCE_MESSAGETYPE_HPP_
-#define SOURCE_MESSAGETYPE_HPP_
+#pragma once
enum class MessageType
{
@@ 165,5 164,3 @@ enum class MessageType
// Quotes messages
Quotes,
};
-
-#endif /* SOURCE_MESSAGETYPE_HPP_ */
A tools/generate_update_image.sh => tools/generate_update_image.sh +99 -0
@@ 0,0 1,99 @@
+#!/bin/bash -e
+# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#create update image
+
+function help() {
+cat <<- EOF
+ Crate Update Image for the SOURCE_TARGET. This scritp should be run from build directory.
+
+ ${0} <SOURCE_TARGET> <VERSION> <PLATFORM>
+
+ SOURCE_TARGET - Name of the target (usually PurePhone or BellHybrid)
+ VERSION - version number to attach to file name
+ PLATFORM - RT1051 or Linux
+
+ In current work dir script will crete update image inf form:
+ <SOURCE_TARGET>-<VERSION>-<PLATFORM>-Update.tar
+
+
+
+EOF
+}
+
+function setVars() {
+ SOURCE_TARGET=${1}
+ VERSION=${2}
+ PLATFORM=${3}
+ STAGEING_DIR="${SOURCE_TARGET}-${VERSION}-${PLATFORM}-Update"
+ PACKAGE_FILE="${STAGEING_DIR}.tar"
+ DEPS=(
+ "sys/current/assets"
+ "sys/user"
+ "sys/current/${SOURCE_TARGET}-boot.bin"
+ "sys/current/country-codes.db"
+ "sys/current/Luts.bin"
+ "version.json"
+ "ecoboot.bin"
+ )
+}
+
+function checkForDeps() {
+ local DEPS=${1}
+ I=0
+ DEPS_COUNT=${#DEPS[@]}
+ while [[ I -lt ${DEPS_COUNT} ]]; do
+ ITEM=${DEPS[${I}]}
+ if [[ ! -e "${ITEM}" ]]; then
+ echo "Couldn't find dependency: \"${ITEM}\""
+ echo exti 2
+ fi
+ I=$(( I + 1))
+ done
+ echo "Deps-OK"
+}
+
+function clenStagingDir(){
+ local STAGEING_DIR=${1}
+ if [[ -d ${STAGEING_DIR} ]]; then
+ rm -Rf ${STAGEING_DIR}
+ fi
+ mkdir ${STAGEING_DIR} -v
+}
+
+function linkInStageing(){
+ pushd ${STAGEING_DIR} 1> /dev/null
+ ln -s ../sys/current/assets
+ ln -s ../sys/user
+ ln -s ../sys/current/${SOURCE_TARGET}-boot.bin boot.bin
+ ln -s ../sys/current/country-codes.db
+ ln -s ../sys/current/Luts.bin
+ ln -s ../ecoboot.bin
+ ln -s ../version.json
+ popd 1> /dev/null
+}
+
+function addChecksums() {
+ pushd ${STAGEING_DIR} 1> /dev/null
+ rhash -u checksums.txt -r .
+ popd 1> /dev/null
+}
+
+function compress() {
+ tar chf ${PACKAGE_FILE} -C ${STAGEING_DIR} .
+}
+
+if [[ $# -ne 3 ]]; then
+ help
+ exit 1
+fi
+
+setVars "${1}" "${2}" "${3}"
+checkForDeps ${DEPS}
+clenStagingDir ${STAGEING_DIR}
+linkInStageing
+addChecksums
+compress
+
+