M Target_RT1051.cmake => Target_RT1051.cmake +6 -0
@@ 57,6 57,12 @@ add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-literal-suffix>
)
+set(TARGET_SOURCES
+
+ ${CMAKE_CURRENT_LIST_DIR}/module-os/board/rt1051/_exit.c
+ CACHE INTERNAL ""
+)
+
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_PATH}/${TOOLCHAIN_PREFIX})
# search for programs in the build host directories
M module-os/board/rt1051/CMakeLists.txt => module-os/board/rt1051/CMakeLists.txt +0 -1
@@ 1,7 1,6 @@
target_sources(
module-os
PRIVATE
- _exit.c
fsl_tickless_gpt.c
fsl_tickless_systick.c
fsl_runtimestat_gpt.c
M module-os/board/rt1051/_exit.c => module-os/board/rt1051/_exit.c +8 -38
@@ 35,47 35,17 @@
#include <log/log.hpp>
#include <task.h>
#include <macros.h>
-// ----------------------------------------------------------------------------
-
-// Forward declaration
-
-void _exit(int code);
-
-// ----------------------------------------------------------------------------
-
-void __reset_hardware(void)
-{
- // Let watchdog reset system
- while (1)
- ;
-}
-
-// On Release, call the hardware reset procedure.
-// On Debug we just enter an infinite loop, to be used as landmark when halting
-// the debugger.
-//
-// It can be redefined in the application, if more functionality
-// is required.
-void __attribute__((weak)) _exit(int code)
+void __attribute__((noreturn, used)) _exit(int code)
{
- LOG_FATAL("_exit %d", code);
+ LOG_INFO("_exit %d", code);
haltIfDebugging();
vTaskEndScheduler();
-#ifdef DEBUG
- while (1) {};
+ NVIC_SystemReset();
+ // waiting for system reset
+ while (1) {
+#ifndef DEBUG
+ __asm volatile("wfi\n");
#endif
+ };
}
-
-// ----------------------------------------------------------------------------
-
-#if 0
-void
-__attribute__((weak))
-abort(void)
-{
-
-}
-#endif
-
-// ----------------------------------------------------------------------------
M products/PurePhone/CMakeLists.txt => products/PurePhone/CMakeLists.txt +1 -0
@@ 23,6 23,7 @@ target_compile_options(PurePhone
target_sources(PurePhone
PRIVATE
+ ${TARGET_SOURCES}
PurePhoneMain.cpp
PlatformFactory.cpp
EinkSentinelPure.cpp