mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 09:39:10 -04:00
Merge branch 'bugfix/o2_build_warnings' into 'master'
Fix -O2 build warnings Closes IDFGH-1945 and IDFGH-1946 See merge request espressif/esp-idf!6311
This commit is contained in:
commit
0f1923ab22
@ -467,13 +467,17 @@ static void can_intr_handler_tx(can_status_reg_t *status, int *alert_req)
|
|||||||
|
|
||||||
//Update TX message count
|
//Update TX message count
|
||||||
p_can_obj->tx_msg_count--;
|
p_can_obj->tx_msg_count--;
|
||||||
configASSERT(p_can_obj->tx_msg_count >= 0); //Sanity check
|
assert(p_can_obj->tx_msg_count >= 0); //Sanity check
|
||||||
|
|
||||||
//Check if there are more frames to transmit
|
//Check if there are more frames to transmit
|
||||||
if (p_can_obj->tx_msg_count > 0 && p_can_obj->tx_queue != NULL) {
|
if (p_can_obj->tx_msg_count > 0 && p_can_obj->tx_queue != NULL) {
|
||||||
can_frame_t frame;
|
can_frame_t frame;
|
||||||
configASSERT(xQueueReceiveFromISR(p_can_obj->tx_queue, &frame, NULL) == pdTRUE);
|
int res = xQueueReceiveFromISR(p_can_obj->tx_queue, &frame, NULL);
|
||||||
can_set_tx_buffer_and_transmit(&frame);
|
if (res == pdTRUE) {
|
||||||
|
can_set_tx_buffer_and_transmit(&frame);
|
||||||
|
} else {
|
||||||
|
assert(false && "failed to get a frame from TX queue");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//No more frames to transmit
|
//No more frames to transmit
|
||||||
CAN_RESET_FLAG(p_can_obj->control_flags, CTRL_FLAG_TX_BUFF_OCCUPIED);
|
CAN_RESET_FLAG(p_can_obj->control_flags, CTRL_FLAG_TX_BUFF_OCCUPIED);
|
||||||
@ -699,7 +703,8 @@ esp_err_t can_driver_install(const can_general_config_t *g_config, const can_tim
|
|||||||
}
|
}
|
||||||
periph_module_reset(PERIPH_CAN_MODULE);
|
periph_module_reset(PERIPH_CAN_MODULE);
|
||||||
periph_module_enable(PERIPH_CAN_MODULE); //Enable APB CLK to CAN peripheral
|
periph_module_enable(PERIPH_CAN_MODULE); //Enable APB CLK to CAN peripheral
|
||||||
configASSERT(can_enter_reset_mode() == ESP_OK); //Must enter reset mode to write to config registers
|
esp_err_t err = can_exit_reset_mode(); //Must enter reset mode to write to config registers
|
||||||
|
assert(err == ESP_OK);
|
||||||
can_config_pelican(); //Use PeliCAN addresses
|
can_config_pelican(); //Use PeliCAN addresses
|
||||||
/* Note: REC is allowed to increase even in reset mode. Listen only mode
|
/* Note: REC is allowed to increase even in reset mode. Listen only mode
|
||||||
will freeze REC. The desired mode will be set when can_start() is called. */
|
will freeze REC. The desired mode will be set when can_start() is called. */
|
||||||
@ -760,7 +765,8 @@ esp_err_t can_driver_uninstall(void)
|
|||||||
//Check state
|
//Check state
|
||||||
CAN_CHECK_FROM_CRIT(p_can_obj != NULL, ESP_ERR_INVALID_STATE);
|
CAN_CHECK_FROM_CRIT(p_can_obj != NULL, ESP_ERR_INVALID_STATE);
|
||||||
CAN_CHECK_FROM_CRIT(p_can_obj->control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF), ESP_ERR_INVALID_STATE);
|
CAN_CHECK_FROM_CRIT(p_can_obj->control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF), ESP_ERR_INVALID_STATE);
|
||||||
configASSERT(can_enter_reset_mode() == ESP_OK); //Enter reset mode to stop any CAN bus activity
|
esp_err_t err = can_exit_reset_mode(); //Enter reset mode to stop any CAN bus activity
|
||||||
|
assert(err == ESP_OK);
|
||||||
//Clear registers by reading
|
//Clear registers by reading
|
||||||
(void) can_get_interrupt_reason();
|
(void) can_get_interrupt_reason();
|
||||||
(void) can_get_arbitration_lost_capture();
|
(void) can_get_arbitration_lost_capture();
|
||||||
@ -798,7 +804,8 @@ esp_err_t can_start(void)
|
|||||||
//Reset RX queue, and RX message count
|
//Reset RX queue, and RX message count
|
||||||
xQueueReset(p_can_obj->rx_queue);
|
xQueueReset(p_can_obj->rx_queue);
|
||||||
p_can_obj->rx_msg_count = 0;
|
p_can_obj->rx_msg_count = 0;
|
||||||
configASSERT(can_enter_reset_mode() == ESP_OK); //Should already be in bus-off mode, set again to make sure
|
esp_err_t err = can_exit_reset_mode(); //Should already be in bus-off mode, set again to make sure
|
||||||
|
assert(err == ESP_OK);
|
||||||
|
|
||||||
//Currently in listen only mode, need to set to mode specified by configuration
|
//Currently in listen only mode, need to set to mode specified by configuration
|
||||||
can_mode_t mode;
|
can_mode_t mode;
|
||||||
@ -811,7 +818,8 @@ esp_err_t can_start(void)
|
|||||||
}
|
}
|
||||||
can_config_mode(mode); //Set mode
|
can_config_mode(mode); //Set mode
|
||||||
(void) can_get_interrupt_reason(); //Clear interrupt register
|
(void) can_get_interrupt_reason(); //Clear interrupt register
|
||||||
configASSERT(can_exit_reset_mode() == ESP_OK);
|
err = can_exit_reset_mode();
|
||||||
|
assert(err == ESP_OK);
|
||||||
|
|
||||||
CAN_RESET_FLAG(p_can_obj->control_flags, CTRL_FLAG_STOPPED);
|
CAN_RESET_FLAG(p_can_obj->control_flags, CTRL_FLAG_STOPPED);
|
||||||
CAN_EXIT_CRITICAL();
|
CAN_EXIT_CRITICAL();
|
||||||
@ -826,7 +834,8 @@ esp_err_t can_stop(void)
|
|||||||
CAN_CHECK_FROM_CRIT(!(p_can_obj->control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF)), ESP_ERR_INVALID_STATE);
|
CAN_CHECK_FROM_CRIT(!(p_can_obj->control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF)), ESP_ERR_INVALID_STATE);
|
||||||
|
|
||||||
//Clear interrupts and reset flags
|
//Clear interrupts and reset flags
|
||||||
configASSERT(can_enter_reset_mode() == ESP_OK);
|
esp_err_t err = can_exit_reset_mode();
|
||||||
|
assert(err == ESP_OK);
|
||||||
(void) can_get_interrupt_reason(); //Read interrupt register to clear interrupts
|
(void) can_get_interrupt_reason(); //Read interrupt register to clear interrupts
|
||||||
can_config_mode(CAN_MODE_LISTEN_ONLY); //Set to listen only mode to freeze REC
|
can_config_mode(CAN_MODE_LISTEN_ONLY); //Set to listen only mode to freeze REC
|
||||||
CAN_RESET_FLAG(p_can_obj->control_flags, CTRL_FLAG_TX_BUFF_OCCUPIED);
|
CAN_RESET_FLAG(p_can_obj->control_flags, CTRL_FLAG_TX_BUFF_OCCUPIED);
|
||||||
@ -877,11 +886,13 @@ esp_err_t can_transmit(const can_message_t *message, TickType_t ticks_to_wait)
|
|||||||
CAN_ENTER_CRITICAL();
|
CAN_ENTER_CRITICAL();
|
||||||
if (p_can_obj->control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF)) {
|
if (p_can_obj->control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF)) {
|
||||||
//TX queue was reset (due to stop/bus_off), remove copied frame from queue to prevent transmission
|
//TX queue was reset (due to stop/bus_off), remove copied frame from queue to prevent transmission
|
||||||
configASSERT(xQueueReceive(p_can_obj->tx_queue, &tx_frame, 0) == pdTRUE);
|
int res = xQueueReceive(p_can_obj->tx_queue, &tx_frame, 0);
|
||||||
|
assert(res == pdTRUE);
|
||||||
ret = ESP_ERR_INVALID_STATE;
|
ret = ESP_ERR_INVALID_STATE;
|
||||||
} else if ((p_can_obj->tx_msg_count == 0) && !(p_can_obj->control_flags & CTRL_FLAG_TX_BUFF_OCCUPIED)) {
|
} else if ((p_can_obj->tx_msg_count == 0) && !(p_can_obj->control_flags & CTRL_FLAG_TX_BUFF_OCCUPIED)) {
|
||||||
//TX buffer was freed during copy, manually trigger transmission
|
//TX buffer was freed during copy, manually trigger transmission
|
||||||
configASSERT(xQueueReceive(p_can_obj->tx_queue, &tx_frame, 0) == pdTRUE);
|
int res = xQueueReceive(p_can_obj->tx_queue, &tx_frame, 0);
|
||||||
|
assert(res == pdTRUE);
|
||||||
can_set_tx_buffer_and_transmit(&tx_frame);
|
can_set_tx_buffer_and_transmit(&tx_frame);
|
||||||
p_can_obj->tx_msg_count++;
|
p_can_obj->tx_msg_count++;
|
||||||
CAN_SET_FLAG(p_can_obj->control_flags, CTRL_FLAG_TX_BUFF_OCCUPIED);
|
CAN_SET_FLAG(p_can_obj->control_flags, CTRL_FLAG_TX_BUFF_OCCUPIED);
|
||||||
@ -972,7 +983,8 @@ esp_err_t can_initiate_recovery(void)
|
|||||||
CAN_SET_FLAG(p_can_obj->control_flags, CTRL_FLAG_RECOVERING);
|
CAN_SET_FLAG(p_can_obj->control_flags, CTRL_FLAG_RECOVERING);
|
||||||
|
|
||||||
//Trigger start of recovery process
|
//Trigger start of recovery process
|
||||||
configASSERT(can_exit_reset_mode() == ESP_OK);
|
esp_err_t err = can_exit_reset_mode();
|
||||||
|
assert(err == ESP_OK);
|
||||||
CAN_EXIT_CRITICAL();
|
CAN_EXIT_CRITICAL();
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
@ -10,3 +10,4 @@ idf_component_register(SRCS "esp_spiffs.c"
|
|||||||
REQUIRES spi_flash
|
REQUIRES spi_flash
|
||||||
PRIV_REQUIRES bootloader_support)
|
PRIV_REQUIRES bootloader_support)
|
||||||
|
|
||||||
|
set_source_files_properties(spiffs/src/spiffs_nucleus.c PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation)
|
@ -22,6 +22,17 @@
|
|||||||
- $BOT_LABEL_UNIT_TEST
|
- $BOT_LABEL_UNIT_TEST
|
||||||
- $BOT_LABEL_REGULAR_TEST
|
- $BOT_LABEL_REGULAR_TEST
|
||||||
|
|
||||||
|
|
||||||
|
.build_with_make_and_cmake: &build_with_make_and_cmake |
|
||||||
|
echo -e "section_end:"`date +%s`":build_script\r\e[0Ksection_start:"`date +%s`":build_make\r\e[0KBuild with Make"
|
||||||
|
make defconfig
|
||||||
|
make all
|
||||||
|
make clean
|
||||||
|
echo -e "section_end:"`date +%s`":build_make\r\e[0Ksection_start:"`date +%s`":build_cmake\r\e[0KBuild with CMake"
|
||||||
|
rm -rf build sdkconfig
|
||||||
|
idf.py build
|
||||||
|
echo -e "section_end:"`date +%s`":build_cmake\r\e[0Ksection_start:"`date +%s`":build_script\r\e[0K"
|
||||||
|
|
||||||
build_template_app:
|
build_template_app:
|
||||||
stage: build
|
stage: build
|
||||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||||
@ -45,43 +56,37 @@ build_template_app:
|
|||||||
- export PATH="$IDF_PATH/tools:$PATH"
|
- export PATH="$IDF_PATH/tools:$PATH"
|
||||||
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
|
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
|
||||||
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
|
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
|
||||||
|
|
||||||
# CONFIG_COMPILER_OPTIMIZATION_DEFAULT with flag -Og
|
|
||||||
- echo "CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y" >> sdkconfig
|
|
||||||
- make defconfig
|
|
||||||
- make all V=1
|
|
||||||
- make clean
|
|
||||||
|
|
||||||
# CONFIG_COMPILER_OPTIMIZATION_SIZE with flag -Os
|
# CONFIG_COMPILER_OPTIMIZATION_DEFAULT with flag -Og
|
||||||
- echo "CONFIG_COMPILER_OPTIMIZATION_SIZE=y" >> sdkconfig
|
- echo "CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y" > sdkconfig.defaults
|
||||||
- make defconfig
|
- *build_with_make_and_cmake
|
||||||
- make all V=1
|
|
||||||
- make clean
|
|
||||||
|
|
||||||
# CONFIG_COMPILER_OPTIMIZATION_PERF with flag -O2
|
|
||||||
- echo "CONFIG_COMPILER_OPTIMIZATION_PERF=y" >> sdkconfig
|
|
||||||
- make defconfig
|
|
||||||
- make all V=1
|
|
||||||
- make clean
|
|
||||||
|
|
||||||
# CONFIG_COMPILER_OPTIMIZATION_NONE with flag -O0
|
# CONFIG_COMPILER_OPTIMIZATION_NONE with flag -O0
|
||||||
- echo "CONFIG_COMPILER_OPTIMIZATION_NONE=y" >> sdkconfig
|
- echo "CONFIG_COMPILER_OPTIMIZATION_NONE=y" > sdkconfig.defaults
|
||||||
- make defconfig
|
- *build_with_make_and_cmake
|
||||||
- make all V=1
|
|
||||||
- make clean
|
# CONFIG_COMPILER_OPTIMIZATION_SIZE with flag -Os
|
||||||
|
- echo "CONFIG_COMPILER_OPTIMIZATION_SIZE=y" > sdkconfig.defaults
|
||||||
|
- *build_with_make_and_cmake
|
||||||
|
|
||||||
|
# CONFIG_COMPILER_OPTIMIZATION_PERF with flag -O2
|
||||||
|
- echo "CONFIG_COMPILER_OPTIMIZATION_PERF=y" > sdkconfig.defaults
|
||||||
|
- *build_with_make_and_cmake
|
||||||
|
|
||||||
|
# Same as above, but also disable assertions.
|
||||||
|
- echo "CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y" >> sdkconfig.defaults
|
||||||
|
# Don't error out on -Wunused, when assertions are disabled
|
||||||
|
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS/-Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function/}
|
||||||
|
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS/-Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function/}
|
||||||
|
- *build_with_make_and_cmake
|
||||||
|
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
|
||||||
|
- export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS}
|
||||||
|
|
||||||
# Check if there are any stray printf/ets_printf references in WiFi libs
|
# Check if there are any stray printf/ets_printf references in WiFi libs
|
||||||
- pushd ../components/esp_wifi/lib_esp32
|
- pushd ../components/esp_wifi/lib_esp32
|
||||||
- test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
|
- test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
|
||||||
- test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
|
- test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0
|
||||||
- popd
|
- popd
|
||||||
# Repeat the build using CMake
|
|
||||||
- rm -rf build sdkconfig
|
|
||||||
# Debug build
|
|
||||||
- idf.py build
|
|
||||||
# Release build
|
|
||||||
- sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
|
|
||||||
- idf.py build
|
|
||||||
|
|
||||||
build_ssc:
|
build_ssc:
|
||||||
extends: .build_template
|
extends: .build_template
|
||||||
|
Loading…
x
Reference in New Issue
Block a user