From f0b6256490b20e00e3d252b92b3775a4caaa1295 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Wed, 28 Jun 2017 11:40:54 +0800 Subject: [PATCH 1/3] build: Fix test for the first time 'make clean' and error handling in build_examples Now the tests do not pass Before we had incorrect code of the error code checking in build_examples.sh for that case and did nothing in test_build_system.sh. --- tools/ci/build_examples.sh | 10 +++++++--- tools/ci/test_build_system.sh | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index 04a1ebf82..c87c141a7 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -50,6 +50,7 @@ die() { export BATCH_BUILD=1 export V=0 # only build verbose if there's an error +shopt -s lastpipe # Workaround for Bash to use variables in loops (http://mywiki.wooledge.org/BashFAQ/024) RESULT=0 FAILED_EXAMPLES="" @@ -113,9 +114,12 @@ build_example () { # build non-verbose first local BUILDLOG=$(mktemp -t examplebuild.XXXX.log) ( - make clean defconfig - make all 2>&1 | tee "${BUILDLOG}" - ) || { RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}"; make V=1; } # verbose output for errors + make clean defconfig &> >(tee -a "${BUILDLOG}") && + make all &> >(tee -a "${BUILDLOG}") + ) || { + RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}" + make V=1 clean defconfig && make V=1 # verbose output for errors + } popd if grep ": warning:" "${BUILDLOG}" 2>&1 >> "${LOG_WARNINGS}"; then diff --git a/tools/ci/test_build_system.sh b/tools/ci/test_build_system.sh index cc7cc9e12..c4da2f8e9 100755 --- a/tools/ci/test_build_system.sh +++ b/tools/ci/test_build_system.sh @@ -48,6 +48,9 @@ function run_tests() print_status "Updating template config..." make defconfig || exit $? + print_status "Try to clean fresh directory..." + make clean || exit $? + BOOTLOADER_BINS="bootloader/bootloader.elf bootloader/bootloader.bin" APP_BINS="app-template.elf app-template.bin" From 3cd10899e6ca20869cd1bfea92fe13e2c069a191 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Fri, 30 Jun 2017 15:14:02 +0800 Subject: [PATCH 2/3] CI: Work around problem with running the initial 'make clean' in parallel (#18) Just don't pass '-j' to the 'make clean' command --- tools/ci/build_examples.sh | 4 ++-- tools/ci/test_build_system.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index c87c141a7..14a8e9b42 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -114,11 +114,11 @@ build_example () { # build non-verbose first local BUILDLOG=$(mktemp -t examplebuild.XXXX.log) ( - make clean defconfig &> >(tee -a "${BUILDLOG}") && + MAKEFLAGS= make clean defconfig &> >(tee -a "${BUILDLOG}") && make all &> >(tee -a "${BUILDLOG}") ) || { RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}" - make V=1 clean defconfig && make V=1 # verbose output for errors + make MAKEFLAGS= V=1 clean defconfig && make V=1 # verbose output for errors } popd diff --git a/tools/ci/test_build_system.sh b/tools/ci/test_build_system.sh index c4da2f8e9..0d4f36e4d 100755 --- a/tools/ci/test_build_system.sh +++ b/tools/ci/test_build_system.sh @@ -49,7 +49,7 @@ function run_tests() make defconfig || exit $? print_status "Try to clean fresh directory..." - make clean || exit $? + MAKEFLAGS= make clean || exit $? BOOTLOADER_BINS="bootloader/bootloader.elf bootloader/bootloader.bin" APP_BINS="app-template.elf app-template.bin" From 3d1d4fe15066e2085124ca535894052fed22176c Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Fri, 30 Jun 2017 15:46:31 +0800 Subject: [PATCH 3/3] build: Fix the warnings that break the tests unused variable 'lfn' 'isr_handler' defined but not used 'servo_set_angle' defined but not used 'gpio_test_signal' defined but not used 'change_duty' defined but not used --- components/fatfs/src/ff.c | 3 ++- .../main/mcpwm_basic_config_example.c | 4 ++++ .../mcpwm_bldc_control_hall_sensor_example.c | 17 ++++++++++++++--- .../main/mcpwm_servo_control_example.c | 10 ---------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/components/fatfs/src/ff.c b/components/fatfs/src/ff.c index 53361e50f..1675d644a 100644 --- a/components/fatfs/src/ff.c +++ b/components/fatfs/src/ff.c @@ -3673,8 +3673,9 @@ FRESULT f_sync ( FATFS *fs; DWORD tm; BYTE *dir; +#if _FS_EXFAT DEF_NAMBUF - +#endif res = validate(&fp->obj, &fs); /* Check validity of the file object */ if (res == FR_OK) { diff --git a/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c b/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c index f4ace70c0..3fc02e6da 100644 --- a/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c +++ b/examples/peripherals/mcpwm/mcpwm_basic_config/main/mcpwm_basic_config_example.c @@ -59,7 +59,9 @@ typedef struct { } capture; xQueueHandle cap_queue; +#if MCPWM_EN_CAPTURE static mcpwm_dev_t *MCPWM[2] = {&MCPWM0, &MCPWM1}; +#endif static void mcpwm_example_gpio_initialize() { @@ -162,6 +164,7 @@ static void disp_captured_signal(void *arg) } } +#if MCPWM_EN_CAPTURE /** * @brief this is ISR handler function, here we check for interrupt that triggers rising edge on CAP0 signal and according take action */ @@ -187,6 +190,7 @@ static void IRAM_ATTR isr_handler() } MCPWM[MCPWM_UNIT_0]->int_clr.val = mcpwm_intr_status; } +#endif /** * @brief Configure whole MCPWM module diff --git a/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c b/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c index 772a39176..58c4b06cb 100644 --- a/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c +++ b/examples/peripherals/mcpwm/mcpwm_bldc_control/main/mcpwm_bldc_control_hall_sensor_example.c @@ -27,7 +27,10 @@ #include "soc/mcpwm_struct.h" #define INITIAL_DUTY 10.0 //initial duty cycle is 10.0% -#define MCPWM_GPIO_INIT 0 //select which function to use to initialize gpio signals +#define MCPWM_GPIO_INIT 0 //select which function to use to initialize gpio signals + +#define GPIO_HALL_TEST_SIGNAL 0 //Make this 1 to enable generation of hall sensors test signal on GPIO13, 12, 14 +#define CHANGE_DUTY_CONTINUOUSLY 0 //Make this 1 to change duty continuously #define CAP_SIG_NUM 3 //three capture signals from HALL-A, HALL-B, HALL-C #define CAP0_INT_EN BIT(27) //Capture 0 interrupt bit @@ -94,6 +97,7 @@ static void mcpwm_example_gpio_initialize() gpio_pulldown_en(GPIO_CAP2_IN); //Enable pull down on CAP2 signal } +#if GPIO_HALL_TEST_SIGNAL /** * @brief Set gpio 13, 12, 14 as our test signal of hall sensors, that generates high-low waveform continuously * Attach this pins to GPIO 27, 26, 25 respectively for capture unit @@ -123,6 +127,7 @@ static void gpio_test_signal(void *arg) vTaskDelay(1); } } +#endif /** * @brief When interrupt occurs, we receive the counter value and display the time between two rising edge @@ -181,6 +186,7 @@ static void IRAM_ATTR isr_handler() MCPWM[MCPWM_UNIT_0]->int_clr.val = mcpwm_intr_status; } +#if CHANGE_DUTY_CONTINUOUSLY static void change_duty(void *arg) { int j; @@ -197,6 +203,7 @@ static void change_duty(void *arg) } } } +#endif /** * @brief Configure whole MCPWM module for bldc motor control @@ -304,9 +311,13 @@ static void mcpwm_example_bldc_control(void *arg) void app_main() { printf("Testing MCPWM BLDC Control...\n"); - //xTaskCreate(change_duty, "change_duty", 2048, NULL, 2, NULL); //uncomment to change duty continuously +#if CHANGE_DUTY_CONTINUOUSLY + xTaskCreate(change_duty, "change_duty", 2048, NULL, 2, NULL); +#endif cap_queue = xQueueCreate(1, sizeof(capture)); //comment if you don't want to use capture module - //xTaskCreate(gpio_test_signal, "gpio_test_signal", 2048, NULL, 2, NULL); +#if GPIO_HALL_TEST_SIGNAL + xTaskCreate(gpio_test_signal, "gpio_test_signal", 2048, NULL, 2, NULL); +#endif xTaskCreate(disp_captured_signal, "mcpwm_config", 4096, NULL, 2, NULL); //comment if you don't want to use capture module xTaskCreate(mcpwm_example_bldc_control, "mcpwm_example_bldc_control", 4096, NULL, 2, NULL); } diff --git a/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c b/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c index cbc07e105..1a7557379 100644 --- a/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c +++ b/examples/peripherals/mcpwm/mcpwm_servo_control/main/mcpwm_servo_control_example.c @@ -42,16 +42,6 @@ static uint32_t servo_per_degree_init(uint32_t degree_of_rotation) return cal_pulsewidth; } -/** - * @brief directly set servo motor to a particular angle - */ -static void servo_set_angle(uint32_t angle_of_rotation) -{ - uint32_t angle_t; - angle_t = servo_per_degree_init(angle_of_rotation); - mcpwm_set_duty_in_us(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_A, angle_t); -} - /** * @brief Configure MCPWM module */