Merge remote-tracking branch 'upstream/develop' into pinetimestyle

This commit is contained in:
Kieran Cawthray 2021-06-04 08:57:40 +02:00
commit f2d01166c3
7 changed files with 182 additions and 196 deletions

View File

@ -74,21 +74,6 @@ macro(nRF5x_setup)
) )
endif () endif ()
set(COMMON_FLAGS "-MP -MD -mthumb -mabi=aapcs -Wall -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums ${CPU_FLAGS} -Wreturn-type -Werror=return-type")
# compiler/assambler/linker flags
set(CMAKE_C_FLAGS "${COMMON_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_ASM_FLAGS "-MP -MD -x assembler-with-cpp")
set(CMAKE_EXE_LINKER_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} ${CPU_FLAGS} -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm")
# note: we must override the default cmake linker flags so that CMAKE_C_FLAGS are not added implicitly
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> <OBJECTS> -lstdc++ -o <TARGET> <LINK_LIBRARIES>")
# basic board definitions and drivers # basic board definitions and drivers
include_directories( include_directories(
"${NRF5_SDK_PATH}/components" "${NRF5_SDK_PATH}/components"

View File

@ -746,17 +746,19 @@ link_directories(
) )
set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -Wall -Wno-unknown-pragmas -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type) set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -Wall -Wno-unknown-pragmas -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type -fstack-usage -fno-exceptions -fno-non-call-exceptions)
add_definitions(-DCONFIG_GPIO_AS_PINRESET) add_definitions(-DCONFIG_GPIO_AS_PINRESET)
add_definitions(-DDEBUG)
add_definitions(-DNIMBLE_CFG_CONTROLLER) add_definitions(-DNIMBLE_CFG_CONTROLLER)
add_definitions(-DOS_CPUTIME_FREQ) add_definitions(-DOS_CPUTIME_FREQ)
add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64 -DNRF52_PAN_12 -DNRF52_PAN_58 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_55 -DBOARD_PCA10040) add_definitions(-DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_74 -DNRF52_PAN_64 -DNRF52_PAN_12 -DNRF52_PAN_58 -DNRF52_PAN_54 -DNRF52_PAN_31 -DNRF52_PAN_51 -DNRF52_PAN_36 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_55 -DBOARD_PCA10040)
add_definitions(-DFREERTOS) add_definitions(-DFREERTOS)
add_definitions(-DDEBUG_NRF_USER)
add_definitions(-D__STACK_SIZE=8192) add_definitions(-D__STACK_SIZE=8192)
add_definitions(-D__HEAP_SIZE=8192) add_definitions(-D__HEAP_SIZE=8192)
# NOTE : Add the following defines to enable debug mode of the NRF SDK:
#add_definitions(-DDEBUG)
#add_definitions(-DDEBUG_NRF_USER)
if (NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release") set(CMAKE_BUILD_TYPE "Release")
endif () endif ()
@ -766,10 +768,10 @@ add_library(nrf-sdk STATIC ${SDK_SOURCE_FILES})
target_include_directories(nrf-sdk SYSTEM PUBLIC . ../) target_include_directories(nrf-sdk SYSTEM PUBLIC . ../)
target_include_directories(nrf-sdk SYSTEM PUBLIC ${INCLUDES_FROM_LIBS}) target_include_directories(nrf-sdk SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(nrf-sdk PRIVATE target_compile_options(nrf-sdk PRIVATE
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -778,10 +780,10 @@ add_library(nimble STATIC ${NIMBLE_SRC} ${TINYCRYPT_SRC})
target_include_directories(nimble SYSTEM PUBLIC . ../) target_include_directories(nimble SYSTEM PUBLIC . ../)
target_include_directories(nimble SYSTEM PUBLIC ${INCLUDES_FROM_LIBS}) target_include_directories(nimble SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(nimble PRIVATE target_compile_options(nimble PRIVATE
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -Wno-unused-but-set-variable -Wno-maybe-uninitialized>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -790,10 +792,10 @@ add_library(lvgl STATIC ${LVGL_SRC})
target_include_directories(lvgl SYSTEM PUBLIC . ../) target_include_directories(lvgl SYSTEM PUBLIC . ../)
target_include_directories(lvgl SYSTEM PUBLIC ${INCLUDES_FROM_LIBS}) target_include_directories(lvgl SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(lvgl PRIVATE target_compile_options(lvgl PRIVATE
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -805,10 +807,10 @@ add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME}) set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME})
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl) target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl)
target_compile_options(${EXECUTABLE_NAME} PUBLIC target_compile_options(${EXECUTABLE_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -835,10 +837,10 @@ add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl) target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl)
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME}) set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME})
target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -872,10 +874,10 @@ target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk)
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME}) set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME})
target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY") target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY")
target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -902,10 +904,10 @@ target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk)
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}) set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME})
target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY") target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY")
target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
@ -939,10 +941,10 @@ add_executable(${EXECUTABLE_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES})
target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk) target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk)
set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}) set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERYLOADER_FILE_NAME})
target_compile_options(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC target_compile_options(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
target_include_directories(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC target_include_directories(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC
@ -972,10 +974,10 @@ add_executable(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE
target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk) target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk)
set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}) set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME})
target_compile_options(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC target_compile_options(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -O0 -g3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>: ${COMMON_FLAGS} -Og -g3 -fno-rtti>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -O3> $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:RELEASE>>: ${COMMON_FLAGS} -Os -fno-rtti>
$<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp> $<$<COMPILE_LANGUAGE:ASM>: -MP -MD -x assembler-with-cpp>
) )
target_include_directories(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC target_include_directories(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC

View File

@ -294,6 +294,25 @@ static void vPortEnableVFP( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
uint32_t ulSetInterruptMaskFromISR( void )
{
__asm volatile (
" mrs r0, PRIMASK \n"
" cpsid i \n"
" bx lr "
::: "memory"
);
}
void vClearInterruptMaskFromISR( __attribute__( ( unused ) ) uint32_t ulMask )
{
__asm volatile (
" msr PRIMASK, r0 \n"
" bx lr "
::: "memory"
);
}
#if ( configASSERT_DEFINED == 1 ) #if ( configASSERT_DEFINED == 1 )
void vPortValidateInterruptPriority( void ) void vPortValidateInterruptPriority( void )
@ -354,24 +373,4 @@ static void vPortEnableVFP( void )
configASSERT( NVIC_GetPriorityGrouping() <= ulMaxPRIGROUPValue ); configASSERT( NVIC_GetPriorityGrouping() <= ulMaxPRIGROUPValue );
} }
uint32_t ulSetInterruptMaskFromISR( void )
{
__asm volatile (
" mrs r0, PRIMASK \n"
" cpsid i \n"
" bx lr "
::: "memory"
);
}
/*-----------------------------------------------------------*/
void vClearInterruptMaskFromISR( __attribute__( ( unused ) ) uint32_t ulMask )
{
__asm volatile (
" msr PRIMASK, r0 \n"
" bx lr "
::: "memory"
);
}
#endif /* configASSERT_DEFINED */ #endif /* configASSERT_DEFINED */

View File

@ -153,7 +153,7 @@ void DisplayApp::Refresh() {
break; break;
case Messages::TimerDone: case Messages::TimerDone:
if (currentApp == Apps::Timer) { if (currentApp == Apps::Timer) {
auto *timer = dynamic_cast<Screens::Timer*>(currentScreen.get()); auto *timer = static_cast<Screens::Timer*>(currentScreen.get());
timer->setDone(); timer->setDone();
} else { } else {
LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down); LoadApp(Apps::Timer, DisplayApp::FullRefreshDirections::Down);

View File

@ -24,6 +24,106 @@ using namespace Pinetime::Applications::Screens;
LV_FONT_DECLARE(lv_font_navi_80) LV_FONT_DECLARE(lv_font_navi_80)
namespace {
constexpr std::array<std::pair<const char*, const char*>, 86> m_iconMap = {{
{"arrive-left", "\xEE\xA4\x81"},
{"arrive-right", "\xEE\xA4\x82"},
{"arrive-straight", "\xEE\xA4\x80"},
{"arrive", "\xEE\xA4\x80"},
{"close", "\xEE\xA4\x83"},
{"continue-left", "\xEE\xA4\x85"},
{"continue-right", "\xEE\xA4\x86"},
{"continue-slight-left", "\xEE\xA4\x87"},
{"continue-slight-right", "\xEE\xA4\x88"},
{"continue-straight", "\xEE\xA4\x84"},
{"continue-uturn", "\xEE\xA4\x89"},
{"continue", "\xEE\xA4\x84"},
{"depart-left", "\xEE\xA4\x8B"},
{"depart-right", "\xEE\xA4\x8C"},
{"depart-straight", "\xEE\xA4\x8A"},
{"end-of-road-left", "\xEE\xA4\x8D"},
{"end-of-road-right", "\xEE\xA4\x8E"},
{"ferry", "\xEE\xA4\x8F"},
{"flag", "\xEE\xA4\x90"},
{"fork-left", "\xEE\xA4\x92"},
{"fork-right", "\xEE\xA4\x93"},
{"fork-slight-left", "\xEE\xA4\x94"},
{"fork-slight-right", "\xEE\xA4\x95"},
{"fork-straight", "\xEE\xA4\x96"},
{"invalid", "\xEE\xA4\x84"},
{"invalid-left", "\xEE\xA4\x85"},
{"invalid-right", "\xEE\xA4\x86"},
{"invalid-slight-left", "\xEE\xA4\x87"},
{"invalid-slight-right", "\xEE\xA4\x88"},
{"invalid-straight", "\xEE\xA4\x84"},
{"invalid-uturn", "\xEE\xA4\x89"},
{"merge-left", "\xEE\xA4\x97"},
{"merge-right", "\xEE\xA4\x98"},
{"merge-slight-left", "\xEE\xA4\x99"},
{"merge-slight-right", "\xEE\xA4\x9A"},
{"merge-straight", "\xEE\xA4\x84"},
{"new-name-left", "\xEE\xA4\x85"},
{"new-name-right", "\xEE\xA4\x86"},
{"new-name-sharp-left", "\xEE\xA4\x9B"},
{"new-name-sharp-right", "\xEE\xA4\x9C"},
{"new-name-slight-left", "\xEE\xA4\x87"},
{"new-name-slight-right", "\xEE\xA4\x88"},
{"new-name-straight", "\xEE\xA4\x84"},
{"notification-left", "\xEE\xA4\x85"},
{"notification-right", "\xEE\xA4\x86"},
{"notification-sharp-left", "\xEE\xA4\x9B"},
{"notification-sharp-right", "\xEE\xA4\xA5"},
{"notification-slight-left", "\xEE\xA4\x87"},
{"notification-slight-right", "\xEE\xA4\x88"},
{"notification-straight", "\xEE\xA4\x84"},
{"off-ramp-left", "\xEE\xA4\x9D"},
{"off-ramp-right", "\xEE\xA4\x9E"},
{"off-ramp-slight-left", "\xEE\xA4\x9F"},
{"off-ramp-slight-right", "\xEE\xA4\xA0"},
{"on-ramp-left", "\xEE\xA4\x85"},
{"on-ramp-right", "\xEE\xA4\x86"},
{"on-ramp-sharp-left", "\xEE\xA4\x9B"},
{"on-ramp-sharp-right", "\xEE\xA4\xA5"},
{"on-ramp-slight-left", "\xEE\xA4\x87"},
{"on-ramp-slight-right", "\xEE\xA4\x88"},
{"on-ramp-straight", "\xEE\xA4\x84"},
{"rotary", "\xEE\xA4\xA1"},
{"rotary-left", "\xEE\xA4\xA2"},
{"rotary-right", "\xEE\xA4\xA3"},
{"rotary-sharp-left", "\xEE\xA4\xA4"},
{"rotary-sharp-right", "\xEE\xA4\xA5"},
{"rotary-slight-left", "\xEE\xA4\xA6"},
{"rotary-slight-right", "\xEE\xA4\xA7"},
{"rotary-straight", "\xEE\xA4\xA8"},
{"roundabout", "\xEE\xA4\xA1"},
{"roundabout-left", "\xEE\xA4\xA2"},
{"roundabout-right", "\xEE\xA4\xA3"},
{"roundabout-sharp-left", "\xEE\xA4\xA4"},
{"roundabout-sharp-right", "\xEE\xA4\xA5"},
{"roundabout-slight-left", "\xEE\xA4\xA6"},
{"roundabout-slight-right", "\xEE\xA4\xA7"},
{"roundabout-straight", "\xEE\xA4\xA8"},
{"turn-left", "\xEE\xA4\x85"},
{"turn-right", "\xEE\xA4\x86"},
{"turn-sharp-left", "\xEE\xA4\x9B"},
{"turn-sharp-right", "\xEE\xA4\xA5"},
{"turn-slight-left", "\xEE\xA4\x87"},
{"turn-slight-right", "\xEE\xA4\x88"},
{"turn-straight", "\xEE\xA4\x84"},
{"updown", "\xEE\xA4\xA9"},
{"uturn", "\xEE\xA4\x89"},
}};
const char* iconForName(const std::string& icon) {
for (auto iter : m_iconMap) {
if (iter.first == icon) {
return iter.second;
}
}
return "\xEE\xA4\x90";
}
}
/** /**
* Navigation watchapp * Navigation watchapp
* *
@ -68,27 +168,25 @@ Navigation::~Navigation() {
} }
bool Navigation::Refresh() { bool Navigation::Refresh() {
if (flag != navService.getFlag()) {
if (m_flag != navService.getFlag()) { flag = navService.getFlag();
m_flag = navService.getFlag(); lv_label_set_text(imgFlag, iconForName(flag));
lv_label_set_text(imgFlag, iconForName(m_flag));
// lv_img_set_src_arr(imgFlag, iconForName(m_flag));
} }
if (m_narrative != navService.getNarrative()) { if (narrative != navService.getNarrative()) {
m_narrative = navService.getNarrative(); narrative = navService.getNarrative();
lv_label_set_text(txtNarrative, m_narrative.data()); lv_label_set_text(txtNarrative, narrative.data());
} }
if (m_manDist != navService.getManDist()) { if (manDist != navService.getManDist()) {
m_manDist = navService.getManDist(); manDist = navService.getManDist();
lv_label_set_text(txtManDist, m_manDist.data()); lv_label_set_text(txtManDist, manDist.data());
} }
if (m_progress != navService.getProgress()) { if (progress != navService.getProgress()) {
m_progress = navService.getProgress(); progress = navService.getProgress();
lv_bar_set_value(barProgress, m_progress, LV_ANIM_OFF); lv_bar_set_value(barProgress, progress, LV_ANIM_OFF);
if (m_progress > 90) { if (progress > 90) {
lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED); lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED);
} else { } else {
lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
@ -98,11 +196,4 @@ bool Navigation::Refresh() {
return running; return running;
} }
const char* Navigation::iconForName(std::string icon) {
for (auto iter : m_iconMap) {
if (iter.first == icon) {
return iter.second;
}
}
return "\xEE\xA4\x90";
}

View File

@ -45,103 +45,10 @@ namespace Pinetime {
Pinetime::Controllers::NavigationService& navService; Pinetime::Controllers::NavigationService& navService;
std::string m_flag; std::string flag;
std::string m_narrative; std::string narrative;
std::string m_manDist; std::string manDist;
int m_progress; int progress;
/** Watchapp */
const char* iconForName(std::string icon);
std::array<std::pair<std::string, const char*>, 89> m_iconMap = {{
{"arrive-left", "\xEE\xA4\x81"},
{"arrive-right", "\xEE\xA4\x82"},
{"arrive-straight", "\xEE\xA4\x80"},
{"arrive", "\xEE\xA4\x80"},
{"close", "\xEE\xA4\x83"},
{"continue-left", "\xEE\xA4\x85"},
{"continue-right", "\xEE\xA4\x86"},
{"continue-slight-left", "\xEE\xA4\x87"},
{"continue-slight-right", "\xEE\xA4\x88"},
{"continue-straight", "\xEE\xA4\x84"},
{"continue-uturn", "\xEE\xA4\x89"},
{"continue", "\xEE\xA4\x84"},
{"depart-left", "\xEE\xA4\x8B"},
{"depart-right", "\xEE\xA4\x8C"},
{"depart-straight", "\xEE\xA4\x8A"},
{"end-of-road-left", "\xEE\xA4\x8D"},
{"end-of-road-right", "\xEE\xA4\x8E"},
{"ferry", "\xEE\xA4\x8F"},
{"flag", "\xEE\xA4\x90"},
{"fork-left", "\xEE\xA4\x92"},
{"fork-right", "\xEE\xA4\x93"},
{"fork-slight-left", "\xEE\xA4\x94"},
{"fork-slight-right", "\xEE\xA4\x95"},
{"fork-straight", "\xEE\xA4\x96"},
{"invalid", "\xEE\xA4\x84"},
{"invalid-left", "\xEE\xA4\x85"},
{"invalid-right", "\xEE\xA4\x86"},
{"invalid-slight-left", "\xEE\xA4\x87"},
{"invalid-slight-right", "\xEE\xA4\x88"},
{"invalid-straight", "\xEE\xA4\x84"},
{"invalid-uturn", "\xEE\xA4\x89"},
{"merge-left", "\xEE\xA4\x97"},
{"merge-right", "\xEE\xA4\x98"},
{"merge-slight-left", "\xEE\xA4\x99"},
{"merge-slight-right", "\xEE\xA4\x9A"},
{"merge-straight", "\xEE\xA4\x84"},
{"new-name-left", "\xEE\xA4\x85"},
{"new-name-right", "\xEE\xA4\x86"},
{"new-name-sharp-left", "\xEE\xA4\x9B"},
{"new-name-sharp-right", "\xEE\xA4\x9C"},
{"new-name-slight-left", "\xEE\xA4\x87"},
{"new-name-slight-right", "\xEE\xA4\x88"},
{"new-name-straight", "\xEE\xA4\x84"},
{"notification-left", "\xEE\xA4\x85"},
{"notification-right", "\xEE\xA4\x86"},
{"notification-sharp-left", "\xEE\xA4\x9B"},
{"notification-sharp-right", "\xEE\xA4\xA5"},
{"notification-slight-left", "\xEE\xA4\x87"},
{"notification-slight-right", "\xEE\xA4\x88"},
{"notification-straight", "\xEE\xA4\x84"},
{"off-ramp-left", "\xEE\xA4\x9D"},
{"off-ramp-right", "\xEE\xA4\x9E"},
{"off-ramp-slight-left", "\xEE\xA4\x9F"},
{"off-ramp-slight-right", "\xEE\xA4\xA0"},
{"on-ramp-left", "\xEE\xA4\x85"},
{"on-ramp-right", "\xEE\xA4\x86"},
{"on-ramp-sharp-left", "\xEE\xA4\x9B"},
{"on-ramp-sharp-right", "\xEE\xA4\xA5"},
{"on-ramp-slight-left", "\xEE\xA4\x87"},
{"on-ramp-slight-right", "\xEE\xA4\x88"},
{"on-ramp-straight", "\xEE\xA4\x84"},
{"rotary", "\xEE\xA4\xA1"},
{"rotary-left", "\xEE\xA4\xA2"},
{"rotary-right", "\xEE\xA4\xA3"},
{"rotary-sharp-left", "\xEE\xA4\xA4"},
{"rotary-sharp-right", "\xEE\xA4\xA5"},
{"rotary-slight-left", "\xEE\xA4\xA6"},
{"rotary-slight-right", "\xEE\xA4\xA7"},
{"rotary-straight", "\xEE\xA4\xA8"},
{"roundabout", "\xEE\xA4\xA1"},
{"roundabout-left", "\xEE\xA4\xA2"},
{"roundabout-right", "\xEE\xA4\xA3"},
{"roundabout-sharp-left", "\xEE\xA4\xA4"},
{"roundabout-sharp-right", "\xEE\xA4\xA5"},
{"roundabout-slight-left", "\xEE\xA4\xA6"},
{"roundabout-slight-right", "\xEE\xA4\xA7"},
{"roundabout-straight", "\xEE\xA4\xA8"},
{"turn-left", "\xEE\xA4\x85"},
{"turn-right", "\xEE\xA4\x86"},
{"turn-sharp-left", "\xEE\xA4\x9B"},
{"turn-sharp-right", "\xEE\xA4\xA5"},
{"turn-slight-left", "\xEE\xA4\x87"},
{"turn-slight-right", "\xEE\xA4\x88"},
{"turn-straight", "\xEE\xA4\x84"},
{"updown", "\xEE\xA4\xA9"},
{"uturn", "\xEE\xA4\x89"},
}};
}; };
} }
} }

View File

@ -175,8 +175,9 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
"#444444 BLE MAC#\n" "#444444 BLE MAC#\n"
" %02x:%02x:%02x:%02x:%02x:%02x" " %02x:%02x:%02x:%02x:%02x:%02x"
"\n" "\n"
"#444444 Memory#\n" "#444444 LVGL Memory#\n"
" #444444 used# %d (%d%%)\n" " #444444 used# %d (%d%%)\n"
" #444444 max used# %d\n"
" #444444 frag# %d%%\n" " #444444 frag# %d%%\n"
" #444444 free# %d" " #444444 free# %d"
"\n" "\n"
@ -189,6 +190,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
bleAddr[0], bleAddr[0],
(int) mon.total_size - mon.free_size, (int) mon.total_size - mon.free_size,
mon.used_pct, mon.used_pct,
mon.max_used,
mon.frag_pct, mon.frag_pct,
(int) mon.free_biggest_size, (int) mon.free_biggest_size,
0); 0);