Преглед изворни кода

Merge branch 'bugfix/build_fix_tests_and_warnings' into 'master'

Minor fix of some tests and warnings

Now, the build_examples have the correct diagnostics

See merge request !944

Anton Maklakov пре 8 година
родитељ
комит
e173dd400d

+ 2 - 1
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) {

+ 4 - 0
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

+ 14 - 3
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);
 }

+ 0 - 10
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
  */

+ 7 - 3
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
+            MAKEFLAGS= make clean defconfig &> >(tee -a "${BUILDLOG}") &&
+            make all &> >(tee -a "${BUILDLOG}")
+        ) || {
+            RESULT=$?; FAILED_EXAMPLES+=" ${EXAMPLE_NAME}"
+            make MAKEFLAGS= V=1 clean defconfig && make V=1 # verbose output for errors
+        }
     popd
 
     if grep ": warning:" "${BUILDLOG}" 2>&1 >> "${LOG_WARNINGS}"; then

+ 3 - 0
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..."
+    MAKEFLAGS= make clean || exit $?
+
     BOOTLOADER_BINS="bootloader/bootloader.elf bootloader/bootloader.bin"
     APP_BINS="app-template.elf app-template.bin"