mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-20 23:27:39 +08:00
Demo: exit 1 on error exit 2 on Ctrl_C
This commit is contained in:

committed by
alfred gedeon

parent
e84fc19966
commit
b0e693e88b
@ -82,6 +82,17 @@ ifdef SANITIZE_LEAK
|
|||||||
LDFLAGS += -fsanitize=leak
|
LDFLAGS += -fsanitize=leak
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(info 'checking demo type')
|
||||||
|
ifeq ($(USER_DEMO),BLINKY_DEMO)
|
||||||
|
$(info 'blinky demo selected')
|
||||||
|
CPPFLAGS += -DUSER_DEMO=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(USER_DEMO),FULL_DEMO)
|
||||||
|
$(info 'full demo selected')
|
||||||
|
CPPFLAGS += -DUSER_DEMO=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
OBJ_FILES = $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.o)
|
OBJ_FILES = $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.o)
|
||||||
|
|
||||||
@ -97,7 +108,7 @@ ${BUILD_DIR}/${BIN} : ${OBJ_FILES}
|
|||||||
|
|
||||||
${BUILD_DIR}/%.o : %.c Makefile
|
${BUILD_DIR}/%.o : %.c Makefile
|
||||||
-mkdir -p $(@D)
|
-mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) ${INCLUDE_DIRS} -DUSER_DEMO= -MMD -c $< -o $@
|
$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -c $< -o $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
|
@ -65,17 +65,20 @@
|
|||||||
/* Local includes. */
|
/* Local includes. */
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
|
#define BLINKY_DEMO 0
|
||||||
|
#define FULL_DEMO 1
|
||||||
|
|
||||||
#ifdef BUILD_DIR
|
#ifdef BUILD_DIR
|
||||||
#define BUILD BUILD_DIR
|
#define BUILD BUILD_DIR
|
||||||
#else
|
#else
|
||||||
#define BUILD "./"
|
#define BUILD "./"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Demo type is passed as an argument */
|
||||||
#ifdef USER_DEMO
|
#ifdef USER_DEMO
|
||||||
#define mainSELECTED_APPLICATION USER_DEMO
|
#define mainSELECTED_APPLICATION USER_DEMO
|
||||||
#else
|
#else /* Default Setting */
|
||||||
#define BLINKY_DEMO 0
|
#define mainSELECTED_APPLICATION BLINKY_DEMO
|
||||||
#define FULL_DEMO 1
|
|
||||||
#define mainSELECTED_APPLICATION FULL_DEMO
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This demo uses heap_3.c (the libc provided malloc() and free()). */
|
/* This demo uses heap_3.c (the libc provided malloc() and free()). */
|
||||||
@ -413,10 +416,13 @@ void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
|||||||
void handle_sigint( int signal )
|
void handle_sigint( int signal )
|
||||||
{
|
{
|
||||||
int xReturn;
|
int xReturn;
|
||||||
|
|
||||||
xReturn = chdir( BUILD ); /* changing dir to place gmon.out inside build */
|
xReturn = chdir( BUILD ); /* changing dir to place gmon.out inside build */
|
||||||
|
|
||||||
if( xReturn == -1 )
|
if( xReturn == -1 )
|
||||||
{
|
{
|
||||||
printf( "chdir into %s error is %d\n", BUILD, errno );
|
printf( "chdir into %s error is %d\n", BUILD, errno );
|
||||||
}
|
}
|
||||||
|
|
||||||
exit( 2 );
|
exit( 2 );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user