mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 05:34:32 +02:00
Merge branch 'bugfix/example_warning_cleanup' into 'master'
Example cleanup, raise warning level See merge request !209
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
#include <bootloader_flash.h>
|
#include <bootloader_flash.h>
|
||||||
|
|
||||||
const static char *TAG = "esp_image";
|
static const char *TAG = "esp_image";
|
||||||
|
|
||||||
#define SIXTEEN_MB 0x1000000
|
#define SIXTEEN_MB 0x1000000
|
||||||
#define ESP_ROM_CHECKSUM_INITIAL 0xEF
|
#define ESP_ROM_CHECKSUM_INITIAL 0xEF
|
||||||
|
@@ -45,10 +45,13 @@ esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
|
|||||||
sha_context sha;
|
sha_context sha;
|
||||||
uint8_t digest[32];
|
uint8_t digest[32];
|
||||||
ptrdiff_t keylen;
|
ptrdiff_t keylen;
|
||||||
const uint8_t *data, *digest_data;
|
const uint8_t *data;
|
||||||
uint32_t digest_len;
|
|
||||||
const signature_block_t *sigblock;
|
const signature_block_t *sigblock;
|
||||||
bool is_valid;
|
bool is_valid;
|
||||||
|
#ifdef BOOTLOADER_BUILD
|
||||||
|
const uint8_t *digest_data;
|
||||||
|
uint32_t digest_len;
|
||||||
|
#endif
|
||||||
|
|
||||||
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
|
ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length);
|
||||||
|
|
||||||
|
@@ -108,31 +108,20 @@ add_failure(SRunner *runner, int verbosity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void run_test(SRunner *runner, int verbosity, TCase *tc, int i)
|
||||||
srunner_run_all(SRunner *runner, int verbosity)
|
|
||||||
{
|
{
|
||||||
Suite *suite;
|
|
||||||
TCase *tc;
|
|
||||||
assert(runner != NULL);
|
|
||||||
suite = runner->suite;
|
|
||||||
tc = suite->tests;
|
|
||||||
while (tc != NULL) {
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < tc->ntests; ++i) {
|
|
||||||
runner->nchecks++;
|
|
||||||
|
|
||||||
if (tc->setup != NULL) {
|
if (tc->setup != NULL) {
|
||||||
/* setup */
|
/* setup */
|
||||||
if (setjmp(env)) {
|
if (setjmp(env)) {
|
||||||
add_failure(runner, verbosity);
|
add_failure(runner, verbosity);
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
tc->setup();
|
tc->setup();
|
||||||
}
|
}
|
||||||
/* test */
|
/* test */
|
||||||
if (setjmp(env)) {
|
if (setjmp(env)) {
|
||||||
add_failure(runner, verbosity);
|
add_failure(runner, verbosity);
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
(tc->tests[i])();
|
(tc->tests[i])();
|
||||||
|
|
||||||
@@ -140,13 +129,25 @@ srunner_run_all(SRunner *runner, int verbosity)
|
|||||||
if (tc->teardown != NULL) {
|
if (tc->teardown != NULL) {
|
||||||
if (setjmp(env)) {
|
if (setjmp(env)) {
|
||||||
add_failure(runner, verbosity);
|
add_failure(runner, verbosity);
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
tc->teardown();
|
tc->teardown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
srunner_run_all(SRunner *runner, int verbosity)
|
||||||
|
{
|
||||||
|
assert(runner != NULL);
|
||||||
|
assert(runner->suite != NULL);
|
||||||
|
TCase *tc = runner->suite->tests;
|
||||||
|
while (tc != NULL) {
|
||||||
|
for (int i = 0; i < tc->ntests; ++i) {
|
||||||
|
runner->nchecks++;
|
||||||
|
run_test(runner, verbosity, tc, i);
|
||||||
tc = tc->next_tcase;
|
tc = tc->next_tcase;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (verbosity) {
|
if (verbosity) {
|
||||||
int passed = runner->nchecks - runner->nfailures;
|
int passed = runner->nchecks - runner->nfailures;
|
||||||
double percentage = ((double) passed) / runner->nchecks;
|
double percentage = ((double) passed) / runner->nchecks;
|
||||||
|
@@ -471,7 +471,8 @@ BaseType_t xRingbufferSend(RingbufHandle_t ringbuf, void *data, size_t dataSize,
|
|||||||
ringbuf_t *rb=(ringbuf_t *)ringbuf;
|
ringbuf_t *rb=(ringbuf_t *)ringbuf;
|
||||||
size_t needed_size=dataSize+sizeof(buf_entry_hdr_t);
|
size_t needed_size=dataSize+sizeof(buf_entry_hdr_t);
|
||||||
BaseType_t done=pdFALSE;
|
BaseType_t done=pdFALSE;
|
||||||
portTickType ticks_end=xTaskGetTickCount() + ticks_to_wait;
|
TickType_t ticks_end = xTaskGetTickCount() + ticks_to_wait;
|
||||||
|
TickType_t ticks_remaining = ticks_to_wait;
|
||||||
|
|
||||||
configASSERT(rb);
|
configASSERT(rb);
|
||||||
|
|
||||||
@@ -486,16 +487,25 @@ BaseType_t xRingbufferSend(RingbufHandle_t ringbuf, void *data, size_t dataSize,
|
|||||||
if (ringbufferFreeMem(rb) < needed_size) {
|
if (ringbufferFreeMem(rb) < needed_size) {
|
||||||
//Data does not fit yet. Wait until the free_space_sem is given, then re-evaluate.
|
//Data does not fit yet. Wait until the free_space_sem is given, then re-evaluate.
|
||||||
|
|
||||||
BaseType_t r = xSemaphoreTake(rb->free_space_sem, ticks_to_wait);
|
BaseType_t r = xSemaphoreTake(rb->free_space_sem, ticks_remaining);
|
||||||
if (r == pdFALSE) {
|
if (r == pdFALSE) {
|
||||||
//Timeout.
|
//Timeout.
|
||||||
return pdFALSE;
|
return pdFALSE;
|
||||||
}
|
}
|
||||||
//Adjust ticks_to_wait; we may have waited less than that and in the case the free memory still is not enough,
|
//Adjust ticks_remaining; we may have waited less than that and in the case the free memory still is not enough,
|
||||||
//we will need to wait some more.
|
//we will need to wait some more.
|
||||||
ticks_to_wait = ticks_end - xTaskGetTickCount();
|
if (ticks_to_wait != portMAX_DELAY) {
|
||||||
|
ticks_remaining = ticks_end - xTaskGetTickCount();
|
||||||
}
|
}
|
||||||
} while (ringbufferFreeMem(rb) < needed_size && ticks_to_wait>=0);
|
|
||||||
|
// ticks_remaining will always be less than or equal to the original ticks_to_wait,
|
||||||
|
// unless the timeout is reached - in which case it unsigned underflows to a much
|
||||||
|
// higher value.
|
||||||
|
//
|
||||||
|
// (Check is written this non-intuitive way to allow for the case where xTaskGetTickCount()
|
||||||
|
// has overflowed but the ticks_end value has not overflowed.)
|
||||||
|
}
|
||||||
|
} while (ringbufferFreeMem(rb) < needed_size && ticks_remaining > 0 && ticks_remaining <= ticks_to_wait);
|
||||||
|
|
||||||
//Lock the mux in order to make sure no one else is messing with the ringbuffer and do the copy.
|
//Lock the mux in order to make sure no one else is messing with the ringbuffer and do the copy.
|
||||||
portENTER_CRITICAL(&rb->mux);
|
portENTER_CRITICAL(&rb->mux);
|
||||||
|
@@ -2704,7 +2704,7 @@ void vTaskSwitchContext( void )
|
|||||||
taskENTER_CRITICAL_ISR(&xTaskQueueMutex);
|
taskENTER_CRITICAL_ISR(&xTaskQueueMutex);
|
||||||
|
|
||||||
unsigned portBASE_TYPE foundNonExecutingWaiter = pdFALSE, ableToSchedule = pdFALSE, resetListHead;
|
unsigned portBASE_TYPE foundNonExecutingWaiter = pdFALSE, ableToSchedule = pdFALSE, resetListHead;
|
||||||
unsigned portBASE_TYPE uxDynamicTopReady = uxTopReadyPriority;
|
portBASE_TYPE uxDynamicTopReady = uxTopReadyPriority;
|
||||||
unsigned portBASE_TYPE holdTop=pdFALSE;
|
unsigned portBASE_TYPE holdTop=pdFALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2717,8 +2717,6 @@ void vTaskSwitchContext( void )
|
|||||||
|
|
||||||
while ( ableToSchedule == pdFALSE && uxDynamicTopReady >= 0 )
|
while ( ableToSchedule == pdFALSE && uxDynamicTopReady >= 0 )
|
||||||
{
|
{
|
||||||
configASSERT( uxTopReadyPriority>=0 );
|
|
||||||
configASSERT( uxDynamicTopReady>=0 );
|
|
||||||
resetListHead = pdFALSE;
|
resetListHead = pdFALSE;
|
||||||
// Nothing to do for empty lists
|
// Nothing to do for empty lists
|
||||||
if (!listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxDynamicTopReady ] ) )) {
|
if (!listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxDynamicTopReady ] ) )) {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#
|
#
|
||||||
# Main Makefile. This is basically the same as a component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
@@ -1,2 +1,5 @@
|
|||||||
|
#
|
||||||
|
# "main" pseudo-component makefile.
|
||||||
|
#
|
||||||
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
|
||||||
include $(IDF_PATH)/make/component_common.mk
|
|
||||||
|
@@ -1,2 +1,5 @@
|
|||||||
|
#
|
||||||
|
# "main" pseudo-component makefile.
|
||||||
|
#
|
||||||
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
|
||||||
include $(IDF_PATH)/make/component_common.mk
|
|
||||||
|
@@ -20,8 +20,13 @@ for example in ${IDF_PATH}/examples/*; do
|
|||||||
mkdir ${EXAMPLE_NUM}
|
mkdir ${EXAMPLE_NUM}
|
||||||
cp -r ${example} ${EXAMPLE_NUM}
|
cp -r ${example} ${EXAMPLE_NUM}
|
||||||
pushd ${EXAMPLE_NUM}/`basename ${example}`
|
pushd ${EXAMPLE_NUM}/`basename ${example}`
|
||||||
|
|
||||||
|
# be stricter in the CI build than the default IDF settings
|
||||||
|
export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
|
||||||
|
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||||
|
|
||||||
# build non-verbose first, only build verbose if there's an error
|
# build non-verbose first, only build verbose if there's an error
|
||||||
make defconfig all || (RESULT=$?; make V=1)
|
(make clean defconfig && make all ) || (RESULT=$?; make V=1)
|
||||||
popd
|
popd
|
||||||
EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
|
EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
|
||||||
done
|
done
|
||||||
|
@@ -158,14 +158,16 @@ LDFLAGS ?= -nostdlib \
|
|||||||
|
|
||||||
# CPPFLAGS used by C preprocessor
|
# CPPFLAGS used by C preprocessor
|
||||||
# If any flags are defined in application Makefile, add them at the end.
|
# If any flags are defined in application Makefile, add them at the end.
|
||||||
CPPFLAGS := -DESP_PLATFORM $(CPPFLAGS)
|
CPPFLAGS := -DESP_PLATFORM $(CPPFLAGS) $(EXTRA_CPPFLAGS)
|
||||||
|
|
||||||
# Warnings-related flags relevant both for C and C++
|
# Warnings-related flags relevant both for C and C++
|
||||||
COMMON_WARNING_FLAGS = -Wall -Werror \
|
COMMON_WARNING_FLAGS = -Wall -Werror=all \
|
||||||
-Wno-error=unused-function \
|
-Wno-error=unused-function \
|
||||||
-Wno-error=unused-but-set-variable \
|
-Wno-error=unused-but-set-variable \
|
||||||
-Wno-error=unused-variable \
|
-Wno-error=unused-variable \
|
||||||
-Wno-error=deprecated-declarations
|
-Wno-error=deprecated-declarations \
|
||||||
|
-Wextra \
|
||||||
|
-Wno-unused-parameter -Wno-sign-compare
|
||||||
|
|
||||||
# Flags which control code generation and dependency generation, both for C and C++
|
# Flags which control code generation and dependency generation, both for C and C++
|
||||||
COMMON_FLAGS = \
|
COMMON_FLAGS = \
|
||||||
@@ -192,8 +194,9 @@ CFLAGS := $(strip \
|
|||||||
-std=gnu99 \
|
-std=gnu99 \
|
||||||
$(OPTIMIZATION_FLAGS) \
|
$(OPTIMIZATION_FLAGS) \
|
||||||
$(COMMON_FLAGS) \
|
$(COMMON_FLAGS) \
|
||||||
$(COMMON_WARNING_FLAGS) \
|
$(COMMON_WARNING_FLAGS) -Wno-old-style-declaration \
|
||||||
$(CFLAGS))
|
$(CFLAGS) \
|
||||||
|
$(EXTRA_CFLAGS))
|
||||||
|
|
||||||
# List of flags to pass to C++ compiler
|
# List of flags to pass to C++ compiler
|
||||||
# If any flags are defined in application Makefile, add them at the end.
|
# If any flags are defined in application Makefile, add them at the end.
|
||||||
@@ -204,7 +207,8 @@ CXXFLAGS := $(strip \
|
|||||||
$(OPTIMIZATION_FLAGS) \
|
$(OPTIMIZATION_FLAGS) \
|
||||||
$(COMMON_FLAGS) \
|
$(COMMON_FLAGS) \
|
||||||
$(COMMON_WARNING_FLAGS) \
|
$(COMMON_WARNING_FLAGS) \
|
||||||
$(CXXFLAGS))
|
$(CXXFLAGS) \
|
||||||
|
$(EXTRA_CXXFLAGS))
|
||||||
|
|
||||||
export CFLAGS CPPFLAGS CXXFLAGS
|
export CFLAGS CPPFLAGS CXXFLAGS
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user