Skip to content

Commit

Permalink
Fix some reported bugs
Browse files Browse the repository at this point in the history
Fixes #5 for explorer_board and aws_iot apps.  IP address is now printed
in IPv4 dotted decimal notation, instead of only hex.

Fixes #2 by printing error messages when a camera setup step fails,
instead of asserting.

Adds workaround to allow storing person_detection model in sram.
  • Loading branch information
xmos-jmccarthy committed Oct 2, 2020
1 parent 9f70990 commit fbf4338
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 103 deletions.
8 changes: 7 additions & 1 deletion examples/freertos/explorer_board/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(APP_COMPILER_FLAGS
"-DMQTT_TASK=1"
"-Wxcore-fptrgroup"
"-DDEBUG_PRINT_ENABLE=1"
"-DSL_WFX_DEBUG_MASK=(SL_WFX_DEBUG_ERROR|SL_WFX_DEBUG_INIT)"
"-DDEBUG_PRINT_ENABLE_LIB_SOC_SW_WIFI=1"
"-DSL_WFX_DEFAULT_REQUEST_TIMEOUT_MS=500"
"-DMBEDTLS_CONFIG_FILE=\"mbedtls_config.h\""
#"-DMBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\"" # User config applied after default XMOS config
Expand Down Expand Up @@ -82,6 +82,12 @@ set(APP_DEPENDENT_MODULES
"FreeRTOS-Plus-TCP(>=10.2.1)"
)

if(${VERBOSE})
list(APPEND APP_COMPILER_FLAGS "-DSL_WFX_DEBUG_MASK=(SL_WFX_DEBUG_ERROR|SL_WFX_DEBUG_INIT)")
else()
list(APPEND APP_COMPILER_FLAGS "-DSL_WFX_DEBUG_MASK=(SL_WFX_DEBUG_ERROR)")
endif()

set(USE_FREERTOS_SMP True)

## Add lib_soc devices
Expand Down
2 changes: 1 addition & 1 deletion examples/freertos/explorer_board/src/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ out the debugging messages. */
FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
then FreeRTOS_printf should be set to the function used to print out the
messages. */
#define ipconfigHAS_PRINTF 1
#define ipconfigHAS_PRINTF 0
#if( ipconfigHAS_PRINTF == 1 )
#define FreeRTOS_printf(X) vLoggingPrintf X
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ static void mem_analysis( void *arg )
{
for( ;; )
{
debug_printf("Minimum heap free: %d\n", xPortGetMinimumEverFreeHeapSize());
debug_printf("Current heap free: %d\n", xPortGetFreeHeapSize());
debug_printf("\tMinimum heap free: %d\n", xPortGetMinimumEverFreeHeapSize());
debug_printf("\tCurrent heap free: %d\n", xPortGetFreeHeapSize());

vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
Expand All @@ -42,7 +42,7 @@ static void mem_analysis( void *arg )
if( task != NULL )
{
free_stack_words = uxTaskGetStackHighWaterMark( task );
debug_printf("%s free stack words: %d\n", task_name, free_stack_words);
debug_printf("\t%s free stack words: %d\n", task_name, free_stack_words);
}
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
Expand Down
8 changes: 7 additions & 1 deletion examples/freertos/iot_aws/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(APP_COMPILER_FLAGS
"-DMQTT_TASK=1"
"-Wxcore-fptrgroup"
"-DDEBUG_PRINT_ENABLE=1"
"-DSL_WFX_DEBUG_MASK=(SL_WFX_DEBUG_ERROR|SL_WFX_DEBUG_INIT)"
"-DDEBUG_PRINT_ENABLE_LIB_SOC_SW_WIFI=1"
"-DSL_WFX_DEFAULT_REQUEST_TIMEOUT_MS=500"
"-DMBEDTLS_CONFIG_FILE=\"mbedtls_config.h\""
#"-DMBEDTLS_USER_CONFIG_FILE=\"mbedtls_user_config.h\"" # User config applied after default XMOS config
Expand Down Expand Up @@ -56,6 +56,12 @@ set(APP_DEPENDENT_MODULES
"FreeRTOS-Plus-TCP(>=10.2.1)"
)

if(${VERBOSE})
list(APPEND APP_COMPILER_FLAGS "-DSL_WFX_DEBUG_MASK=(SL_WFX_DEBUG_ERROR|SL_WFX_DEBUG_INIT)")
else()
list(APPEND APP_COMPILER_FLAGS "-DSL_WFX_DEBUG_MASK=(SL_WFX_DEBUG_ERROR)")
endif()

set(USE_FREERTOS_SMP True)

## Add lib_soc devices
Expand Down
4 changes: 2 additions & 2 deletions examples/freertos/iot_aws/src/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extern void vLoggingPrintf( const char *pcFormatString, ... );
/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
1 then FreeRTOS_debug_printf should be defined to the function used to print
out the debugging messages. */
#define ipconfigHAS_DEBUG_PRINTF 1
#define ipconfigHAS_DEBUG_PRINTF 0
#if( ipconfigHAS_DEBUG_PRINTF == 1 )
#define FreeRTOS_debug_printf(X) vLoggingPrintf X
#endif
Expand All @@ -92,7 +92,7 @@ out the debugging messages. */
FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
then FreeRTOS_printf should be set to the function used to print out the
messages. */
#define ipconfigHAS_PRINTF 1
#define ipconfigHAS_PRINTF 0
#if( ipconfigHAS_PRINTF == 1 )
#define FreeRTOS_printf(X) vLoggingPrintf X
#endif
Expand Down
6 changes: 3 additions & 3 deletions examples/freertos/iot_aws/src/mem_analysis/mem_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ static void mem_analysis( void *arg )
{
for( ;; )
{
debug_printf("Minimum heap free: %d\n", xPortGetMinimumEverFreeHeapSize());
debug_printf("Current heap free: %d\n", xPortGetFreeHeapSize());
debug_printf("\tMinimum heap free: %d\n", xPortGetMinimumEverFreeHeapSize());
debug_printf("\tCurrent heap free: %d\n", xPortGetFreeHeapSize());

vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
Expand All @@ -42,7 +42,7 @@ static void mem_analysis( void *arg )
if( task != NULL )
{
free_stack_words = uxTaskGetStackHighWaterMark( task );
debug_printf("%s free stack words: %d\n", task_name, free_stack_words);
debug_printf("\t%s free stack words: %d\n", task_name, free_stack_words);
}
vTaskDelay( pdMS_TO_TICKS( 1000 ) );
}
Expand Down
5 changes: 4 additions & 1 deletion examples/freertos/person_detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ set(APP_COMPILER_FLAGS
"-DDEBUG_PRINT_ENABLE=1"
"-Wno-unknown-pragmas"
"-DTF_LITE_STATIC_MEMORY"
"-DUSE_EXTMEM"
"-D_XCORE_HAS_SWMEM"
"-DTF_LITE_STRIP_ERROR_STRINGS"
"-DNDEBUG"
Expand Down Expand Up @@ -61,6 +60,10 @@ set(APP_DEPENDENT_MODULES
"inference_engine(>=0.0.0)"
)

if(${USE_EXTMEM})
add_definitions(-DUSE_EXTMEM)
endif()

## Set any additional flags only for C++
set(CMAKE_CXX_FLAGS "-std=c++11")

Expand Down
11 changes: 9 additions & 2 deletions examples/freertos/person_detection/app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ void vApplicationDaemonTaskStartupHook( void )
{
QueueHandle_t qcam2ai = xQueueCreate( 1, sizeof( uint8_t* ) );

create_spi_camera_to_queue( appconfSPI_CAMERA_TASK_PRIORITY, qcam2ai );
create_queue_to_ai( appconfQUEUE_TO_AI_TASK_PRIORITY, qcam2ai );
if( create_spi_camera_to_queue( appconfSPI_CAMERA_TASK_PRIORITY, qcam2ai )
== pdTRUE )
{
create_queue_to_ai( appconfQUEUE_TO_AI_TASK_PRIORITY, qcam2ai );
}
else
{
debug_printf("Camera setup failed...\n");
}
}

void vApplicationMallocFailedHook(void)
Expand Down
Loading

0 comments on commit fbf4338

Please sign in to comment.